Skip to content

fix(cloudflare): discover prewarm paths from staged worker - #3090

Open
james-elicx wants to merge 10 commits into
codex/fix-prerender-stale-time-racefrom
codex/staged-worker-prewarm-discovery
Open

fix(cloudflare): discover prewarm paths from staged worker#3090
james-elicx wants to merge 10 commits into
codex/fix-prerender-stale-time-racefrom
codex/staged-worker-prewarm-discovery

Conversation

@james-elicx

@james-elicx james-elicx commented Aug 26, 2026

Copy link
Copy Markdown
Member

Capability stack 2/9. Exact head: b3b23e7092858d70ae7b8ae3646e063da3c49029. Base: #3108.

Full chain: #3108#3090#3091#3092#3103#3093#3094#3098#3113.

Summary

  • upload and stage the exact Worker version at 0% before prerender path discovery
  • run authenticated App and Pages discovery against that staged Worker so generateStaticParams and getStaticPaths can use real Cloudflare bindings
  • feed the discovered concrete HTML, RSC, and loading-shell identities into CDN warming
  • share one build-scoped capability across hybrid App/Pages bundles and strip it before user code
  • retry transient platform routing failures within a bounded discovery phase while keeping structured user-function failures fatal
  • keep the deadline regression stable under loaded CI by allowing the intended third hung request to start before the shared deadline
  • keep ordinary request paths free of discovery URL parsing and lazily load Pages discovery code

This layer moves route discovery into the staged Worker. It does not classify App Pages, emit a cacheability manifest, alter ordinary CDN admission, perform the second upload, or certify cache fills.

Review guide

  1. packages/cloudflare/src/deploy.ts owns upload → 0% stage → triggers → discovery → readiness → warm → promotion.
  2. packages/vinext/src/build/prerender-paths.ts performs bounded remote discovery.
  3. packages/vinext/src/server/worker-prerender-discovery.ts authenticates internal discovery.
  4. App and Pages production entries expose the endpoints only to the authenticated discovery context.
  5. The workers-cache example reads KV during generateStaticParams, proving binding-backed discovery.

Review size

Layer-only diff against this PR's base: 27 files, +1,183/-152.

Validation

  • vp test run tests/prerender-paths.test.ts53/53 on the prior cumulative Pages head
  • staged-discovery deadline regression repeated 5/5 without wall-clock flake
  • layer exact-head CI and deployed workers-cache coverage are green
  • current full-stack cumulative changed-file suites — 2,864/2,864
  • current full-stack PPR probe/admission/Pages built-workerd E2E — 8/8
  • current full-stack vp check and git diff --check

@pkg-pr-new

pkg-pr-new Bot commented Aug 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vinext/cloudflare@3090
npm i https://pkg.pr.new/create-vinext-app@3090
npm i https://pkg.pr.new/@vinext/types@3090
npm i https://pkg.pr.new/vinext@3090

commit: b3b23e7

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared b3b23e7 against base 1fd53d7 using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 6 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.2 KB 142.2 KB ⚫ +0.0%
Client entry size (gzip) vinext 129.5 KB 129.5 KB ⚫ +0.0%
Dev server cold start vinext 2.38 s 2.36 s ⚫ -0.8%
Production build time vinext 2.58 s 2.57 s ⚫ -0.3%
RSC entry closure size (gzip) vinext 116.6 KB 116.7 KB ⚫ +0.1%
Server bundle size (gzip) vinext 198.1 KB 198.3 KB ⚫ +0.1%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
workers-cache preview production
static-export preview production
web preview production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant