feat(operators): add follow-up error scenarios for operator null-return behaviour#356
feat(operators): add follow-up error scenarios for operator null-return behaviour#356
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive test coverage for edge cases and error scenarios across several targeting operators, including string comparisons, semantic versioning, and fractional weighting. The added Gherkin scenarios and flag definitions ensure that invalid inputs or incorrect argument counts result in a fallback to the default variant rather than unexpected behavior. One review comment points out that the new flag configurations are duplicated across multiple JSON files, which could lead to maintenance challenges, and suggests centralizing these definitions if the framework permits.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds several test cases and flag definitions to handle edge cases and error scenarios for targeting operators such as starts_with, ends_with, sem_ver, and fractional. These additions ensure that operators return null on error to correctly trigger default variant fallbacks and that negative weights in fractional targeting are clamped to zero. I have no feedback to provide.
d17d0ed to
db9d03f
Compare
…rn behaviour Covers the remaining cases from open-feature/flagd#1874 identified in the review of #342: - starts_with / ends_with: non-string first argument → must return null - starts_with / ends_with: wrong argument count → must return null - sem_ver: wrong argument count (missing target version) → must return null - fractional: all-zero bucket weights (no bucket matched) → must return null - fractional: negative bucket weight clamped to zero → "one" gets effective weight 0, "two" gets 100% of the weight All scenarios use a bare operator as the targeting expression (not wrapped in 'if') so a null result selects the defaultVariant directly. Scenarios are tagged @operator-errors and mirrored in both the SDK-level gherkin (gherkin/targeting.feature) and the evaluator-level gherkin files (evaluator/gherkin/{string,semver,fractional}.feature) with matching flag definitions added to both flags/edge-case-flags.json and evaluator/flags/testkit-flags.json. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
db9d03f to
2c6d669
Compare
Covers the remaining cases from open-feature/flagd#1874 identified in the review of #342:
All scenarios use a bare operator as the targeting expression (not wrapped in 'if') so a null result selects the defaultVariant directly. Scenarios are tagged @operator-errors and mirrored in both the SDK-level gherkin (gherkin/targeting.feature) and the evaluator-level gherkin files (evaluator/gherkin/{string,semver,fractional}.feature) with matching flag definitions added to both flags/edge-case-flags.json and evaluator/flags/testkit-flags.json.
This PR
Related Issues
Fixes #1234523
Notes
Follow-up Tasks
How to test