open-feature / open-feature/java-sdk-contrib
[Flipt Provider]Default variant metadata not returned when request not hit variant of a flag
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 49
- Forks
- 81
- Avg merge
- 20h 3m
- Merged PRs (30d)
- 6
Description
Hey there,
My team's adopting the latest Flipt provider sdk version 0.1.3.
We try to get variant attachment for requests which do not hit any variant. The rules we defined work as expected via Flipt Playground on Flipt UI and via Flipt API call, but failed via Flipt provider sdk.
According to Flipt UI, the response should fallback to the default variant and get its metadata including the attachment.
However, it does not work as expected on Flipt UI. Instead, it returns only "null" value.
// response not as expected
:FlagEvaluationDetails(flagKey=my_flag_key, value=null, variant=null, reason=DEFAULT, errorCode=null, flagMetadata=dev.openfeature.sdk.ImmutableMetadata@xx)
The issue is possibly caused by the code logic here
Expectation:
GIVEN a variant flag is created and rules with default rule are defined
WHEN a request with context does not hit any variant of a flag
THEN the metadata of the default variant should be returned
Code to reproduce:
FlagEvaluationDetails<Value> flagEvaluationDetails = client.getObjectDetails(flagKey, null, evaluationContext);
ImmutableMetadata configMeta = flagEvaluationDetails.getFlagMetadata();
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in providers/flipt/src/main/java/dev/openfeature/contrib/providers/flipt/FliptProvider.java around the referenced logic at line 158. Reproduce the issue with client.getObjectDetails(flagKey, null, evaluationContext) using a request that matches no variant, then compare the returned value, variant, and metadata with the expected default-variant behavior. Done means the default variant metadata, including its attachment, is returned for the fallback case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100