Repository navigation
feat(feature-flags)!: Evaluate ordered targeting rules - #1717
stanleyphu wants to merge 4 commits into
Conversation
[Medium impact] The PR appears safe to merge as an intentional breaking release. SummaryChanges local flag evaluation from enable-only targets to ordered rules. The first matching rule can serve
|
|
How do we plan to roll this out? I imagine now that we have the v2 version of the SDK API shipped, we can just ship this without waiting for the full rollout of targeting rules.
However, this would break existing targeting, so I'm wondering when the right order to ship this SDK change would be |
BREAKING CHANGE: getFlag() and change-event snapshots now expose v2 rule entries with off_value and rules instead of legacy targets.
c0860ed to
c9ac1cd
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
⚓ Shipyard review suggestionSuggested team: applied-ai, based on recent contributors to the changed files (@nicknisi).
Links open Shipyard for confirmation. Choosing a reviewer overrides availability; “Pick for me” skips known absences. Shipyard Analysis⏳ Generating analysis... ⚓ Explore the analysis in depth in Shipyard · 🔄 Re-run analysis |
|
⚓ Review requested from @nicknisi for team Shipyard Analysis⏳ Generating analysis... ⚓ Explore the analysis in depth in Shipyard · 🔄 Re-run analysis |
|
@greptileai review |
Why
The runtime's enable-only evaluator cannot honor an ordered rule that serves false. The runtime now polls only the v2 payload and evaluates rules first-match-wins. Unknown rules/operators do not match; unparseable served values use the caller's default.
This is a breaking change for anyone reading flag configuration:
getFlag()and change-event snapshots returnrulesplusoff_valueinstead oftargets.isEnabled()keeps its existing signature.FlagPollEntry,FlagPollResponse({ version: 2, flags }),FlagPollRuleandFlagPollCondition. The v1 types are gone.bootstrapFlagsdata is ignored and readiness still resolves. A v1 poll response is treated as malformed: the last good snapshot is kept anderroris emitted. Disabled v1 targets have no v2 equivalent; they never affected evaluation.The README describes the runtime in v2 terms.
Not covered by CI
payload_version=2and a future bootstrap envelope was cached as two flags. Both pass now.codex/auth-7096-poll-payloads. The relay forwarded live API payloads; credentials stayed inside the testing app.false, orgtrue, user + orgfalse), ignored a v1 bootstrap while still resolving readiness, polled/sdk/feature-flags?payload_version=2, and kept its snapshot and emitted oneerrorwhen a poll returned a v1 payload.Proof
The live poll requested
/sdk/feature-flags?payload_version=2and loaded 16 flags. For the disposablepoll-payload-smokeflag, whose user exclusion precedes its organization inclusion:The SDK on
mainreads the enable-only v1 projection and returnstruefor the same user + org. This branch preserves the exclusion.Fixes AUTH-7097