Skip to content

feat(core): route edges in the multi-system root view - #2369

Merged
kompiro merged 2 commits into
mainfrom
feat/routing-multi-system-root
Aug 7, 2026
Merged

kompiro merged 2 commits into
mainfrom
feat/routing-multi-system-root

Conversation

@kompiro

@kompiro kompiro commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Purpose

Closes #2363 — slice B of #2330. Stack 3/4, builds on #2368.

Summary

The root view ran none of the routing passes: no port distribution, no orthogonal routing, no lane separation, no crossing marks. Cross-system edges were raw straight lines, and even a grouped root got bands and frames with every edge drawn straight through whatever lay between its endpoints.

Changes

  • Wire the shared chain into layoutMultipleSystems: distributePorts → chain → trunks (grouped) → gutter lanes → port fan-out → channel lanes.
  • Scoped per system. Obstacles, content bounds and gutter x are all derived from the nodes handed in, so routing the whole canvas at once would send an edge inside one system out past every other one. Each system block is its own routing surface — the same scoping placeExternalServicesOnSides already uses.
  • computeCrossingMarks over all edges, so a cross-system line crossing an intra-system one is marked too.
  • Advance offsetX by the routed extent rather than the container rect, since a gutter route reaches past the cards. The baseline stays offsetX + width and not containerRect.x + width: a left side column (System view edge readability: reduce crossings in single-source fan-out (ports / trunking / orthogonal) #1728) shifts the rect's own x leftwards, and measuring from it hands the next system less room than before — caught by the existing #1728 fix #2 overlap test.

Preview URL

Scope filter (new-feature PRs only)

  • N/A — not a new-feature PR (brings an existing capability to a surface that lacked it)

Dependency & license impact

  • N/A — no production dependency added or bumped across a major version

Manual Verification Checklist

  • Open a multi-system model at the root level and confirm edges route around cards instead of through them
  • Confirm system blocks still sit side by side without overlapping

TPL impact

Disposition: Designed against TPL-1983 (the same view state must behave the same across surfaces) — the root view now reaches the marks layer at all, asserted by emits crossing marks, which the root view never did before. TPL-1927's dual metric is applied to the root view directly, and a new test pins that each system routes against its own bounds rather than the whole canvas, so the per-system scoping cannot regress into a canvas-wide gutter.

Related Docs

  • ADR-1728 (the cross-system side-map limitation this PR does not change)

🤖 Generated with Claude Code

@kompiro
kompiro force-pushed the feat/routing-multi-system-root branch from e4ce2f9 to 618a0f0 Compare August 5, 2026 23:10
@kompiro
kompiro force-pushed the feat/routing-shorter-detours branch from ed231f5 to 92f6964 Compare August 5, 2026 23:10
@kompiro
kompiro force-pushed the feat/routing-shorter-detours branch from 92f6964 to e60ed74 Compare August 7, 2026 13:23
@kompiro
kompiro force-pushed the feat/routing-multi-system-root branch from 618a0f0 to b745c62 Compare August 7, 2026 13:23
@kompiro
kompiro force-pushed the feat/routing-shorter-detours branch from e60ed74 to 888ca37 Compare August 7, 2026 13:31
@kompiro
kompiro force-pushed the feat/routing-multi-system-root branch from b745c62 to 1a212ee Compare August 7, 2026 13:31
Base automatically changed from feat/routing-shorter-detours to main August 7, 2026 13:48
@kompiro
kompiro force-pushed the feat/routing-multi-system-root branch from 1a212ee to d7156e8 Compare August 7, 2026 13:48
@kompiro
kompiro force-pushed the feat/routing-multi-system-root branch from d7156e8 to 4b3845a Compare August 7, 2026 13:50
kompiro and others added 2 commits August 7, 2026 13:55
The root view ran none of the routing passes: no port distribution, no
orthogonal routing, no lane separation, no crossing marks. Cross-system edges
were raw straight lines, and even a *grouped* root got bands and frames with
every edge drawn straight through whatever lay between its endpoints.

Wire the shared chain into `layoutMultipleSystems`, scoped per system. Obstacles,
content bounds and gutter x are all derived from the nodes handed in, so routing
the whole canvas at once would send an edge inside one system out past every
other one. Each system block is its own routing surface -- the same scoping
`placeExternalServicesOnSides` already uses.

Crossing marks are computed over all edges, so a cross-system line crossing an
intra-system one is marked too.

Advance `offsetX` by the routed extent rather than the container rect, since a
gutter route reaches past the cards. The baseline stays `offsetX + width` and
not `containerRect.x + width`: a left side column (#1728) shifts the rect's own
x leftwards, and measuring from it would let two containers overlap.

Closes #2363

Co-Authored-By: Claude Fable 5 <[email protected]>
The root-view fences ran against an inline two-system string. A fence that only
covers a hand-built fixture misses what users actually draw (the #1954 lesson),
and there was no bundled sample with two systems at all: multi-file-system is
one system split across files, and 07-cross-system teaches cross-system
references with three adjacent-tier nodes per system, so its straight lines
never cross anything and it would assert zero for free.

Add feature-samples/multi-system-root.krs — two systems in one file, each with
an actor that skips the client tier so its straight line crosses the client
card between the endpoints. Measured: 3 penetrations drawn straight, 0 once
routed, 2 edges taking waypoints.

Point the root-view fences at it and add the missing probe that the model
exercises the router at all, so 'penetration == 0' cannot pass for free here
either.

Refs #2363

Co-Authored-By: Claude Fable 5 <[email protected]>
@kompiro
kompiro force-pushed the feat/routing-multi-system-root branch from 4b3845a to 812a7ea Compare August 7, 2026 13:56
@kompiro
kompiro enabled auto-merge (squash) August 7, 2026 14:01
@kompiro
kompiro merged commit 54819f4 into main Aug 7, 2026
11 checks passed
@kompiro
kompiro deleted the feat/routing-multi-system-root branch August 7, 2026 14:04
kompiro added a commit that referenced this pull request Sep 10, 2026
…2761)

Review asked whether an edgeless multi-system root should return no marks,
the way the single-system empty view does. It should keep what it has: the
multi-system path has produced an empty marks object since #2369, and this
refactor preserves that. Both empty cases are now asserted so the pair is
machine-checked rather than argued.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
kompiro added a commit that referenced this pull request Sep 10, 2026
…2761) (#2778)

* refactor(core): compute crossing marks once, on the final placement (#2761)

Crossing marks are a pure function of the routed edges and feed nothing
before the render: `computeTotalDimensions` and the channel reservation
never read them. `layoutInner` still computed them on every width-budget
candidate and again on the reservation pass, so a dense view paid for the
pass five or six times per drawing. `layout()` now computes them once on
the run that survives. Output is unchanged; the empty-view path keeps
`crossingMarks` undefined as before.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* test(core): pin the multi-system root's empty crossing-mark object (#2761)

Review asked whether an edgeless multi-system root should return no marks,
the way the single-system empty view does. It should keep what it has: the
multi-system path has produced an empty marks object since #2369, and this
refactor preserves that. Both empty cases are now asserted so the pair is
machine-checked rather than argued.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>

This branch was successfully deployed

1 active deployment
preview — 812a7ea2 Deployed Aug 7, 2026 by github-actions[bot]
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.

Wire the shared routing passes into the multi-system root view (slice B)

1 participant