feat(cloudflare): prewarm canonical ISR RSC requests - #3002
Open
james-elicx wants to merge 69 commits into
Open
Conversation
commit: |
Contributor
|
Contributor
Performance benchmarksCompared 0 improved · 0 regressed · 6 within ±1.5%
View detailed results and traces 🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head |
Member
Author
|
/bigbonk review for issues |
Member
Author
|
/bigbonk review for issues |
Contributor
|
@james-elicx Bonk workflow was cancelled. View workflow run · To retry, trigger Bonk again. |
Member
Author
|
/bigbonk review for issues |
Member
Author
|
/bigbonk review for issues |
Member
Author
|
/bigbonk review for issues |
Member
Author
|
/bigbonk review for issues |
1 similar comment
Member
Author
|
/bigbonk review for issues |
james-elicx
force-pushed
the
codex/rsc-prewarm-isr
branch
from
August 21, 2026 22:29
2a86cec to
d5663fb
Compare
james-elicx
marked this pull request as ready for review
August 21, 2026 23:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prewarm browser-identical App Router RSC requests for build-discovered routes, without locally rendering every route and without depending on
vinext({ prerender })or--prerender-all.Core vinext exposes a cache-adapter capability,
responseVary: "verbatim". Only adapters that opt into that contract enable canonical RSC sharing; Cloudflare deployment, Worker version targeting, and CDN validation stay in@vinext/cloudflare.Request identities
An ordinary full RSC request has one definitive identity:
A deterministic
loading.tsxshell has its own stable URL key:The browser and deploy warmer derive these URLs through the same request-identity code. Separating the loading shell from the full response avoids depending on two
Varyrepresentations beneath one public Workers Cache URL; the path plus stable digest is the cache key.Canonical requests omit
Next-Router-State-Tree,Next-Url, source-route fingerprints, interception context, and mounted-slot context. Requests that actually need that context remain hashed and keep their headers: interception/parallel-route payloads, route-tree or individual-segment prefetches, search-dependent shells, rewrites, mounted slots, and other contextual forms are not collapsed into the shared MVP entry.Build and deploy behavior
The build emits a small server-side warm plan from route discovery. Static routes are known directly; dynamic App and Pages paths query the built runtime for
generateStaticParams()orgetStaticPaths()when needed, including MDX routes. This does not callrunPrerender()and does not render page responses locally.At deploy time the Cloudflare package:
Cloudflare-Workers-Version-Overridesselecting the uploaded version;The initial queue sends each request once. Only failures are retried after the rest of the queue completes; there is no queue-wide deadline. A response is accepted only when its status, cache policy,
CF-Cache-Status, content type, exact supportedVary, and opaque RSC build ID are coherent. Cacheable responses are warmed; coherentno-storeplusBYPASSresponses are skipped; same-build cacheable redirects and not-found responses are warmed; wrong builds, 5xx responses, missing CDN admission, and contradictory policies fail strict warmup.Preview aliases continue through the existing example-preview flow; there is no separate preview warmup path. TPR and TOML parsing are unchanged.
Verification
Focused local verification includes:
?_rscfor full RSC and the stable digest for loading shells;vp checkfor every touched implementation/test file;vp run vinext#buildandvp run @vinext/cloudflare#build.The deployed E2E uses a deliberately stale seed Worker, stages and warms the new version, promotes it, and polls a no-cache version endpoint using unique URLs. It then requires single-shot pre-existing CDN
HITassertions for both canonical keys before browser navigation can touch them. Browser coverage verifies:prefetch={true}cache reuse with zero additional RSC request on click;no-store/BYPASS.Cloudflare promotion can briefly route an individual later request back to the identifiable seed Worker even after a sustained readiness window. The E2E retries only a browser scenario that receives
X-Vinext-Seed-Worker: 1, using a fresh context. A response from the current Worker that isMISS,BYPASS, malformed, or uses the wrong URL/header shape still fails immediately; canonical cache keys are never primed by the test before their one-shotHITassertions.Intentional MVP deferrals
Those requests retain their existing contextual headers and hashed
_rscidentity rather than risking cross-route cache reuse.