Repository navigation
Description
Summary
Remaining "safe" dead-code / dedup / doc cleanups from the multi-agent review. These are low-risk and behavior-preserving but were left out of the stabilization PR because each is a multi-file or test-heavy edit (write-only field removals that thread through dep contracts + ~20 test fixtures, helper extractions into another module, etc.) — not the surgical, single-file changes that batch cleanly. Internal only; no consumer-facing change.
Already done in the stabilization PR (for context): removed dead exports SegmentCacheProvider/CacheConfig/CachedEntryResult/CacheStatus/RouterDependencies/LoaderRevalidationResult/OutletProvider, added missing re-exports (PrerenderPassthroughResult, OriginCheck*), removed the navigation-store singleton test-island, de-duped paramsEqual + observeStreamedHandler.
Backlog
-
RouteMatchResult.optionalParams/TrieMatchResult.optionalParamswritten everywhere, read nowhere. All-or-nothing removal: also dropTrieLeaf.op+ its build insrc/build/route-trie.ts:162-178, and migratepattern-matching.test.tsassertions that readresult.optionalParams. One coordinated commit. -
MiddlewareEntry.mountPrefixis a required write-only field. Assigned atrouter.ts:344+ hardcodednullatmiddleware.ts:700/rsc/helpers.ts:210; read nowhere (scoping folds intofullPatternbefore the entry is built). Make optional/remove; ~20mountPrefix: nulltest-fixture lines to update. -
loaderPromisesparam threaded through revalidation but never read. Forwarded once atrevalidation.ts:1390into a function that ignores it. Removal threads throughRouterContextdep type,segment-wrappers,resolveAllSegmentsWithRevalidation, thesegment-resolution.tscall site, andsegment-resolution-parallel-loading.test.ts. -
middleware-cookies.tsparseCookies/serializeCookieare test-only duplicates of a private byte-for-byte copy inserver/request-context.ts. Have request-context import these (removing its dupes), or delete + drop themiddleware.ts:39re-export + orphaned test blocks. -
src/handles/index.tsbarrel has zero importers. Delete (verifyMetaTagsis reachable elsewhere first — it may only be exported via this barrel) + updatefeature-file-map.md:33. -
MiddlewareCollectableEntryre-export inmiddleware.ts— repointmiddleware.test.ts:14to import from./middleware-types.js, then drop the re-export for a fully-minimal block. - Duplicated
context-vars-non-emptypredicate (keys + symbols) across two prerender entry points — extracthasContextVars(o)next tocontextSetinsrc/context-var.tsand use it in bothprerender-collection.tsand the second site. -
ctx.reverse()fallback increateMiddlewareContext— misleading message ("route map was not provided to middleware context") and(name: string)-only signature, narrower than the public(name, params, search)ScopedReverseFunction. -
Static-handlerResponsenot routed throughhandleHandlerResultinrenderStaticSegment— a Static handler returning aResponseserializes a corrupt artifact instead of failing loudly. Add theif (raw instanceof Response) throwguard (behavior change on a type-forbidden misuse path; add a test). - Docs:
tree-structure.mdinTransitionScopedescription omits that the key predicate also coverserror/notFoundsegment types (defensive); promote the document-cache tag-union timing-gap caveat (document-cache.ts:45-53) to a committed design-doc "Open Problems" entry.
Acceptance
Each item: grep-verified safe, gate green (typecheck / 3650+ unit / lint / format), no public-API change. Batch into one or two commits.
Activity
fix(router): stabilize multi-agent review findings (15 mediums + clea…
fix(router): review follow-ups — #567 dual-mode e2e, #569 pre-1.0 API…
fix(router): matrix-critical review follow-ups — #568 trie-suffix, #569…
ivogt commentedon Jun 14, 2026
All cleanup items resolved (shipped in #573 + #575). Resolution map:
RouteMatchResult.optionalParams/TrieMatchResult.optionalParams/TrieLeaf.op/CompiledPattern.optionalParams— all-or-nothing removal (write-only, read nowhere) — fix(router): matrix-critical review follow-ups — #568 trie-suffix, #569.6 build-seam, #570 cleanups, #567 gaps #575MiddlewareEntry.mountPrefixwrite-only field removed — fix(router): review follow-ups — #567 dual-mode e2e, #569 pre-1.0 API decisions, #570 cleanup #573loaderPromisesdead param removed from the*WithRevalidationpath — fix(router): matrix-critical review follow-ups — #568 trie-suffix, #569.6 build-seam, #570 cleanups, #567 gaps #575middleware-cookies.tstest-only dupes deleted; canonicalized inrequest-context— fix(router): review follow-ups — #567 dual-mode e2e, #569 pre-1.0 API decisions, #570 cleanup #573handles/index.tszero-importer barrel deleted — fix(router): review follow-ups — #567 dual-mode e2e, #569 pre-1.0 API decisions, #570 cleanup #573MiddlewareCollectableEntryre-export dropped — fix(router): review follow-ups — #567 dual-mode e2e, #569 pre-1.0 API decisions, #570 cleanup #573hasContextVars()extracted (context-var.ts) and used in both prerender sites — fix(router): review follow-ups — #567 dual-mode e2e, #569 pre-1.0 API decisions, #570 cleanup #573ctx.reverse()middleware fallback message + signature widened — fix(router): review follow-ups — #567 dual-mode e2e, #569 pre-1.0 API decisions, #570 cleanup #573Static-handlerResponsenow throws a loudTypeError(was a silent corrupt artifact) + test — fix(router): review follow-ups — #567 dual-mode e2e, #569 pre-1.0 API decisions, #570 cleanup #573tree-structure.mdinTransitionScope(error/notFound coverage) updated — fix(router): review follow-ups — #567 dual-mode e2e, #569 pre-1.0 API decisions, #570 cleanup #573. The cited document-cache "timing-gap caveat" was verified a no-op (doesn't exist at the cited lines); the actualprivate, s-maxageshared-store gap it gestured at was fixed separately in fix(router): matrix-critical review follow-ups — #568 trie-suffix, #569.6 build-seam, #570 cleanups, #567 gaps #575 (closed e2e coverage gaps from review: prerender Passthrough+loading(), redirect under loading() #567).Each was grep-verified safe, gate-green, no public-API change. Closing as completed.