Repository navigation
Description
Summary
Replace the current "one user DAG + a .Internal()-flagged Fence bolt-on" model with a first-class
partitioning hierarchy:
Engine → Track → DAG → Phase → System
- Track — ordered, tagged (open tag set) container of DAGs. Track order = execution sequence.
- DAG — dependency graph of systems; belongs to exactly one Track (mandatory); declares its own
ordered phases. No public/internal distinction — every DAG is declared/executed the same way. - Phase — DAG-local ordering of systems (no engine-global phase namespace).
Built-in ordered tracks: Engine-Pre (engine tag) → Public → Engine-Post (engine tag).
The Fence becomes a normal DAG in Engine-Post.
Working note: claude/scratch/track-dag-foundations.md.
Motivation
The Fence internal DAG is a bolt-on (InternalScheduleBuilder + SystemBuilder.Internal()). This
surfaces two defects in the Workbench:
RuntimeSchedule.Buildforce-stamps every phase-less system withDefaultPhase— the Fence systems
land in the Render swim-lane (System DAG view).IsInternalnever crosses the wire — the Workbench can't distinguish engine systems from user ones;
the Critical Path view orphans the Fence chain.
Root cause: there is no structural model for multiple DAGs.
Scope
In scope — partitioning + identity + ordering + API exposure:
- W1 Engine model —
Track/DAGtypes;RuntimeScheduledeclaration API; DAG-local phase
resolution; drop.Internal();DagSchedulerdispatches track-by-track in order. - W2 Fence as a normal DAG in Engine-Post; retire
InternalScheduleBuilder/Internal()/
SystemDefinition.IsInternal. - W3 Wire/trace format —
SystemDefinitionRecord.DagId; Tracks + DAGs tables; DAG-scoped
PhaseName;TraceFileHeaderversion bump. - W4 Data API / DTOs —
TopologyDtoexposes tracks → dags → phases → systems; orval regen. - W5 Workbench — System DAG + Critical Path group by Track → DAG → Phase; hide
engine-tagged
tracks by default (toggle to reveal). - W6 Docs —
overview/13-runtime.md, ADR for the hierarchy, affected design docs.
Out of scope (Runtime v2): per-DAG triggers / execution frequency, channels, inter-DAG communication,
resource budgets, failure isolation.
Decisions
- No default-DAG convenience — explicit Track/DAG declaration is mandatory; unit tests + AntHill are
migrated directly. - Terminology supersedes
system-tracks.md§2.1 (Track == DAG→ Track contains DAGs).
Notes
Tracked as an issue for visibility; the work is done on the current branch, not a separate PR.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
nockawa commentedon May 17, 2026
Accepted implementation plan — W1→W3 (W4 descoped)
Implementing via
/implement-feature. Scope reduced to W1, W2, W3; W4 descoped and paired with W5 as a later follow-up (W4 DTOs are tightly coupled to W5 panel consumption — landing W4 alone leaves the Workbench half-migrated). Consequence: the two Workbench bugs in the Motivation section stay unfixed until W4+W5.Key decisions
RunParallelFence), not the in-tick track loop.DagScheduler.DispatchInternalSchedule()→ generalizedDispatchTrack(int). Forced by the Fence's dependency on serialWriteTickFenceprep. Noted deviation from the working note's literal "DagScheduler dispatches track-by-track in order."Phasestruct +Phase.Input/Simulation/Output/Cleanupstatics kept as reusable tokens; onlyRuntimeOptions.Phases/DefaultPhaseglobal resolution removed."AntHill"DAG in the Public track.Workstreams
Track/Dagtypes;RuntimeScheduletrack→DAG declaration API; per-DAG phase resolution + access-edge derivation;SystemDefinition.DagId;DagSchedulertrack-by-track dispatch; dropRuntimeOptions.Phases/DefaultPhase.InternalScheduleBuilder,SystemBuilder.Internal(),SystemDefinition.IsInternal.SystemDefinitionRecord.DagId; Tracks + DAGs trace tables; DAG-scoped phases;TraceFileHeaderv11.Out of scope here: W4 (DTOs/orval), W5 (Workbench panels), W6 (docs/ADR). Work is on branch
feature/354-track-dag-foundations.nockawa commentedon May 17, 2026
W1–W3 implemented — ready for review + commit
Branch
feature/354-track-dag-foundations. Build clean (0 errors, 0 new warnings); 4084 tests pass (3716 engine + 333 Workbench + 35 client), 0 failed.Acceptance criteria — evidence
W1 — Engine model
Track/Dagfirst-class types (Runtime/public/Track.cs,Dag.cs);RuntimeScheduleexposes the 3 built-in tracks +Track.DeclareDag(...). Declaring a DAG is mandatory — system registration exists only onDag.SystemDefinition.DagIdadded;IsInternalremoved; flat global system index preserved.RuntimeSchedule.Buildresolves phases + runsAccessDagDeriverper-DAG; cross-DAG.After()/.Before()edges rejected.RuntimeOptions.Phases/DefaultPhase/DefaultPhasesremoved.DagSchedulerholdsTrack[]→Dag[];DispatchInternalSchedulegeneralized toDispatchTrack(int)+DispatchDeferredTracks(); in-tick loop dispatches Engine-Pre + Public track-by-track with a barrier; single-thread mode walks per-track topo order.UserSystems/SystemCountfilter by engine track tag.RuntimeScheduleTests,DagSchedulerTests,PhaseTests,AccessDagDerivationTests(per-DAG phase resolution, track barrier, mandatory-DAG) — all green.W2 — Fence as a normal DAG
"Fence"DAG on the Engine-Post track via the public API (FenceDagBuilder).InternalScheduleBuilder,SystemBuilder.Internal(),SystemDefinition.IsInternaldeleted; FenceConfiguredrops.Internal().RunParallelFencedispatches Engine-Post viaDispatchDeferredTracks();EnableParallelFence=false⇒ empty Engine-Post + serial fallback.ParallelFenceTests(incl. single-threaded path) — green.W3 — Wire/trace format
SystemDefinitionRecord.DagId; newTrackRecord/DagRecord+ TracksTable/DagsTable sections (replacing the global PhasesTable); DAG-scoped phase names;RuntimeConfigRecorddrops phases;TraceFileHeader→ v11,MinSupportedVersionrejects v10-and-older.Noted deviations (all flagged at plan time or below)
WriteTickFenceprep).DispatchInternalSchedule→DispatchTrack/DispatchDeferredTracks.FenceExecBundle(4-system tuple) retained, moved intoFenceDagBuilder.cs— the plan listed it for deletion alongsideInternalScheduleBuilder; kept as it's a trivial useful struct.RuntimeServiceExtensions.AddDagSchedulerdeleted — dead DI helper (no callers) built on the removed flat-DAG-from-DagBuilderconstruction path.TyphonRuntime.PhaseNames/TyphonBridge.PhaseNamesremoved — vestigial flat phase list, no consumers after W3.Follow-ups
claude/rules/runtime-scheduling.mdPR-01/PR-02 referenceoptions.Phases/options.DefaultPhasein their mechanism text — the invariants still hold, only the wording is stale. Belongs to W6 (docs/ADR), out of this scope.nockawa commentedon May 17, 2026
Accepted implementation plan — W4 + W5(System DAG) + W6
Implementing via
/implement-feature. Scope for this pass:Tracks[] → Dags[] → Phases[]hierarchy;SystemDefinitionDto.DagId; orval regen.engine-tagged tracks by default (toolbar toggle). Critical Path panel is out of scope — Loïc owns that rework.overview/13-runtime.md, new ADR,rules/runtime-scheduling.mdPR-01/02 fix, affected design docs, discard the scratch note.Key decisions
TrackDtonestsDagDto[];Systemsstays a flat top-level array (the flat global system index is load-bearing — predecessor/successorushortrefs, the active-systems bitmask,buildIndexToName).DagDto.Phasesis a bare DAG-localstring[]. Mirrors the trace's three tables 1:1.TopologyDto.Phases/ProfilerMetadataDto.Phasesretained as a derived transitional field so non-W5 panels (DataFlow, AccessMatrix, ExecutionInspector) keep working untouched.criticalPath.tskeeps consuming the retained flatPhasesand is left untouched here.Work continues on branch
feature/354-track-dag-foundations.nockawa commentedon May 17, 2026
W4 + W5(System DAG) + W6 implemented — ready for review + commit
Branch
feature/354-track-dag-foundations. Builds clean (0 errors, 0 new warnings); all suites green — 3716 engine + 334 Workbench + 682 client (Vitest); clienttscclean.Acceptance criteria — evidence
W4 — Data API / DTOs
TrackDto(Name, OrderIndex, Tags, Dags)+DagDto(Id, Name, Phases)inDtos/Profiler/.SystemDefinitionDtogainsDagId;ProfilerMetadataDto+TopologyDtogainTracks(flatPhasesretained as a doc-commented transitional field).TrackHierarchyProjection.Projectbuildstracks[] → dags[]from the trace's Tracks/DAGs tables; wired into bothTraceSessionRuntimeandAttachSessionRuntime;DataController.GetTopologypasses it through.schema/openapi.jsonrefreshed,trackDto.ts/dagDto.tsgenerated,topologyDto.ts+systemDefinitionDto.tsupdated.TopologyAccessDeclarationsTests.Topology_ExposesTrackDagHierarchy— a 3-track / 2-DAG trace round-trips the full hierarchy throughGET /topologywith every system'sDagIdresolving.W5 — Workbench: System DAG panel (Critical Path deliberately untouched — Loïc's scope)
dagModel.tsbucketsTrack → DAG → Phase; lanes ordered track-order → DAG-order → DAG-local phase-order; lanes keyed${dagId}::${phase}(DAG-local phase names can collide).DagModelgainsdagGroupsdelimiter boxes.SystemDagCanvasrenders DAG group boxes (engine groups: dashed amber border +enginebadge);useDagViewStore.showEngineTracks+ aSystemDagToolbar"Show engine tracks" toggle (default off → engine-track systems excluded entirely).dagModel.test.ts— 24 tests (hierarchy bucketing, engine-track filtering, DAG-group emission, track-less fallback). Verified live in the browser via/wb-dev: the AntHill-shaped trace shows the user DAG grouped; toggling reveals the Fence DAG as its ownENGINE-POST / FENCE [engine]group.W6 — Docs
overview/13-runtime.md— scheduling-model section rewritten forEngine → Track → DAG → Phase → System; new ADR 052 (adr/052-track-dag-partitioning-hierarchy.md, indexed inadr/README.md).rules/runtime-scheduling.md— PR-01/PR-02/PR-03 corrected to per-DAG phase resolution (staleoptions.Phases/DefaultPhasetext removed); invariants unchanged.design/Runtime/02-system-scheduling.md,07-system-access-declarations.md,design/Apps/Workbench/Modules/09-system-dag.md;scratch/system-tracks.md§2.1 terminology reconciled. Scratch notescratch/track-dag-foundations.mddeleted.Noted deviations
criticalPath.tsis untouched and keeps consuming the retained flatTopologyDto.Phases.Phasesretained onTopologyDto/ProfilerMetadataDtoas a transitional field so non-W5 panels (DataFlow, AccessMatrix, ExecutionInspector) are not migrated in this pass.with-track-hierarchyvariant was added to the DEBUG/api/fixtures/traceendpoint for the browser/e2e check.Status
W4 + W6 checkboxes ticked. W5 left unchecked and the issue stays open — it also covers the Critical Path panel; the box is ticked once that lands.
nockawa commentedon May 17, 2026
W5 — Critical Path panel: track-aware rework (complete)
The Critical Path half of W5 is done (the System DAG half landed earlier this session). The CP panel did a single global traceback which, because
predecessorsis DAG-local, only ever surfaced the last DAG of the last track (the Fence) — never the app's work. It is now track-aware.Acceptance criteria — evidence
useViewOptionsStore.showEngineSystems)useDagViewStore.showEngineTracksremoved, System DAG migrated. Browser-verified: toggling it updates both panels.DagForm.tsx+ "DAG" category inOptionsPanel. Browser-verified: "DAG & Critical Path" form with the toggle renders.criticalPath.ts— per-track measured traceback (terminus = track-wideargmax endUs); multi-DAG-per-track needs no special handling.criticalPath.test.ts+7 tests.showEngineSystems. Participation + aggregate use the same walk.TickPathBars.trackSpans;CriticalPathViewdraws a single-lane Tracks band between the worker ribbon and the phase band, "All" scope only.CriticalPathToolbartrack<select>("All" + tracks ≥1 DAG, engine-filtered); total = sum of what's shown. Browser-verified: selector showsAll / Public, gainsEngine-Postwhen the engine setting is on.Verification
criticalPath.test.ts38, incl. 7 new track-aware tests; newuseViewOptionsStoretest).tsc+vite buildclean./wb-dev,fixture-trackdagtrace): track selector + Options "DAG" section + cross-panel reactivity verified. The Tracks band / cross-track bars need a trace with measured per-tick data (the topology-only fixture shows the empty state) — covered by the build + unit tests.Docs
design/Apps/Workbench/Modules/09-system-dag.md §5updated to record the track-aware CP (it described only the pre-track global traceback).All of W1–W6 are now complete. Engine-side, app-declarable tracks (
RuntimeSchedule.DeclareTrack) also landed this session as a follow-up — separate from #354's foundations scope.Not committed — handed off for review + commit.
Track→DAG hierarchy (#354) + Critical Path rework + scheduler fixes (#…