Skip to content

feat(targeting): add single-clause if scenario - #453

Merged
toddbaert merged 1 commit into
open-feature:mainfrom
adityakumar027:feat/single-clause-if-scenario
Nov 26, 2026
Merged

toddbaert merged 1 commit into
open-feature:mainfrom
adityakumar027:feat/single-clause-if-scenario

Conversation

@adityakumar027

Copy link
Copy Markdown
Contributor

Closes #452

Summary

Adds coverage for the single-clause if JSON Logic behaviour: {"if": ["on"]} returns its argument, so the flag resolves the on variant.

  • flags/testing-flags.json: new single-clause-if-flag (variants on/off, default off, targeting {"if": ["on"]})
  • gherkin/targeting.feature: new scenario "Single-clause if returns its argument" asserting the resolved value is on with reason TARGETING_MATCH; header comment updated to list flags/testing-flags.json

npm run gherkin-lint passes. 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.

@adityakumar027
adityakumar027 requested a review from a team as a code owner November 23, 2026 13:32
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: abf4b5e0-7bf6-42a9-b9cf-303da9aca5c4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment thread gherkin/targeting.feature Outdated
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"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Comment thread flags/testing-flags.json Outdated
]
}
},
"single-clause-if-flag": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To match the rename above.

Suggested change
"single-clause-if-flag": {
"single-argument-if-flag": {

@toddbaert toddbaert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
@adityakumar027

Copy link
Copy Markdown
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
adityakumar027 force-pushed the feat/single-clause-if-scenario branch from f26f654 to 33a0814 Compare November 25, 2026 20:30
@toddbaert
toddbaert merged commit 94810ef into open-feature:main Nov 26, 2026
4 checks passed
aepfli added a commit that referenced this pull request Nov 30, 2026
Brings in what main added to gherkin/ since this branch was cut: the
@resolve scenarios (#448, #457), the single-argument if (#453), the
int64/uint64 fractional float rows (#456) and the unchanged-flag change
event (#455).

Signed-off-by: Simon Schrottner <[email protected]>
aepfli added a commit that referenced this pull request Dec 1, 2026
Brings in what main added to gherkin/ since this branch was cut: the
@resolve scenarios (#448, #457), the single-argument if (#453), the
int64/uint64 fractional float rows (#456) and the unchanged-flag change
event (#455).

Signed-off-by: Simon Schrottner <[email protected]>
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.

test: add scenario for single-clause if

2 participants