mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1088] [MERGED] refactor(app-router): fence AppElements wire-key construction #1084
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#1084
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/1088
Author: @NathanDrake2406
Created: 5/6/2026
Status: ✅ Merged
Merged: 5/6/2026
Merged by: @james-elicx
Base:
main← Head:nathan/726-wire-02-03📝 Commits (2)
1f66bd7refactor(app-router): fence AppElements wire-key construction98c6609refactor(app-router): address AppElements wire review📊 Changes
9 files changed (+276 additions, -38 deletions)
View changed files
📝
packages/vinext/src/build/layout-classification.ts(+4 -1)📝
packages/vinext/src/server/app-elements-wire.ts(+99 -10)📝
packages/vinext/src/server/app-elements.ts(+6 -5)📝
packages/vinext/src/server/app-page-dispatch.ts(+4 -2)📝
packages/vinext/src/server/app-page-route-wiring.tsx(+4 -4)📝
packages/vinext/src/shims/slot.tsx(+13 -4)📝
tests/app-elements.test.ts(+138 -6)📝
tests/app-page-element-builder.test.ts(+2 -2)📝
tests/prefetch-cache.test.ts(+6 -4)📄 Description
What this changes
Implements task
#726-WIRE-02/03from issue #726 by moving AppElements wire-key construction and parsing behindAppElementsWire.The codec now owns constructors and parsers for route, page, layout, template, slot, cache, metadata, and unmatched-slot wire values. Render wiring, layout classification, browser slot merging, mounted-slot header construction, and prefetch cache tests now call the codec instead of assembling or recognizing raw
layout:,page:,template:, orslot:keys directly.Why
Issue #726 calls out that the flat AppElements payload should stay as the transport, but raw wire keys must stop becoming router authority. Before this change, several code paths still constructed or interpreted wire keys with string templates or prefix checks outside the wire boundary, which made it easy for future router work to rebuild semantics around incidental payload strings.
Correctness oracle: Vinext internal invariant from #726. The wire format remains byte-compatible for existing payload keys and legacy metadata behavior, but ownership moves to
AppElementsWire.Approach
AppElementsWireconstructors for layout, template, and slot element IDs, plus an element-key parser and slot-key predicate.server/app-elements-wire.tsandrouting/app-route-graph.ts.Non-goals:
Bonk: please read issue #726 before reviewing this PR so the big-picture AppElementsWire boundary and router-spine migration context is visible.
Validation
vp test run tests/app-elements.test.ts tests/prefetch-cache.test.ts tests/app-page-element-builder.test.ts tests/slot.test.ts tests/app-page-route-wiring.test.ts tests/layout-classification.test.ts tests/app-browser-entry.test.ts tests/app-page-render.test.ts tests/app-page-execution.test.tsvp checkexits 0. It still reports the existing unrelatedtypescript-eslint(no-redundant-type-constituents)warning inpackages/vinext/src/server/request-pipeline.ts:604.vp check --fixandknip --no-progresssuccessfully.Risks / follow-ups
The parser deliberately recognizes the existing legacy wire strings and rejects malformed keys as non-wire entries. Future #726 work can build stronger semantic IDs and planner decisions on top of this without relying on missing payload entries or raw key prefixes as proof.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.