Skip to content

refactor(router): isolate navigation resolution and root publication - #766

Merged
smiggleworth merged 1 commit into
developfrom
refactor/050-navigation-ownership
Oct 9, 2026
Merged

smiggleworth merged 1 commit into
developfrom
refactor/050-navigation-ownership

Conversation

@smiggleworth

Copy link
Copy Markdown
Contributor

Navigation target resolution and root publication now live in separate private modules. navigation-request.ts owns the single request ID/controller pair; navigation-targets.ts retains redirect, unmatched, push/replace and popstate policy. Public navigation signatures and existing commit/rollback behavior remain unchanged.

Five original-source failures are fixed: abort reentry could borrow a newer request ID, overwrite its controller or lose cancellation ownership; push navigation overwrote the listener's destination, and popstate started the newest loader twice. Starting/tearing down a request now installs or clears ownership before invoking predecessor abort listeners. Entry points stop superseded work immediately after request creation.

Seventeen of nineteen original coordinator function bodies are unchanged. Direct seam tests resolve loaded/denied roots without publication, then apply the complete target set; late metadata cannot change nodes, title, URL or history after a newer commit. Two architecture tests enforce resolution/commit direction, and the existing single-controller guard now identifies its new owner.

Validation on Node 24.21.0:

  • Three unit and two push/popstate original-source regression cases fail before the fix and pass after it; non-reentrant cancellation, metadata and two-root seam characterizations pass.
  • npm run check passes 452 unit, 98 repository, 2,699 jsdom, 158 browser and 12 installed type cases, plus lint/types/build/publint/package artifacts. The strengthened exact-once loader assertion is additionally verified against original and final source; final formatting, lint/types and focused router checks pass.
  • Three alternating sibling-route navigation captures: before 0.073084/0.083840/0.083630 ms; after 0.082795/0.081459/0.082058 ms, 7,157–8,210 samples, median difference -1.9%. All benchmark assertions pass; these are observations rather than a general speedup claim.

The full run exposed a pre-existing warning-count fixture that included timing warnings. A deterministic 10 ms clock reproduces five warnings instead of the expected one. The fixture now restores/disables slow-render diagnostics around its item-shadow assertions, matching the existing URL-warning fixture; the forced-clock reproducer and full suite pass. Runtime timing diagnostics are unchanged.

Ownership, the router architecture guide, changelog and 0.5.0 delivery evidence are updated. Versions remain unchanged.

Closes #742.

@smiggleworth
smiggleworth merged commit d028846 into develop Oct 9, 2026
4 checks passed
@smiggleworth
smiggleworth deleted the refactor/050-navigation-ownership branch October 9, 2026 17:51
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.

refactor(router): isolate navigation resolution from root and history commits

1 participant