open-feature / open-feature/java-sdk-contrib

[Flipt Provider]Default variant metadata not returned when request not hit variant of a flag

Open
#1,669 1 comment 0 reactions 0 assignees View on GitHub

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.

Image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.