Skip to content

Conversation

@kylejuliandev
Copy link
Contributor

This PR

Updates the JsonEvaluator for the InProcess resolver to return a general error when the targeting variant is not found. This is defined behaviour in the targeting.feature. Also used this as an opportunity to add an extra check for the type of error and message being returned in the previous test case.

Related Issues

Notes

Follow-up Tasks

How to test

Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
@kylejuliandev kylejuliandev added the provider:flagd Issues related to provider flagd label Jan 18, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kylejuliandev, 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 error handling within the flagd provider's in-process JSON evaluator. It introduces a specific General error when a feature flag's targeting logic points to a non-existent variant, ensuring compliance with defined behavior. Additionally, it improves test coverage by adding a new test case for this scenario and enhancing an existing test to assert error types and messages more precisely.

Highlights

  • Error Handling for Missing Variants: The JsonEvaluator now throws a FeatureProviderException with ErrorType.General when a feature flag's targeting resolves to a variant that is not defined, aligning with the defined behavior.
  • New Test Case for Missing Variants: A new unit test, TestJsonEvaluatorFlagWithMissingVariantReturnsGeneralError, has been added to verify the correct error behavior when a targeted variant is missing.
  • Enhanced Error Assertion in Existing Test: The TestJsonEvaluatorFlagWithInvalidVariantReturnsParseError test has been updated to include explicit assertions for both the ErrorType and the error message of the FeatureProviderException.
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
Contributor

@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 the JsonEvaluator to throw a General error when a targeting rule resolves to a variant that is not defined, which aligns with the specified behavior. The changes include adding the exception logic and a corresponding unit test. Additionally, an existing test was improved to assert the specific error type and message.

My review focuses on improving the clarity of the new error message. I've suggested making it more descriptive by including the name of the missing variant and using string interpolation for consistency and readability. This will aid in debugging and improve overall code maintainability.

Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
@kylejuliandev kylejuliandev marked this pull request as ready for review January 18, 2026 23:45
@kylejuliandev kylejuliandev requested review from a team as code owners January 18, 2026 23:45
@askpt askpt added this pull request to the merge queue Jan 19, 2026
Merged via the queue into open-feature:main with commit 6b30828 Jan 19, 2026
11 checks passed
@kylejuliandev kylejuliandev deleted the flagd-return-general-error-when-variant-not-found branch January 19, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

provider:flagd Issues related to provider flagd

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants