fix(flipt): Fix FliptProvider to honor server default variant when match is false#1776
fix(flipt): Fix FliptProvider to honor server default variant when match is false#1776Openroads wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Flipt provider to support server-provided default variants. Previously, if a targeting match was not found, the provider would immediately return the SDK's default value. The logic now checks for a server-provided variant key even when a match is false, allowing the server's default configuration to take precedence. A review comment identifies that the evaluation reason should be updated to 'DEFAULT' in these cases to comply with the OpenFeature specification, as the current implementation would incorrectly report 'TARGETING_MATCH'.
282b001 to
2f67900
Compare
|
@markphelps @liran2000 Could you please review this PR? |
2f67900 to
0e977b2
Compare
|
@markphelps please merge if the changes are ok. |
|
@Openroads there are some formatting issues |
…ere is no match Signed-off-by: Dariusz Szyszlak <dariusz.szyszlak@gmail.com>
…o match but default variant is returned from the server Signed-off-by: Dariusz Szyszlak <dariusz.szyszlak@gmail.com>
30e403c to
6bd0124
Compare
|
@liran2000 thanks for pointing that out. I fixed it with |
This PR
Fixes Flipt variant evaluation fallback behavior so that the provider honors Flipt’s server-side default variant even when match=false. Previously, FliptProvider#evaluateVariant returned the OpenFeature SDK defaultValue whenever response.isMatch() was false, which caused the server-provided default variant (variantKey) to be ignored.
adds a unit test covering the match=false + variantKey (server default) scenario
Notes
The new test uses a mocked /evaluate/v1/variant response with match=false and a non-empty variantKey to validate the behavior.
How to test
Run and verify the new test passes:
getStringVariantEvaluation_usesServerDefaultVariantWhenNoMatch