Skip to content

test(evaluators): add nested $ref resolution scenarios#343

Open
aepfli wants to merge 1 commit intomainfrom
test/evaluator-ref-edge-cases
Open

test(evaluators): add nested $ref resolution scenarios#343
aepfli wants to merge 1 commit intomainfrom
test/evaluator-ref-edge-cases

Conversation

@aepfli
Copy link
Member

@aepfli aepfli commented Mar 12, 2026

Summary

Adds @evaluator-refs and @evaluator-ref-edge-cases tagged scenarios to targeting.feature covering recursive $ref resolution from flagd#1875.

New Tags

  • @evaluator-refs — added to the existing basic evaluator reuse scenario (previously untagged)
  • @evaluator-ref-edge-cases — for the new nested resolution scenario

Changes

Existing scenario tagged

The existing "Evaluator reuse" scenario now has @evaluator-refs so SDK implementations can explicitly opt in.

New: Nested $ref resolution (nested-ref-targeted-flag)

A new is_privileged evaluator in evaluator-refs.json references is_ballmer via $ref:

"is_privileged": {
  "or": [
    {"$ref": "is_ballmer"},
    {"==": ["admin", {"var": ["role"]}]}
  ]
}

The nested-ref-targeted-flag uses $ref: is_privileged, requiring two levels of resolution. Tests:

context expected
email = ballmer@macrosoft.com privileged (via nested is_ballmer)
role = admin privileged (via direct admin check)
email = other@example.com standard (neither condition met)

Related

Adds @evaluator-ref-edge-cases tagged scenarios covering:
- Tags existing 'Evaluator reuse' scenario with @evaluator-refs
- Adds nested $ref: evaluator 'is_privileged' references 'is_ballmer'
  to verify recursive resolution works correctly
- Tests that nested resolution via different context paths both work

Addresses: open-feature/flagd#1875

Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@aepfli aepfli requested a review from a team as a code owner March 12, 2026 15:15
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 expands the test suite for flag evaluation by introducing scenarios that validate nested $ref resolution within evaluators. It ensures that the system correctly handles complex referencing patterns, improving the robustness of feature flag targeting logic and addressing a reported bug related to recursive $ref usage.

Highlights

  • New Nested $ref Resolution Scenarios: Added new tagged scenarios (@evaluator-refs, @evaluator-ref-edge-cases) to targeting.feature to cover recursive $ref resolution, addressing flagd#1875.
  • New is_privileged Evaluator: Introduced a new is_privileged evaluator in evaluator-refs.json that demonstrates two levels of $ref resolution by referencing is_ballmer.
  • Existing Scenario Tagged: The existing "Evaluator reuse" scenario in targeting.feature was tagged with @evaluator-refs for explicit SDK opt-in.
Changelog
  • flags/evaluator-refs.json
    • Added a new flag nested-ref-targeted-flag to test multi-level $ref resolution.
    • Introduced an is_privileged evaluator that uses $ref to another evaluator (is_ballmer) and an additional condition.
  • gherkin/targeting.feature
    • Applied the @evaluator-refs tag to the existing 'Evaluator reuse' scenario.
    • Added a new scenario 'Nested evaluator ref resolution' tagged with @evaluator-refs and @evaluator-ref-edge-cases to test the new nested $ref logic.
Activity
  • No human activity has been recorded on this pull request yet.
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 successfully introduces nested $ref resolution scenarios, addressing the issue described in flagd#1875. The evaluator-refs.json file correctly defines the new nested-ref-targeted-flag and the is_privileged evaluator, which leverages a nested $ref to is_ballmer. The targeting.feature file includes a new scenario, "Nested evaluator ref resolution," with comprehensive examples that validate the expected behavior for different context inputs. The addition of @evaluator-refs and @evaluator-ref-edge-cases tags also improves test organization. Overall, the changes are well-implemented and provide good test coverage for the new functionality.

@aepfli
Copy link
Member Author

aepfli commented Mar 12, 2026

relates too open-feature/flagd#1875

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.

1 participant