feat(evaluators): add nested $ref resolution scenarios#343
feat(evaluators): add nested $ref resolution scenarios#343
Conversation
Summary of ChangesHello, 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 Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
|
relates too open-feature/flagd#1875 |
flags/evaluator-refs.json
Outdated
| }, | ||
| "is_privileged": { | ||
| "or": [ | ||
| {"$ref": "is_ballmer"}, |
There was a problem hiding this comment.
I'm not sure we want to support $refs that reference $refs.
If we do, are we only going to support it naively, as shown here, where "dependency" refs must appear first? I worry that this could be problematic because of non-deterministic ordering of JSON keys. If some server serializes $evaluators they might not be rendered in the correct order. That's what point 2 here is mentioning: open-feature/flagd#1875
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for nested evaluator references within flag targeting configurations. It adds a new flag, nested-ref-targeted-flag, and a composite evaluator, is_privileged, which utilizes a $ref to another evaluator. Corresponding Gherkin test scenarios have been added to validate the resolution of these nested references against various context attributes. I have no feedback to provide.
|
Good catch, @toddbaert! Inlined the |
82d5489 to
7d36c47
Compare
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>
…tor gherkin suite Adds the nested $ref resolution scenario and is_privileged evaluator ref from the SDK-level gherkin to the evaluator suite, with matching flag definitions (nested-ref-targeted-flag + is_privileged) in evaluator/flags/testkit-flags.json. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
… nested $ref Addresses toddbaert's review concern: nested $ref resolution relies on JSON key declaration order, which is non-deterministic when serialised by a server (see open-feature/flagd#1875). Inlining the is_ballmer condition directly into is_privileged eliminates the dependency and ensures deterministic behaviour across all conformance implementations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
7d36c47 to
963cb3b
Compare
Summary
Adds
@evaluator-refsand@evaluator-ref-edge-casestagged scenarios totargeting.featurecovering recursive$refresolution 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 scenarioChanges
Existing scenario tagged
The existing "Evaluator reuse" scenario now has
@evaluator-refsso SDK implementations can explicitly opt in.New: Nested $ref resolution (
nested-ref-targeted-flag)A new
is_privilegedevaluator inevaluator-refs.jsonreferencesis_ballmervia$ref:The
nested-ref-targeted-flaguses$ref: is_privileged, requiring two levels of resolution. Tests:email = ballmer@macrosoft.comrole = adminemail = other@example.comRelated