Skip to content

feat(cache): probe App Page cacheability on staged Workers - #3091

Open
james-elicx wants to merge 7 commits into
codex/staged-worker-prewarm-discoveryfrom
codex/cacheability-probe-protocol
Open

feat(cache): probe App Page cacheability on staged Workers#3091
james-elicx wants to merge 7 commits into
codex/staged-worker-prewarm-discoveryfrom
codex/cacheability-probe-protocol

Conversation

@james-elicx

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

Copy link
Copy Markdown
Member

Capability stack 3/9. Exact head: 16340739a0a09f558eb06946d2ac2568c2123b05. Base: #3090.

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

Summary

  • add authenticated identity and completed-response cacheability probe modes for App Pages
  • decide cacheability only after the response body reaches clean EOF
  • bound probe capture by time and size
  • expose Next.js's production-build phase during staged discovery/probing while leaving ordinary ISR requests in the production-server phase
  • classify dynamic APIs, revalidation mutations, errors, redirects, incomplete responses, timeouts, oversized responses, and middleware-eligible routes as unsafe
  • dynamically load probe-only runtime code only for authenticated internal requests

Safety and Next.js parity

  • revalidate alone does not override dynamic runtime usage
  • middleware eligibility is treated conservatively because a CDN hit in front of the Worker would skip middleware
  • forged or stale capabilities cannot create a static classification
  • internal capability headers are removed before user code
  • production-build phase behavior follows Next.js App Router static-generation coverage

This layer covers App Pages. #3092 consumes probe results for ordinary CDN admission; #3098 extends the protocol to Pages Router.

Review guide

  1. cacheability-request.ts authenticates probes and drains bounded responses.
  2. cacheability-classification.ts records request-scoped route outcomes.
  3. middleware-runtime.ts reports middleware participation without changing middleware behavior.
  4. app-page-cache-finalizer.ts publishes the completed render outcome.
  5. cacheability-probe.spec.ts exercises the built Worker under workerd.

Review size

Layer-only diff against this PR's base: 25 files, +717/-18.

Validation

  • layer exact-head CI is green
  • prior cumulative focused validation through feat(cache): probe Pages Router cacheability #30982,024/2,024
  • 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@3091
npm i https://pkg.pr.new/create-vinext-app@3091
npm i https://pkg.pr.new/@vinext/types@3091
npm i https://pkg.pr.new/vinext@3091

commit: 1634073

@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
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

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

1 improved · 0 regressed · 5 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.50 s 2.43 s 🟢 -2.6%
Production build time vinext 2.70 s 2.70 s ⚫ -0.2%
RSC entry closure size (gzip) vinext 116.7 KB 117.5 KB ⚫ +0.7%
Server bundle size (gzip) vinext 198.2 KB 199.3 KB ⚫ +0.5%

View detailed results and traces

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

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

Labels

None yet

1 participant