(7/7) Add route replay miss coverage for incomplete router data#93648
Conversation
Failing test suitesCommit: e72f4b4 | About building and testing Next.js
Expand output● offlineNavigations build artifacts › reconstructs a fully prefetched route from persisted router records ● offlineNavigations build artifacts › replays a dynamic route from persisted known route patterns ● offlineNavigations build artifacts › replays request-sensitive exact URLs from browser-private storage ● offlineNavigations build artifacts › covers exact URL shape and pass-through stress cases
Expand output● offlineNavigations build artifacts › reconstructs a fully prefetched route from persisted router records ● offlineNavigations build artifacts › replays a dynamic route from persisted known route patterns ● offlineNavigations build artifacts › replays request-sensitive exact URLs from browser-private storage ● offlineNavigations build artifacts › covers exact URL shape and pass-through stress cases |
50d10ce to
8c40fef
Compare
1ff84b6 to
febc878
Compare
8c40fef to
eaa8ac0
Compare
Stack position
This is PR 7/7 in the first
offlineNavigationsclient-router persistence stack.It sits after #93647, which teaches the client to replay a dynamic route from the persisted known-route table when the exact target URL entry is absent. This PR is intentionally test-only: it makes the new replay path prove that incomplete persisted router-cache data turns into a visible offline miss instead of a partial or stale render.
The stack is still behind
experimental.offlineNavigations, which requires Cache Components and implies the existing offline surface. The service worker continues to own document survival only; the cache-components client router owns persisted route/segment/head data, route matching, and replay eligibility.Why this exists
Dynamic route replay is the riskiest part of the first client-side stack because the route table can know that
/dynamic-prefetch/[value]is replayable even when a specific target URL has never had an exact URL record. That is useful, but only if replay refuses to continue when one of the router-cache records needed to reconstruct the target tree is missing.This test covers that boundary directly. It creates the successful PR6 setup, deletes the required target page segment record from IndexedDB, then verifies the offline hard load misses with the expected diagnostics and user-visible fallback.
What changed
segment-datarecords from the offline navigation IndexedDB database.router-cache-reconstruction-misswithmissing-segmentNot included
This PR does not add new runtime behavior. It also does not cover the later production-hardening matrix for middleware, rewrites, redirects, interception, optional/catch-all routes, app/session invalidation, or storage quotas. Those belong in the next stack because they need their own fixtures and policy decisions.
Reviewer focus
Verification
NEXT_SKIP_ISOLATE=1 pnpm test-start-turbo test/production/app-dir/offline-navigations/offline-navigations.test.ts -t "misses dynamic route pattern replay when a required segment record is missing"NEXT_SKIP_ISOLATE=1 pnpm test-start-turbo test/production/app-dir/offline-navigations/offline-navigations.test.tspnpm --filter=next buildpnpm test-start-turbo test/production/app-dir/offline-navigations/offline-navigations.test.ts -t "misses dynamic route pattern replay when a required segment record is missing"pnpm test-start-webpack test/production/app-dir/offline-navigations/offline-navigations.test.ts -t "misses dynamic route pattern replay when a required segment record is missing"git diff --check