Skip to content

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

Merged
khvn26 merged 2 commits into
mainfrom
openhands/sdk-spec-v0.10.0
Nov 20, 2026
Merged

khvn26 merged 2 commits into
mainfrom
openhands/sdk-spec-v0.10.0

Conversation

@flagsmithsmith

@flagsmithsmith flagsmithsmith Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Contributes to Flagsmith/sdk-spec#27
Closes #293

@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

✅ 15 untouched benchmarks


Comparing openhands/sdk-spec-v0.10.0 (bdd9a29) with main (059b90e)

Open in CodSpeed

Flags already carry the reason Flagsmith or the local evaluation engine
evaluated them with. Pass it to the spec, and cover local evaluation
reasons for environment and identity flags with unit tests.

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

Copy link
Copy Markdown
Contributor Author

Pushed bdd9a29 to pass SDK spec v0.10.0, which now checks each flag's reason.

Cause of the failure: the SDK already sets Flag.reason. Remote evaluation reads it from the /flags/ and /identities/ responses. Local evaluation gets it from the engine (STATIC, DEFAULT, TARGETING_MATCH; segment=…, SPLIT; weight=…). But sdk-spec/steps.mts left reason out of the flags it returned, so the spec saw None.

Changes:

  • sdk-spec/steps.mts: the steps that get flags now return flag.reason, as the spec README requires. This includes the experiment flag step when it returns a real Flag. A default flag has no reason, so none is returned for it.
  • sdk/models.ts: the Flag.reason doc comment was wrong ("unique per Flagsmith project"). It now explains what the reason is.
  • New unit tests for local evaluation reasons:
    • Environment flags get STATIC, because segments that need an identity are ignored.
    • Identity flags get TARGETING_MATCH; segment=… when the traits match a segment override.
    • Identity flags get DEFAULT when no segment override matches.

Locally, the full vitest suite passes (505 tests). I did not run the spec itself locally.

@khvn26
khvn26 marked this pull request as ready for review November 20, 2026 19:37
@khvn26
khvn26 requested a review from a team as a code owner November 20, 2026 19:37
@khvn26
khvn26 requested review from khvn26 and removed request for a team November 20, 2026 19:37

@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.

No issues found across 5 files

Confidence score: 5/5

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

Auto-approved: Adds reason to environment and identity flag outputs in the sdk-spec harness, bumps the spec workflow to v0.10.0, and adds tests pinning local-evaluation reasons. Bounded spec-conformance change with clear motivation and test coverage.

Turn on auto-fix | Re-trigger cubic

@khvn26
khvn26 merged commit 957b1e8 into main Nov 20, 2026
10 checks passed
khvn26 pushed a commit that referenced this pull request Nov 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[9.5.0](v9.4.0...v9.5.0)
(2026-11-20)


### Features

* Every SDK includes `reason` in responses for identity and environment
flags
([#327](#327))
([957b1e8](957b1e8))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

Surface engine reasons in SDK response objects

1 participant