mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1053] [MERGED] test(app-router): lock navigation lifecycle settlement and root-layout hard navigation behaviour #1052
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#1052
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/1053
Author: @NathanDrake2406
Created: 5/4/2026
Status: ✅ Merged
Merged: 5/5/2026
Merged by: @james-elicx
Base:
main← Head:test/lock-lifecycle-settlement📝 Commits (6)
10a9406test(app-router): lock navigation lifecycle settlement and root-layout hard navigation behaviourb7a516etest: remove hallucinatory comments from app-browser-entry tests982ccdetest: remove duplicate shouldHardNavigate null-root assertionf37ec9etest: remove low-signal helper truth-table tests, fix hard-navigate ordering assertiona8c3703Merge remote-tracking branch 'origin/main' into pr-1053986f5f9fix(test): add missing operationLane field to new lifecycle settlement tests📊 Changes
1 file changed (+336 additions, -0 deletions)
View changed files
📝
tests/app-browser-entry.test.ts(+336 -0)📄 Description
Summary
Adds 6 unit tests locking two Wave 0 baseline areas from the #726 router kernel architecture — in preparation for the Layer 1 lifecycle spine migration.
Lifecycle settlement (4 tests)
The App Router uses a completely different lifecycle mechanism from the Pages Router (
activeNavigationIdcounter + promise-based commit gate vsAbortController-based cancellation). The Pages Router has 10 proven race-condition tests inshims.test.ts. The App Router had zero equivalent unit tests for these controller-level concurrency semantics.window.location.assignresolveAndClassifyNavigationCommitskip classificationRoot-layout hard navigation (2 tests)
renderNavigationPayloadcallswindow.location.assignon cross-rootwindow.location.assignfires (asserted viaassign.mockImplementation)Why this matters for #726
The architecture's Implementation Plan says Layer 0 is "freeze today's flat-wire behavior with compatibility tests." These tests are the lifecycle-settlement and root-layout halves of that layer. Without them, the "delete the old writer" steps in Layers 4–5 have no regression safety net for the concurrency semantics that are hardest to verify by code review alone.
Design decisions
setTimeout, novi.advanceTimersByTime. Zero flake surface.renderNavigationPayloadreturns. The returned promise resolves only whenNavigationCommitSignalmounts in a React tree, which never happens in unit tests. Tests verify state throughstateRef.currentafter yielding microticks — same pattern as the existing "uses render ids independent from navigation ids" test.stateRef.current.routeId(user-visible state),window.location.assigncalls (browser effect), andcreateNavigationCommitEffectinvocation (side-effect gating). They don't assert on internal Map sizes or reducer shape.createControllerHarness,createState,createResolvedElements,stubWindowhelpers. Samevi.spyOn/mockRestore/detach()cleanup pattern. Sits in the same describe/file as the existing controller tests.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.