feat(conditions): flag/role guards on edges (G5) — Gate 3, Phase 3 done#24
Merged
Merged
Conversation
…Gate 3
Feature-flag and role guards now annotate the edges (and journey steps) they
gate (TRACKER step 3.5, failure modes G5/B5):
- A renders/handles edge enclosed by a flag call (isEnabled/useFlag/useFeature/…,
extensible via scan option `featureFlags`) or a role check (role===, hasRole,
hasPermission, can(), …) carries an EdgeCondition{kind:"flag"|"role"}.
- Ternary else-branches are negated; a flag hook result used as a bare boolean
(`const beta = useFlag("beta")`) is resolved back to its flag call.
- journeys() surfaces the handles-edge guard on the step it gates, so a path
reads "… onClick [flag isEnabled("new-billing")] → navigate /billing/new".
Also fix an inline-handler id collision: two inline-arrow on* handlers in one
component collapsed to a single event node (dropping the second's condition and
effect). Inline handlers are now disambiguated by line.
Eval: new `conditions` golden check + fixture g5-feature-flag (flag-gated
navigation, role-gated fetch, flag-gated child render). 92 parser + 29 core
tests pass; eval green (precision/recall 1.000). **Gate 3 passes — Phase 3 done.**
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 3.5 — Flag / role conditions (closes Gate 3)
Failure modes G5/B5. Feature-flag and role guards now annotate the edges — and the journey steps — they gate.
renders/handlesedge enclosed by a flag call (isEnabled/useFlag/useFeature/…, extensible via the newfeatureFlagsscan option) or a role check (role ===,hasRole,hasPermission,can(, …) carries anEdgeCondition{kind:"flag"|"role"}.const beta = useFlag("beta")) is resolved back to its flag call.journeys()surfaces the guard on the step it gates, so a path reads:▸ /billing • onClick [flag isEnabled("new-billing")] → /billing/newBonus fix
Inline-handler id collision: two inline-arrow
on*handlers in one component collapsed into a single event node (dropping the second's condition + effect). Inline handlers are now disambiguated by line — caught precisely because the two guards in the g5 fixture would otherwise merge.Eval
New
conditionsgolden check + fixture g5-feature-flag (flag-gated navigation, role-gated fetch, flag-gated child render). No schema change —EdgeConditionalready existed.Verification
pnpm eval: green, precision/recall 1.000. Gate 3 passes → Phase 3 (journey graph) complete.Next: Phase 4 (matching engine).
🤖 Generated with Claude Code