Skip to content

Kit: no route around the cards is a result; DI draws the least-overlapping one and reports it - #107

Merged
agorischek merged 4 commits into
mainfrom
review-f13-typed-no-route
Nov 21, 2026
Merged

agorischek merged 4 commits into
mainfrom
review-f13-typed-no-route

Conversation

@agorischek

Copy link
Copy Markdown
Collaborator

From a code review, finding 13: routing failure silently drops every obstacle. The user approved the fix with the least-overlapping-route fallback ("Yup, I agree with your proposal for that one, the least overlapping route").

Evidence

packages/renderers/dependency-injection/src/card.tsx:112-157: the DI renderer promises to route each link around every other card. When the kit router threw, a broad catch immediately reran it with an empty obstacle list. The result could look successful while sending an edge through unrelated cards. Unexpected programming errors took the same fallback path as a geometrically impossible route.

Change

Kit (edge-arrows/box-edge.ts):

  • routeBoxEdge(...) takes boxEdge's arguments and returns a BoxEdge, or a typed BlockedBoxEdge when no route around the cards exists. A blocked result carries least, the candidate that overlaps the obstacles least: fewest cards crossed, then the shortest stretch inside them, chosen from the direct arrow and the arrows from each other side. It also carries crossed, the indices of the cards least crosses.
  • Invalid geometry, such as boxes with non-finite coordinates or negative sizes, throws a RangeError up front, so it can't be mistaken for a blocked route.
  • boxEdge keeps its signature for existing callers and now throws NoRouteError, which carries the blocked result, instead of a bare Error. BoxEdge, BlockedBoxEdge, routeBoxEdge and NoRouteError are exported, and docs/reference/renderer-kit.md is regenerated.

DI (card.tsx):

  • routeLinks uses routeBoxEdge. On a blocked link, the policy is to draw the least-overlapping route and record which cards it crosses (LinkRoute.crossing, as card IDs). It no longer catches anything.
  • LinkView marks every routed link data-projections-route="around", or "crossing" with data-projections-route-crosses.
  • Card-specific port selection is unchanged and stays in DI.

Renderer checks (@githubnext/projections-renderer-testing): a new link-routes check ("Links routed around cards"), with a routes probe call that measures the marks. It runs in the diff and at the end of the animation, fails naming each link drawn across cards and the cards it crosses, and skips renderers that route no links. That makes the degradation visible in the Inspector's checks and the harness, not silent. The README documents it.

Tests

  • Kit test/blocked-routes.test.mjs: a target inside a closed ring of cards is blocked, least crosses only the ring's top, boxEdge throws NoRouteError with it, and a way around is still a plain route. Non-finite boxes throw a RangeError.
  • DI test/blocked-routes.test.mjs: routeLinks gives the obstructed link crossing: ['top'], and once the ring is open on one side it goes around and crosses nothing.
  • Testing helpers.test.mjs: link-routes passes with clear routes, fails naming a crossing link, and skips a renderer that routes none.

Local: those tests, tools check --fast and check:tsdoc. The existing kit and DI route suites need the built engine, and the renderer harness runs link-routes on every scenario, so both run in CI. If a built-in DI scenario does have a blocked link, link-routes will report it there, which is the point.

#81 has merged and #82 doesn't touch these files.

…pping one and reports it

boxEdge threw one Error for impossible geometry and for a link no route
can take around the cards, and the dependency injection renderer caught
both by rerouting with no obstacles, so an edge could run through
unrelated cards looking successful. The kit's routeBoxEdge now returns a
BlockedBoxEdge for a blocked link, with the candidate that overlaps the
cards least (fewest crossed, then the shortest stretch inside them) and
which cards it crosses; boxes with non-finite coordinates throw a
RangeError, and boxEdge throws NoRouteError for a blocked link. DI draws
the least-overlapping route, marks it data-projections-route=crossing
with the cards it crosses, and the new link-routes renderer check
reports it.

Code review, finding 13.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot stopped reviewing on behalf of agorischek due to an error November 20, 2026 22:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note

Copilot was unable to run its full agentic suite in this review.

Copilot review overview

5 open issues
What changed in this PR

Adds a new renderer QA check for link routing (“link-routes”), including DOM measurement plumbing and renderer-kit support for reporting “blocked” routes when no path can avoid cards.

Changes:

  • Introduces a new routes probe call + linkRoutes DOM measurement and a new link-routes frame check.
  • Extends renderer-kit edge routing with routeBoxEdge, NoRouteError, and BlockedBoxEdge to expose “no clear route” details.
  • Updates the dependency-injection renderer to annotate routed links in the DOM (data-projections-route*) and adds tests/docs.
File Description
packages/​renderers/​testing/​test/​helpers.test.mjs Updates check count and adds coverage for the new link-routes check behavior.
packages/​renderers/​testing/​src/​types.ts Adds routes probe call, RouteMeasurement, and link-routes to CheckId.
packages/​renderers/​testing/​src/​probe.ts Wires the routes probe call to the new linkRoutes() measurement.
packages/​renderers/​testing/​src/​measure/​routes.ts Implements DOM measurement for routed links and crossings.
packages/​renderers/​testing/​src/​measure.ts Exports linkRoutes from the measurement barrel.
packages/​renderers/​testing/​src/​checks/​frame/​routes.ts Implements the link-routes check logic (fail on crossings, skip if none).
packages/​renderers/​testing/​src/​checks/​frame.ts Registers link-routes as a built-in frame check.
packages/​renderers/​testing/​src/​checks/​catalog.ts Adds title/description strings for link-routes.
packages/​renderers/​testing/​README.md Documents the new link-routes check contract.
packages/​renderers/​kit/​test/​blocked-routes.test.mjs Adds tests for “no clear route” behavior and error semantics.
packages/​renderers/​kit/​src/​index.ts Exports new route primitives/types (routeBoxEdge, NoRouteError, etc.).
packages/​renderers/​kit/​src/​edge-arrows/​box-edge.ts Adds routeBoxEdge API + blocked-route selection and new error types.
packages/​renderers/​dependency-injection/​test/​blocked-routes.test.mjs Adds renderer-level test verifying crossing annotation behavior.
packages/​renderers/​dependency-injection/​src/​card.tsx Switches to routeBoxEdge, annotates crossings in DOM attributes, and exposes LinkRoute.
docs/​reference/​renderer-kit.md Documents new types/APIs (BoxEdge, BlockedBoxEdge, NoRouteError, routeBoxEdge) and updates boxEdge signature.

Review effort: Lite

agorischek and others added 2 commits November 20, 2026 15:05
… that can't measure them

The least-overlapping candidates are sampled at a named spacing (overlapSpacing, 2 px along the curve) and the contact
loops no longer shadow the target box. link-routes skips, with a reason, when the probe returns no routes measurement.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@agorischek
agorischek merged commit 5f269a7 into main Nov 21, 2026
82 of 84 checks passed
@agorischek
agorischek deleted the review-f13-typed-no-route branch November 21, 2026 04:22
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