Skip to content

FE-747: Declarative output routing for branching transitions#154

Merged
kostandinang merged 8 commits into
mainfrom
ka/fe-747-petri-declarative-routing
Jun 2, 2026
Merged

FE-747: Declarative output routing for branching transitions#154
kostandinang merged 8 commits into
mainfrom
ka/fe-747-petri-declarative-routing

Conversation

@kostandinang
Copy link
Copy Markdown
Contributor

@kostandinang kostandinang commented May 25, 2026

Summary

  • Replaces inline report-field branching inside transition fire closures with declarative RouteGuard predicates on HandlerDescriptor (always, reportFieldTruthy).
  • Exposes evalRouteGuard and enumerateCandidateOutputs so topology can be analyzed without instantiating handlers or running agents.
  • Records analyzable output arcs as SPEC invariant I125-K, separating “what the net could do” from closure-only behavior.

Context

  • FE-745 made epic verification correct under parallel slice sandboxes. Phase 3/4 goals (reachability, deadlock simulation, stale-graph routing) need routing rules on arcs, not logic hidden inside fire implementations.
  • This change is intentionally usable without FE-700 graph UI: it makes guards data the compiler and tests can read today.
  • Halt paths and some token transforms remain in closures; I125-K documents what is declarative now vs follow-on work.

What changed

  • RouteGuard on HandlerDescriptor with 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.
  • Fail-fast when an unsupported guard kind is encountered at runtime, avoiding silent mis-routing during cook.

Verification

  • Existing engine contract suite behavior preserved; new topology module tests added.
  • npm run verify green.

Out of scope

  • Moving halt paths and token transforms fully onto declarative guards (tracked as follow-ons under I125-K).
  • End-to-end stale-graph routing wired through FE-700 graph compilation.

Traceability

  • Requirements 46–48; decision D155-K; invariant I125-K; frontier petri-declarative-routing in memory/PLAN.md; umbrella H-6476.

@kostandinang kostandinang changed the title FE-747: Add petri-declarative-routing frontier to plan. FE-747: Declarative output arcs — topology-level routing for branching transitions May 25, 2026
@kostandinang kostandinang marked this pull request as ready for review May 26, 2026 07:52
@cursor
Copy link
Copy Markdown

cursor Bot commented May 26, 2026

PR Summary

Low Risk
Refactor preserves engine contract behavior with new topology tests; routing logic is centralized and fail-fast on unknown guard kinds, with no auth or persistence changes.

Overview
FE-747 moves Petri branching from inline fire-closure logic onto declarative RouteGuard data on HandlerDescriptor, with shared evalRouteGuard at runtime and a pure enumerateCandidateOutputs for static topology analysis.

Orchestrator: routeField / ad hoc payload checks in net-compiler.ts are replaced by guard, passGuard, and satisfiedGuard (always, reportFieldTruthy). topology.test.ts pins guard evaluation and output enumeration (including goldens). memory/SPEC.md adds invariant I125-K; memory/PLAN.md marks petri-declarative-routing done and updates Phase 3/4 sequencing. Halt paths and token transforms stay in closures (explicitly out of I125-K).

Reviewed by Cursor Bugbot for commit f706b1e. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/orchestrator/src/net-blueprint.ts
@kostandinang kostandinang changed the base branch from ka/fe-745-petri-epic-verification-merge to graphite-base/154 May 26, 2026 08:21
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch from f9de408 to ee16289 Compare May 26, 2026 17:03
@kostandinang kostandinang changed the base branch from graphite-base/154 to ka/fe-745-petri-epic-verification-merge May 26, 2026 17:03
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch from ee16289 to eef2f05 Compare May 27, 2026 20:44
@kostandinang kostandinang changed the title FE-747: Declarative output arcs — topology-level routing for branching transitions FE-747: Declarative output routing for branching transitions May 27, 2026
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch from eef2f05 to 578e7c9 Compare May 27, 2026 21:16
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

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

Comment thread src/orchestrator/src/net-blueprint.ts
@kostandinang kostandinang force-pushed the ka/fe-745-petri-epic-verification-merge branch from b5c8c77 to 9ea1a4d Compare May 27, 2026 23:16
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch from 578e7c9 to 921cb17 Compare May 27, 2026 23:16
@kostandinang kostandinang force-pushed the ka/fe-745-petri-epic-verification-merge branch from 9ea1a4d to 78bf6ee Compare May 27, 2026 23:21
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch from 921cb17 to 2047ef2 Compare May 27, 2026 23:21
@kostandinang kostandinang force-pushed the ka/fe-745-petri-epic-verification-merge branch from 78bf6ee to 98729e9 Compare May 28, 2026 10:34
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch 2 times, most recently from 525fd4d to 89a128a Compare May 28, 2026 10:52
@kostandinang kostandinang force-pushed the ka/fe-745-petri-epic-verification-merge branch from 7cc596c to b8a1514 Compare May 28, 2026 12:59
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch from 89a128a to 00aae52 Compare May 28, 2026 12:59
@kostandinang kostandinang force-pushed the ka/fe-745-petri-epic-verification-merge branch from b8a1514 to 72abdb1 Compare May 29, 2026 12:27
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch 2 times, most recently from c9db96d to c63d2e1 Compare June 2, 2026 08:11
@kostandinang kostandinang force-pushed the ka/fe-745-petri-epic-verification-merge branch 2 times, most recently from 9ee7f6d to 7d2e69b Compare June 2, 2026 09:56
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch from c63d2e1 to 1908d8f Compare June 2, 2026 09:56
@kostandinang kostandinang changed the base branch from ka/fe-745-petri-epic-verification-merge to graphite-base/154 June 2, 2026 11:37
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch from 1908d8f to 46081c4 Compare June 2, 2026 11:38
@kostandinang kostandinang changed the base branch from graphite-base/154 to ka/fe-745-petri-epic-verification-merge June 2, 2026 11:38
Base automatically changed from ka/fe-745-petri-epic-verification-merge to main June 2, 2026 12:35
@kostandinang kostandinang dismissed lunelson’s stale review June 2, 2026 12:35

The base branch was changed.

kostandinang and others added 8 commits June 2, 2026 14:36
Per-slice test-agent/code-agent places were replaced by shared pool:*
places in FE-743; pool places are already excluded by the pool: prefix check.
Co-authored-by: Cursor <cursoragent@cursor.com>
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>
Co-authored-by: Cursor <cursoragent@cursor.com>
@kostandinang kostandinang force-pushed the ka/fe-747-petri-declarative-routing branch from 46081c4 to f706b1e Compare June 2, 2026 12:38
@kostandinang kostandinang requested a review from lunelson June 2, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants