Skip to content

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

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

khvn26 merged 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

✅ 12 untouched benchmarks


Comparing openhands/sdk-spec-v0.10.0 (f57c147) with main (7c624b1)

Open in CodSpeed

`Flagsmith.Schemas.Flag` now has a `reason`: why the flag has its value,
e.g. "STATIC", "DEFAULT", "TARGETING_MATCH; segment=premium_users" or
"SPLIT; weight=60.0". Flags evaluated by the SDK, from the environment
document, take the engine's reason; flags from the /identities/ API take
the `reason` Flagsmith returns for each.

Implements Flagsmith SDK spec v0.10.0.

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

Copy link
Copy Markdown
Contributor Author

Implemented spec v0.10.0 (flag reasons) in 415fd75.

What changed

  • Flagsmith.Schemas.Flag has a new reason field. It says why the flag has its value, for example "STATIC", "DEFAULT", "TARGETING_MATCH; segment=premium_users" or "SPLIT; weight=60.0".
  • Flags the SDK evaluates from the environment document get the engine's reason. That covers local evaluation, and also remote environment flags, which this SDK evaluates from /environment-document/. The engine already worked out reasons but dropped them; Flagsmith.Engine now copies each one onto the feature state it returns (a new virtual reason field on Environment.FeatureState).
  • Flags from the /identities/ API use the reason that Flagsmith (2.294.0 and later) returns for each flag. Features.FeatureState now casts that field.
  • sdk-spec/steps.exs passes flag.reason through to the harness.

Tests

  • New engine test: identity flags get TARGETING_MATCH, SPLIT, STATIC and DEFAULT reasons.
  • Client tests: environment flags and /identities/ flags carry their reason.
  • Existing engine tests now expect the evaluated "STATIC" reason.
  • mix format --check-formatted, mix test (433 tests) and mix dialyzer pass locally.
  • I ran the whole spec v0.10.0 locally against Flagsmith 2.294.0: 27 passed.

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

@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 9 files

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

Turn on auto-fix | Re-trigger cubic

Comment thread test/support/generators.ex Resolved
Comment thread lib/flagsmith_engine.ex Resolved
The fixture's header_size value comes from its 60% split, and Flagsmith
reports identity overrides as "TARGETING_MATCH; segment=identity_overrides".

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 2 files (changes from recent commits).

Confidence score: 5/5

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

Requires human review: Adds evaluation reason values (STATIC/SPLIT/TARGETING_MATCH) to public Flag and FeatureState SDK responses and bumps the sdk-spec workflow to v0.10.0. Exposing this new response field to all SDK consumers is a product/data-exposure decision needing human sign-off.

Turn on auto-fix | Re-trigger cubic

@khvn26
khvn26 merged commit 4f3cdf1 into main Nov 23, 2026
5 checks passed
@khvn26
khvn26 deleted the openhands/sdk-spec-v0.10.0 branch November 23, 2026 12:06
khvn26 pushed a commit that referenced this pull request Nov 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.7.0](v2.6.0...v2.7.0)
(2026-11-23)


### Features

* Every SDK includes `reason` in responses for identity and environment
flags
([#77](#77))
([4f3cdf1](4f3cdf1))

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

1 participant