Skip to content

feat: Make defaultVariant and value optional#331

Open
marcozabel wants to merge 6 commits intoopen-feature:mainfrom
open-feature-forking:feat/make-default-variant-optional
Open

feat: Make defaultVariant and value optional#331
marcozabel wants to merge 6 commits intoopen-feature:mainfrom
open-feature-forking:feat/make-default-variant-optional

Conversation

@marcozabel
Copy link
Contributor

This PR

Updates the test cases to use the DEFAULT reason if no defaultVariant was set or the targeting rules did not evaluate a match.

Related Issues

open-feature/flagd#1856

Notes

Follow-up Tasks

How to test

@marcozabel marcozabel requested a review from a team as a code owner January 29, 2026 11:22
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcozabel, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the flag evaluation process by ensuring that when a defaultVariant is not explicitly defined or when targeting rules fail to produce a match, the flag evaluation correctly reports a DEFAULT reason. This change improves the clarity of flag resolution outcomes, moving away from an ERROR state in such scenarios, and is reflected in updated Gherkin test cases.

Highlights

  • Test Case Updates: Updated existing test cases in gherkin/evaluation.feature to align with the new behavior where a DEFAULT reason is returned when no defaultVariant is set or targeting rules do not evaluate a match.
  • Reason and Error Code Changes: Modified the expected reason from ERROR to DEFAULT and removed the FLAG_NOT_FOUND error_code for scenarios where flags resolve to a default state due to missing defaultVariant or targeting rule mismatches.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates Gherkin test cases to reflect a change in behavior for flags without a defaultVariant. The new expectation is to return a DEFAULT reason instead of a FLAG_NOT_FOUND error. The changes in the test scenarios correctly capture this new logic. My review includes suggestions to remove a couple of redundant test cases that were introduced as a result of these changes, which will help improve the clarity and maintainability of the test suite.

@leakonvalinka
Copy link
Member

I think we only want to change the reason column to DEFAULT here and leave the default column as it was. The way I understood the task described in the issue is that we only want to make the defaultVariant optional, but not the code-default value (= the default column here), because that's what we want to fall back to if no targeting variant matches/exists + no default variant exists either.

Copy link
Member

@leakonvalinka leakonvalinka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now

Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
@marcozabel marcozabel force-pushed the feat/make-default-variant-optional branch from 7e4d20b to 8a919e5 Compare February 4, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants