mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 00:09:23 +02:00
[PR #1101] feat(app-router): trace approved visible commit outcomes #1097
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#1097
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/1101
Author: @NathanDrake2406
Created: 5/6/2026
Status: 🔄 Open
Base:
main← Head:nathan/726-ops-trace-invariants📝 Commits (1)
9ae01befeat(app-router): trace approved visible commit outcomes📊 Changes
4 files changed (+362 additions, -196 deletions)
View changed files
📝
packages/vinext/src/server/app-browser-state.ts(+1 -82)📝
packages/vinext/src/server/app-browser-visible-commit.ts(+156 -9)📝
packages/vinext/src/server/navigation-trace.ts(+32 -3)📝
tests/app-browser-entry.test.ts(+173 -102)📄 Description
What this changes
Implements
#726-OPS-02/03from #726: visible commit invariants and transaction trace codes.This PR makes the approved visible commit path the only exported way to mutate browser-visible App Router state. The previous raw reducer export is no longer available, and the single
visibleCommitVersionincrement now lives inside theApprovedVisibleCommitboundary.It also adds transaction-level navigation trace codes for the three approval outcomes:
NT_VISIBLE_COMMITNT_NO_COMMITNT_HARD_NAVIGATEThose transaction entries are prepended to the existing reason entries such as
NC_COMMIT,NC_STALE,NC_ROOT, andNC_ROOT_UNKNOWN, so operators can see both what happened and why.Bonk: please read issue #726 to see the big picture behind this slice before reviewing the local mechanics.
Why
Issue #726 is building toward a lifecycle model where visible state mutation, stale result rejection, hard navigation fallback, and future cache or skip decisions have observable authority boundaries. Without an explicit transaction outcome in the trace,
noCommit, visible commit, and hard navigation paths are harder to audit. Without fencing the raw reducer export, future code can accidentally bypass the approved commit boundary.Approach
The browser state module still owns pending operation creation, route compatibility decisions, and reason traces. The visible commit module now owns the actual visible state reducer and the one place where
visibleCommitVersionadvances.Approval now wraps every decision trace with a transaction entry carrying the operation lane, pending operation id, and started visible commit version. Current behavior for navigate, replace, traverse, HMR recovery, stale commits, unknown-root soft fallback, and root-boundary hard navigation is preserved.
Validation
vp test run tests/app-browser-entry.test.tspasses: 66 testsvp check tests/app-browser-entry.test.ts packages/vinext/src/server/app-browser-visible-commit.ts packages/vinext/src/server/app-browser-state.ts packages/vinext/src/server/navigation-trace.tspasses with no warnings, lint errors, or type errorsvp run vinext#buildpasses, with the repo's existing virtual/external unresolved import warnings during packvp checkexits 0 across the repo, with one pre-existing warning inpackages/vinext/src/server/request-pipeline.ts:604Risks / follow-ups
This intentionally does not add broad runtime logging, cache metrics, skip metrics, stale same-URL server-action rejection, or planner behavior. It is scoped to the visible commit invariant and approval-path trace codes requested by
#726-OPS-02/03.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.