mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1090] [MERGED] refactor(app-router): gate browser state writes with approved visible commits #1086
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#1086
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/1090
Author: @NathanDrake2406
Created: 5/6/2026
Status: ✅ Merged
Merged: 5/6/2026
Merged by: @james-elicx
Base:
main← Head:nathan/726-core-02-approved-visible-commit📝 Commits (5)
673d157refactor(app-router): gate browser state writes with approved visible commits6aa9dbdrefactor(app-router): close visible commit approval escape hatchad26049ci: rerun checks19a388arefactor(app-router): isolate visible commit approval authority8e2fb7arefactor(app-router): remove legacy commit disposition mirror📊 Changes
4 files changed (+430 additions, -130 deletions)
View changed files
📝
packages/vinext/src/server/app-browser-navigation-controller.ts(+35 -85)📝
packages/vinext/src/server/app-browser-state.ts(+1 -41)➕
packages/vinext/src/server/app-browser-visible-commit.ts(+187 -0)📝
tests/app-browser-entry.test.ts(+207 -4)📄 Description
What this changes
Implements
#726-CORE-02/03from #726.This introduces
CommitDecisionandApprovedVisibleCommitas the explicit proof object for visible App Router browser commits. Navigation and same-URL server-action state writes now flow through lifecycle approval before visible browser state can be reduced, and HMR uses a named recovery approval path instead of generic proof construction.Why
Issue #726 is moving the browser navigation lifecycle toward explicit commit authority. The current code already had operation records and
visibleCommitVersion, but each browser writer still held its own implicit approval check before calling the reducer. That made future stale-result gates and planner work easier to bypass accidentally.This PR is the intended thin spine step: no proof, no visible commit transaction.
Approach
app-browser-visible-commit.tsas the visible browser mutation authority module.app-browser-state.tsfocused on state shape, reducer mechanics, pending commit construction, history helpers, server-action request headers, and legacy disposition tracing.dispatch,skip, andhard-navigatesemantics tocommit,no-commit, andhard-navigatedecisions.ApprovedVisibleCommitas a nominal commit proof and route visible state reduction throughapplyApprovedVisibleCommit.app-browser-visible-commit.ts.approvePendingNavigationCommit()as the navigation lifecycle gate.approveHmrVisibleCommit()as the named trusted HMR recovery path, with a lane guard so non-HMR pending commits cannot use it as a generic approval escape hatch.dispatchBrowserTreepath withdispatchApprovedVisibleCommitfor navigation, same-URL action payloads, and HMR.CommitDecisiondirectly, with the legacy disposition shape kept private to the older state-level classifier.Non-goals for this PR, matching
#726-CORE-02/03:NavigationPlannerValidation
vp check packages/vinext/src/server/app-browser-state.ts packages/vinext/src/server/app-browser-visible-commit.ts packages/vinext/src/server/app-browser-navigation-controller.ts tests/app-browser-entry.test.tsvp test run tests/app-browser-entry.test.ts tests/app-route-graph.test.tsvp run vinext#buildvp check --fixandknip --no-progressBonk
Bonk, please read issue #726 before reviewing so the
ApprovedVisibleCommitboundary is evaluated in the larger lifecycle and planner roadmap context, not as an isolated refactor.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.