mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #964] [MERGED] refactor(app-router): extract RSC runtime primitives #984
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#984
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/964
Author: @NathanDrake2406
Created: 4/29/2026
Status: ✅ Merged
Merged: 4/30/2026
Merged by: @james-elicx
Base:
main← Head:nathan/extract-rsc-runtime-primitives📝 Commits (2)
ed0763arefactor(app-router): extract RSC runtime primitivesc490a9cfix(app-router): address RSC primitive review feedback📊 Changes
9 files changed (+699 additions, -1962 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+28 -261)➕
packages/vinext/src/server/app-rsc-errors.ts(+121 -0)📝
packages/vinext/src/server/app-server-action-execution.ts(+61 -3)📝
packages/vinext/src/server/isr-cache.ts(+57 -4)📝
tests/__snapshots__/entry-templates.test.ts.snap(+156 -1566)📝
tests/app-router.test.ts(+25 -127)➕
tests/app-rsc-errors.test.ts(+133 -0)📝
tests/app-server-action-execution.test.ts(+55 -0)📝
tests/isr-cache.test.ts(+63 -1)📄 Description
What this changes
Moves the small App Router RSC runtime primitives out of
entries/app-rsc-entry.tsand into typed server modules:server/isr-cache.ts.renderToReadableStreamonErrorhandling now live inserver/app-rsc-errors.ts.The generated RSC entry now describes app shape and request-specific wiring: route imports, route tables, manifest data, and callbacks that bind the current request context.
Why
app-rsc-entry.tsis generated code, so every inline runtime helper makes the template harder to inspect and harder to test directly. The pressure here is not a behavior gap, it is ownership: codegen should describe the app shape, while normal modules should own behavior.This also gives us direct unit coverage for the runtime contracts that were previously covered mostly by generated-code snapshots.
Approach
The branch keeps the generated entry's observable wiring intact but replaces inline helper bodies with absolute imports resolved by the generator. The focused helpers preserve the existing runtime contracts:
Content-Length.Relevant Next.js source references:
stringHash(err.message + stack)increate-error-handler.tsx.action-handler.ts.file-system-cache.tsand write path infile-system-cache.ts.Validation
vp test run tests/isr-cache.test.ts tests/app-server-action-execution.test.ts tests/app-rsc-errors.test.ts tests/entry-templates.test.tsvp test run tests/app-router.test.tsvp test run tests/app-router.test.ts -t "RSC error runtime delegation|reports server component render errors via instrumentation in production|redirect\(\) inside Suspense|notFound\(\) inside Suspense"vp checkgit diff --checkRisks / follow-ups
This intentionally leaves the larger server-action POST orchestration in the generated entry. This PR only extracts the small primitives needed to prove the pattern with a low-risk diff.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.