Repository navigation
feat(core): route every mode through one shared candidate chain - #2367
Merged
Merged
Conversation
2 of 3 tasks
2 of 3 tasks
kompiro
force-pushed
the
feat/routing-composed-chain
branch
from
August 7, 2026 13:23
5e8b1f5 to
8de2bd1
Compare
Replace the `if (groupBands)` routing fork with a priority chain that runs in grouped and ungrouped mode alike: straight (left alone when clear) -> interior channel-L -> side gutter / mixed channel. Both router modules stay; the grouping axis and routing capability are independent axes, so composing them lets an ungrouped canvas gain gutter routing without a second implementation. `routeOrthogonalEdges` now takes an external obstacle provider so group frames block the interior L with the same per-endpoint exemption the gutter router uses. Gutter lanes and 4-side port fan-out run in both modes so every route shape the chain can produce takes part in the overlap passes (TPL-1954). `groupBackward` dashing stays band-gated and trunk aggregation stays grouped-only. Add `routing-parity.test.ts`: the ungrouped view had no measured fence at all, which is why removing the gate changed real diagrams without a single test failing. It asserts the TPL-1927 dual metric over the bundled examples -- penetration 0, collinear overlap 0, every crossing hop-marked -- and pins the grouped numbers so an ungrouped win cannot mask a grouped regression. Measured over 12 examples / 18 layouts: ungrouped penetrations 10 -> 0, grouped metrics identical, ungrouped crossings 17 -> 30 (all hop-marked). Supersedes the AC-5 byte-identity decision in ADR-1859; the ADR lands with the last slice of #2330. Closes #2362 Co-Authored-By: Claude Fable 5 <[email protected]>
Routing an ungrouped edge turns it from a <line> into a <polyline>, and
at-0006 read the painted stroke with querySelectorAll("line, path"). The
polyline matched neither, so the query returned nothing and the empty string
read as "not dashed" -- while the product was emitting the correct
stroke-dasharray="8 4" all along.
at-0058 enumerates shapes the same way for a *negative* assertion (no diff
colour anywhere), where omitting a shape passes for the wrong reason instead of
failing. Both now list line, polyline and path.
Record the instance on TPL-1954: its lesson -- a new route shape must not fall
outside what consumes it -- applies to assertions as much as to the router's
downstream passes, and negative assertions deserve priority because they go
quiet rather than red.
Refs #2362
Co-Authored-By: Claude Fable 5 <[email protected]>
kompiro
force-pushed
the
feat/routing-composed-chain
branch
from
August 7, 2026 13:31
8de2bd1 to
9a9173a
Compare
This was referenced Aug 15, 2026
Closed
kompiro
added a commit
that referenced
this pull request
Aug 16, 2026
…lution (#2517) * refactor(core): extract the shared routing chain into runRoutingChain The 7-step routing candidate chain (ports -> channel-L -> gutter/mixed -> trunks -> gutter lanes -> fan-out -> channel lanes -> outline seating) was duplicated between layoutInner and layoutMultipleSystems — the surface where TPL-219 parity drift already bit twice (#2363 gave the root view no routing at all; #2367 unified the chain order). The argument mapping between the two sites is a complete injection: the multi path is the same chain with expandedFrames and ports undefined, so the shared function reproduces both byte-identically by construction. Also folds the single path's duplicate portResolver(options) call into one resolution — the resolver is a stateless closure over options, so building it once is behaviorally identical. Refs #2512 * refactor(core): extract canvasMembershipFor and resolveCanvasAxis The membership resolution (scoped boundary axis -> diff cut, #2036/#2176) and the placement-axis/group-index derivation were mirrored between layoutInner (ancestors+container scope path) and layoutMultipleSystems (per-system [systemId] scope path). Extract both into shared helpers; the scope path stays a parameter and the 'is grouping on?' gates stay at the call sites — the single path gates on a truthy index while the multi path also requires size > 0, and that truthiness difference is live behavior. Refs #2512 * test(core): fence the single-pipeline dual metric on the multi-root sample TPL-219 cross-family fence for #2512: the Shop system from multi-system-root.krs, rendered through the single-system pipeline, must clear the same penetration/overlap contract the #2363 describe pins for the multi-system surface. The two pipelines place the same content differently (#2514), so router firing is pinned only where the placement provably pierces (the multi surface); the chain contract is fenced on both. Refs #2512 * style(core): apply oxfmt to the runRoutingChain call site Refs #2512 * refactor(core): review fixes — unify axis gates, harden runRoutingChain opts Code-review findings on this PR's diff: - resolveCanvasAxis: normalize an empty axis to undefined and return the bandOrder (with its declaredGroupOrder fallback) so both pipelines gate identically on 'groupBy && groupIndex' and cannot drift on the fallback. The multi path's extra size > 0 gate encoded no live behavior: entering the collapse machinery with an empty index folds nothing and the band assignment's own size guard blocks, so outputs were already equal. - runRoutingChain: every capability is now a required field (explicit undefined at the call site that lacks it), and the helper takes the band stack itself (Map | null) and derives 'grouped' internally — adding a capability now produces a compile error at every caller, and the meaning of grouped lives in one place. - Reattach portResolver's JSDoc, which the runRoutingChain insertion had stranded ~100 lines above its function. - Inline the single-use membershipForSystem alias and move the scopePath/canvasMembership computation below the multi-system dispatch, which discarded it. - Drop the new cross-pipeline describe from routing-parity.test.ts: probing showed the Shop-alone rendition never fires the router (0 waypoints), so its zero assertions could not observe any call-site drift. The single path's chain arguments are already fenced by the UNGROUPED_MODELS suite (12 models, firing pinned on PREVIOUSLY_PIERCED) and the multi path by the #2363 describe. All 3691 core tests green; 168/168 example SVGs byte-identical vs main. Refs #2512
This branch was successfully deployed
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.
Purpose
Closes #2362 — slice A of #2330. Stack 1/4.
Summary
Replaces the
if (groupBands)routing fork with one priority chain that runs in grouped and ungrouped mode alike, and — the substance of this slice — gives ungrouped routing a measured fence for the first time.Changes
straight → interior channel-L → side gutter / mixed channel. Each pass skips edges a previous one routed or that need no routing, so the cheapest clear candidate wins. Both router modules stay: the grouping axis and routing capability are independent axes, so composing them lets an ungrouped canvas gain gutter routing without a second implementation.routeOrthogonalEdgestakes an external obstacle provider, so group frames block the interior L with the same per-endpoint exemption the gutter router uses.groupBackwarddashing stays band-gated; trunk aggregation stays grouped-only (evaluated in Evaluate aggregation trunks for the ungrouped canvas (slice C) #2364).routing-parity.test.ts. Asserts the TPL-1927 dual metric over the bundled examples — penetration 0, collinear overlap 0, every crossing hop-marked — plus a probe that the router actually fired on the models that used to leak, and pinned grouped crossing counts so an ungrouped win cannot mask a grouped regression.Measured
12 examples / 18 layouts: ungrouped penetrations 10 → 0; grouped metrics identical on all four grouped layouts; ungrouped crossings 17 → 30, all hop-marked; collinear overlap 0 → 0.
Notably no existing test failed when the gate came out. ADR-1859's AC-5 was a structural guarantee, not a measured one — which is exactly why this slice's real deliverable is the fence, not the churn absorption. Only three committed guide SVGs changed.
Preview URL
Scope filter (new-feature PRs only)
Dependency & license impact
Manual Verification Checklist
TPL impact
Related Docs
🤖 Generated with Claude Code