FE-747: Declarative output routing for branching transitions#154
FE-747: Declarative output routing for branching transitions#154kostandinang wants to merge 5 commits into
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR SummaryLow Risk Overview
Reviewed by Cursor Bugbot for commit 578e7c9. Bugbot is set up for automated code reviews on this repo. Configure here. |
f9de408 to
ee16289
Compare
ee16289 to
eef2f05
Compare
New TRACK F frontier between petri-epic-verification-merge (done) and petri-graph-compilation (horizon, blocked on FE-700). Moves conditional output routing from wireHandlers fire closures into typed Guard predicates declared on HandlerDescriptor so a topology-only consumer can enumerate reachable output places per transition without invoking actions, reports, or the test runner — structural prerequisite for any static analysis (simulation, reachability, deadlock detection) and FE-700-independent. Retires the "Declarative output arcs" sub-bullet under petri-graph-compilation since it's now its own frontier; keeps "Token state enrichment" there. Co-Authored-By: Claude <noreply@anthropic.com>
Move conditional output routing from wireHandlers fire closures into typed Guard predicates declared on HandlerDescriptor. ActionDescriptor gains a required guard:Guard (replacing routeField); RunTestsDescriptor adds passGuard; AssessSemanticDescriptor adds satisfiedGuard. wireHandlers consumes them via a pure evalGuard(guard, report) helper. Adds enumerateCandidateOutputs(transition) so static consumers can derive the reachable output-place set per transition from topology alone, without instantiating actions, reports, or the test runner. Halt paths (budget exhaustion, verify-epic failure) and token transforms stay in fire closures and remain follow-on slices. New invariant I125-K. Engine contract suite unchanged (84 orchestrator tests pass); npm run verify green. Co-Authored-By: Claude <noreply@anthropic.com>
Disambiguates the typed routing predicate from TransitionContract.guard, the pre-existing human-readable note string on the same record. Pure rename across net-blueprint.ts (type + interpreter), net-compiler.ts (consumer), and topology.test.ts. Descriptor field names (passGuard, satisfiedGuard, ActionDescriptor.guard) keep their domain identifiers. No behavior change; 84 orchestrator tests pass. Co-Authored-By: Claude <noreply@anthropic.com>
The existing per-kind tests computed expected output sets from the same descriptor fields the enumerator consumes, so they'd pass silently if both the topology emitter and the enumerator dropped a branch in lockstep. Add three goldens that pin literal expected place names for slice-1:evaluate, slice-1:run-tests, and slice-1:assess-semantic against the simplePlan fixture. Lockstep drift now surfaces immediately. Retires memory/REFACTOR.md (FE-747 refactor pass complete). Co-Authored-By: Claude <noreply@anthropic.com>
Unknown guard kinds now throw instead of falling through as false, so deserialized or malformed routing data cannot silently misroute tokens. Co-authored-by: Cursor <cursoragent@cursor.com>
eef2f05 to
578e7c9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 578e7c9. Configure here.
| for (const o of h.onPassOutputs) out.add(o.place); | ||
| return out; | ||
| } | ||
| } |
There was a problem hiding this comment.
Missing default throw in enumerateCandidateOutputs switch
Medium Severity
enumerateCandidateOutputs lacks a default throw in its switch on h.kind, unlike the sibling evalRouteGuard function which explicitly throws on unsupported kinds. Since noImplicitReturns is not enabled in tsconfig.json, adding a new HandlerDescriptor variant without updating this function would silently return undefined (typed as Set<string>), causing a confusing runtime crash at the call site instead of a clear fail-fast error.
Reviewed by Cursor Bugbot for commit 578e7c9. Configure here.



Summary
RouteGuardpredicates onHandlerDescriptor(always,reportFieldTruthy).evalRouteGuardandenumerateCandidateOutputsso topology can be analyzed without instantiating handlers or running agents.Context
What changed
RouteGuardonHandlerDescriptorwith shared evaluation on the runtime fire path and the static analyzer.topology.test.ts: twelve tests covering guard evaluation and candidate output enumeration, pinned with literal-fixture goldens.Verification
npm run verifygreen.Out of scope
Traceability
petri-declarative-routinginmemory/PLAN.md; umbrella H-6476.