Repository navigation
feat(feature-flags): Align rule and target management with API contracts - #1719
stanleyphu wants to merge 13 commits into
Conversation
[Medium impact] The PR appears safe to merge; no actionable new issues remain. SummaryAdds feature flag rule and membership management using the API’s field names.
The earlier, unnumbered deployment finding is addressed by stanleyphu’s confirmation that the compatible API is in production. stanleyphu also states that rule authoring requires the legacy target contract to be off. Retaining partial helper progress is intentional so callers can recover. Review checks covered source code, contract tests, and dependent callers in PR #1721. No tests or live API calls were run during this review.
|
|
@greptileai review Updated at |
BREAKING CHANGE: getFlag() and change-event snapshots now expose v2 rule entries with off_value and rules instead of legacy targets.
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: dx, based on recent contributors to the changed files (@gjtorikian, @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 |
79c7066 to
c110e5d
Compare
|
@greptileai review |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uator Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c110e5d to
464a215
Compare
|
@greptileai review |
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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
464a215 to
8e088a8
Compare
Why
I hit a 400 while testing rule authoring with the flags app: the SDK sent
feature_flag, while the API requiresflag_slug. Rule creation, listing, and the convenience helper now acceptflagSlugand send the correct field. Target lookup and filtered pagination handle both API contracts: aFlagTargetexposesruleId; aLegacyFlagTargetexposesvalueandvalueType.Membership creation sends only
rule_idandtarget_id. The helper retains the created rule and confirmed memberships after a later failure, and existing target aliases remain available.This stacks on #1717, which removes the v1 polling types, so the API's target object takes the plain
FlagTargetname. Retarget tomainonce #1717 merges.Release prerequisite: deploy the target membership API contract tested at revision
7a0095af09e7, and enable rule authoring for the affected teams with the legacy target contract off.Not covered by CI
7a0095af09e7, without request translation: rule CRUD and evaluation-order pagination, membership lookup and combined filters, ascending/descending cursor pagination, duplicate/conflicting targets, helper success, partial failure, recovery, and sibling preservation all passed.trueand v2false; reversing the rules changes the live decision totrue.value/valueTypewithoutruleId. Membership-only creation returns 400 in this mode, and the helper reports its retained empty rule.Repeat the successful membership check against the deployed API before release.
Proof
The updated SDK sent this request directly to the local API:
It then sent
POST /flag_targetswith{"rule_id":"flag_rule_01M4BVRT8FQ3N94ZPEVQX31SFZ","target_id":"user_01KM490ND31XPKGTYFAC9APFJ4"}. The API returned HTTP 201 with membershipflag_target_01M4BVRTACYNBCS05B5N3W7Y6W, the samerule_id, and novalue/value_typefields. Lookup and filtered listing returned the same membership.A later missing organization returned 404:
CreateRuleWithTargetsErrorretained ruleflag_rule_01M4BVRZBSC0MCY1ASQTC6230Qand its one confirmed membership; the next target was not attempted. Adding that next target to the retained rule succeeded.Response excerpts omit unchanged fields. These IDs belonged to disposable local fixtures that have been removed.
Fixes AUTH-7099