Repository navigation
feat(targeting): add single-clause if scenario - #453
Merged
toddbaert merged 1 commit intoNov 26, 2026
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
toddbaert
reviewed
Nov 25, 2026
Comment on lines
+46
to
+48
| # A single-clause if returns its argument when it is truthy (JSON Logic), so {"if": ["on"]} selects the "on" variant | ||
| Scenario: Single-clause if returns its argument | ||
| Given a String-flag with key "single-clause-if-flag" and a default value "fallback" |
Member
There was a problem hiding this comment.
Nit: with one argument there's no condition; JSON Logic just returns it as the trailing "else", regardless of truthiness. "Single-argument" is a bit more accurate than "single-clause" (my fault, I used that in the issue 😅).
Suggested change
| # A single-clause if returns its argument when it is truthy (JSON Logic), so {"if": ["on"]} selects the "on" variant | |
| Scenario: Single-clause if returns its argument | |
| Given a String-flag with key "single-clause-if-flag" and a default value "fallback" | |
| # A single-argument if returns that argument (JSON Logic), so {"if": ["on"]} selects the "on" variant | |
| Scenario: Single-argument if returns its argument | |
| Given a String-flag with key "single-argument-if-flag" and a default value "fallback" |
| ] | ||
| } | ||
| }, | ||
| "single-clause-if-flag": { |
Member
There was a problem hiding this comment.
To match the rename above.
Suggested change
| "single-clause-if-flag": { | |
| "single-argument-if-flag": { |
toddbaert
approved these changes
Nov 25, 2026
toddbaert
left a comment
Member
There was a problem hiding this comment.
Approving with a couple very minor nits.
JSON Logic returns the argument of a single-argument if ({"if": ["on"]}
resolves to "on"), but the suite had no coverage for it. Add the
single-argument-if-flag definition and a targeting scenario asserting it
resolves the on variant with reason TARGETING_MATCH.
Closes open-feature#452
Signed-off-by: Aditya Kumar <[email protected]>
Contributor
Author
|
Thanks for the review! Renamed to single-argument everywhere, including the flag key. That matches the JSON Logic behaviour better, appreciate the correction. |
adityakumar027
force-pushed
the
feat/single-clause-if-scenario
branch
from
November 25, 2026 20:30
f26f654 to
33a0814
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #452
Summary
Adds coverage for the single-clause
ifJSON Logic behaviour:{"if": ["on"]}returns its argument, so the flag resolves theonvariant.flags/testing-flags.json: newsingle-clause-if-flag(variantson/off, defaultoff, targeting{"if": ["on"]})gherkin/targeting.feature: new scenario "Single-clause if returns its argument" asserting the resolved value isonwith reasonTARGETING_MATCH; header comment updated to listflags/testing-flags.jsonnpm run gherkin-lintpasses. There are no local test runners in this repo (per agents.md), so SDK suites will execute the scenario.AI disclosure: prepared with AI assistance under the account owner's direction; I own and answer for this PR.