feat: Update gherkin suite to test non-string attributes in fractional - #380
Conversation
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
📝 WalkthroughWalkthroughThe change reformats targeting fixtures, updates one negative fractional-weight case, and adds ChangesFractional evaluation fixtures
Estimated code review effort: 3 (Moderate) | ~30 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@gherkin/targeting.feature`:
- Around line 608-640: Replace the duplicate JSON member names in the affected
Examples rows of “Fractional operator with advanced structures” with distinct
keys, preserving each row’s intended value coverage. Recompute and update the
expected bucket values for those modified hashing inputs so the fixtures remain
deterministic and valid across SDK parsers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 918401f1-69b4-4d6c-81a9-56cc069da3a8
📒 Files selected for processing (3)
flags/custom-ops.jsonflags/edge-case-flags.jsongherkin/targeting.feature
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
toddbaert
left a comment
There was a problem hiding this comment.
I left a couple things for you to confirm, and I will leave one more here:
We mentioned wanting an "opt-in" new error handling paradigm, wherein targeting errors would cause erroneous evaluations; however, that's not implemented here (in fact the opposite is explicitly asserted). I'm fine with that, I just want to mention it. in case it was an oversight. Maybe you intend to work on that separately (no problem).
Yes, this PR only deals with our default behaviour and a future PR will create tests for this opt-in strict mode. |
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
gherkin/targeting.feature (1)
680-684: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winExpect the supplied fallback value for invalid implicit inputs.
The scenario passes
"fallback"as the evaluation default at Line 680, but expects"draw"at Line 683. Invalid implicit targeting should return"fallback"with reason"DEFAULT"; otherwise this test contradicts the documented fallback contract.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@gherkin/targeting.feature` around lines 680 - 684, Update the scenario for the String flag "fractional-flag-shorthand" so invalid implicit targeting expects the supplied default value "fallback" instead of "draw", while preserving the expected reason "DEFAULT".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@gherkin/targeting.feature`:
- Around line 680-684: Update the scenario for the String flag
"fractional-flag-shorthand" so invalid implicit targeting expects the supplied
default value "fallback" instead of "draw", while preserving the expected reason
"DEFAULT".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c3e84c22-6d51-46cb-b609-538cb8120736
📒 Files selected for processing (1)
gherkin/targeting.feature
This PR
Updates the Gherkin test suite under the a new
@fractional-v3tag intargeting.featureto test the new behavior of thefractionaloperator as defined in the Fractional Non-String Rand Units ADR.Before implementing this behavior across multi-language SDK providers, this test suite guarantees that all SDKs implement CBOR normalization, data structures, and edge-case bucketing consistently and correctly.
Specifically, this PR introduces test scenarios covering:
1and1.0) normalize to the same integer type before encoding.0.0and-0.0map to the unsigned integer0.{"a": 1, "b": 2}yields the exact same bucket as{"b": 2, "a": 1}).{}, empty arrays[], nested collections, and null value handling inside structures.[flagKey, targetingKey].targetingKeyvalues in implicit mode fail gracefully, falling back to the default variant with aDEFAULTreason.defaultVariant.Related Issues
Fixes #378
Notes
@fractional-v3tag. Existing SDK implementations (currently running@fractional-v2or@fractional-v1) will not fail in CI as long as their test runners filter outv3during the transition period.Follow-up Tasks
@fractional-v3in their respective test suites.