feat(openfeature): map Source.Fallback.Reason to OpenFeature codes (SDK-130)#97
Draft
tylerjroach wants to merge 1 commit into
Conversation
…DK-130)
Before: every fallback path collapsed to ErrorCode.FLAG_NOT_FOUND via
result.isFallback(). Callers debugging a missing-context-key or
backend-error scenario had no way to tell it from a typo in the flag
name.
After: dispatch on result.getSource(). When it's a Source.Fallback,
translate the reason to the OpenFeature ErrorCode + Reason the spec
assigns to it:
FLAG_NOT_FOUND -> ErrorCode.FLAG_NOT_FOUND, DEFAULT
MISSING_CONTEXT_KEY -> ErrorCode.TARGETING_KEY_MISSING, ERROR
NO_ROLLOUT_MATCH -> no error, DEFAULT (spec: not an error)
BACKEND_ERROR -> ErrorCode.GENERAL, ERROR
unrecognized reason -> ErrorCode.GENERAL (fail closed — a new reason
added to the base SDK enum without wiring here
surfaces as an error rather than a silent success)
Bump base pom dep from mixpanel-java 1.8.0 -> 1.10.0 (assumed next tag
containing SDK-79 / #89 — release manager may adjust). Bump wrapper
version 0.1.1 -> 0.2.0 (new capability surface).
Tests: 4 new cases covering each reason. Existing FLAG_NOT_FOUND tests
still pass — the 1-arg SelectedVariant constructor now defaults source
to Fallback(FLAG_NOT_FOUND).
Note: this PR is intentionally branched off fix/sdk-79-variant-source-fallback-reason
(#89) since the Source model class it depends on doesn't exist on
master yet. When #89 merges, rebase this branch onto master and only
the wrapper-side diff remains.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Confidence Score: 5/5This looks safe to merge once the documented dependency release is available.
|
| Filename | Overview |
|---|---|
| openfeature-provider/pom.xml | Updates the provider version and its mixpanel-java dependency. |
| openfeature-provider/src/main/java/com/mixpanel/openfeature/MixpanelProvider.java | Maps each fallback source reason to the corresponding OpenFeature result. |
| openfeature-provider/src/test/java/com/mixpanel/openfeature/MixpanelProviderTest.java | Adds focused tests for each supported fallback reason. |
Reviews (1): Last reviewed commit: "feat(openfeature): map Source.Fallback.R..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes SDK-79 for Java at the OpenFeature layer. Base PR #89 adds `Source.Fallback.Reason` to `SelectedVariant` but the OpenFeature wrapper still uses `result.isFallback()` and collapses every fallback into `ErrorCode.FLAG_NOT_FOUND`. This PR wires the wrapper to the reason.
Branch base
This PR is intentionally branched off `fix/sdk-79-variant-source-fallback-reason` (#89), not `master`, because `Source` doesn't exist on master yet. When #89 merges:
Changes
Mapping table
Matches PHP/Python/Ruby.
Blocked on
Test plan
Refs: SDK-130, SDK-79
🤖 Generated with Claude Code