Skip to content

feat: Every SDK includes reason in responses for identity and environment flags - #133

Open
flagsmithsmith[bot] wants to merge 3 commits into
mainfrom
openhands/sdk-spec-v0.10.0
Open

flagsmithsmith[bot] wants to merge 3 commits into
mainfrom
openhands/sdk-spec-v0.10.0

Conversation

@flagsmithsmith

Copy link
Copy Markdown
Contributor

Contributes to Flagsmith/sdk-spec#27

@flagsmithsmith flagsmithsmith Bot added the sdk-spec Bumps of the Flagsmith SDK behavioural spec label Nov 20, 2026
@codspeed

codspeed Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 15 untouched benchmarks


Comparing openhands/sdk-spec-v0.10.0 (8565223) with main (9a53b08)

Open in CodSpeed

Flagsmith returns each flag's `reason` from /flags/ and /identities/, so
read it into `Flag#reason` as local evaluation already does, and expose it
from the spec steps (sdk-spec v0.10.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@flagsmithsmith

Copy link
Copy Markdown
Contributor Author

Pushed 5d7f1c5 to make the v0.10.0 spec pass: flags now carry their reason.

What changed

  • Flag.from_api (lib/flagsmith/sdk/models/flags.rb) now reads the reason that Flagsmith (2.294.0+, feat(SDK): Surface engine reasons in flag responses flagsmith#8944) returns for each flag from /flags/ and /identities/. So Flag#reason works under remote evaluation too, not only under local evaluation. It is nil when the API sends no reason, for example from older Flagsmith versions.
  • sdk-spec/steps.rb now returns each flag's reason from Flag#reason, as spec v0.10.0 asks.
  • Unit tests: the API fixtures now include reason, and there are new examples for environment and identity flag reasons and for a missing reason.

Why
The spec's Then the application receives the following flags: step now checks reason. The 6 failing scenarios got None because the steps didn't return the reason, and remote evaluation dropped it. The local evaluation engine already worked out the reasons (STATIC, DEFAULT, TARGETING_MATCH; segment=…), so those scenarios only needed the steps change.

bundle exec rake (rspec + rubocop) passes locally on Ruby 3.4.

@flagsmithsmith
flagsmithsmith Bot marked this pull request as ready for review November 20, 2026 20:16
@flagsmithsmith
flagsmithsmith Bot requested a review from a team as a code owner November 20, 2026 20:16
@flagsmithsmith
flagsmithsmith Bot requested review from a team and emyller and removed request for a team November 20, 2026 20:16

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread spec/sdk/flagsmith_spec.rb Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Adds an optional reason attribute to SDK flag responses, with fixture updates and tests covering static, targeting, and missing reasons, plus a spec workflow version bump. The change is additive and backward compatible.

Turn on auto-fix | Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sdk-spec Bumps of the Flagsmith SDK behavioural spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants