Skip to content

fix(cache): preserve Cache Components ownership during probing - #3103

Open
james-elicx wants to merge 15 commits into
codex/cacheability-manifest-admissionfrom
codex/cacheability-use-cache-ownership
Open

fix(cache): preserve Cache Components ownership during probing#3103
james-elicx wants to merge 15 commits into
codex/cacheability-manifest-admissionfrom
codex/cacheability-use-cache-ownership

Conversation

@james-elicx

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

Copy link
Copy Markdown
Member

Capability stack 5/9. Exact head: e2f05581bd12c6e0bd96899a068adfd542e82dc2. Base: #3092.

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

This supersedes #3095, whose stale descendant base caused GitHub to mark it merged without landing anything on main.

Summary

This aligns staged probes with Next.js Cache Components ownership semantics:

  • public use cache owns inner fetch(..., { cache: "no-store" }), so that fetch does not demote the enclosing route
  • use cache: private marks Cache Components routes dynamic and suspends before private user code or cache-key construction
  • the outer prerender owns that suspension, preventing try/catch or Suspense fallbacks from producing a false static classification
  • private cache nested inside public use cache or unstable_cache() fails synchronously and cannot persist private output
  • legacy unstable_cache entries use a versioned physical namespace, preventing older private output from bypassing the nesting guard
  • genuine application 5xx responses remain probe failures
  • legacy non-Cache-Components io() continues immediately and remains eligible for static probing, matching Next.js
  • ordinary App Router requests avoid probe-only ownership allocation

Next.js references

  • test/e2e/app-dir/use-cache/use-cache.test.ts
  • test/e2e/app-dir/cache-components-errors/use-cache-private.util.ts
  • packages/next/src/server/use-cache/use-cache-wrapper.ts
  • packages/next/src/server/request/io.ts

Review guide

  1. prerender-work-unit-setup.ts selects legacy versus Cache Components work-unit ownership.
  2. cache-runtime.ts enforces public/private cache nesting.
  3. cacheability-classification.ts propagates dynamic ownership to the outer render.
  4. cacheability-ownership.spec.ts covers Cache Components and seeded legacy cache entries under built workerd.
  5. cacheability-probe.spec.ts covers legacy io() parity.

Review size

Layer-only diff against this PR's base: 31 files, +677/-74.

Validation

  • Cache Components built-workerd E2E — 1/1
  • 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
  • layer exact-head CI and deploy previews are green
@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@3103
npm i https://pkg.pr.new/create-vinext-app@3103
npm i https://pkg.pr.new/@vinext/types@3103
npm i https://pkg.pr.new/vinext@3103

commit: e2f0558

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared bc44dcc against base 6946d43 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.3 KB ⚫ +0.0%
Client entry size (gzip) vinext 129.5 KB 129.5 KB ⚫ +0.0%
Dev server cold start vinext 3.34 s 3.34 s ⚫ +0.0%
Production build time vinext 3.77 s 3.77 s ⚫ +0.2%
RSC entry closure size (gzip) vinext 118.8 KB 118.9 KB ⚫ +0.2%
Server bundle size (gzip) vinext 202.1 KB 202.3 KB ⚫ +0.1%

View detailed results and traces

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

@james-elicx
james-elicx force-pushed the codex/cacheability-use-cache-ownership branch from 9a0cf75 to 9596fe4 Compare August 26, 2026 18:29
@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
@james-elicx
james-elicx force-pushed the codex/cacheability-use-cache-ownership branch 2 times, most recently from 1259853 to 40e41b5 Compare August 26, 2026 19:42
@james-elicx
james-elicx force-pushed the codex/cacheability-use-cache-ownership branch from 40e41b5 to 8dcc672 Compare August 26, 2026 21:10
@james-elicx
james-elicx force-pushed the codex/cacheability-use-cache-ownership branch 3 times, most recently from db7f103 to 92b61ea Compare August 26, 2026 22:05
@james-elicx
james-elicx marked this pull request as ready for review August 26, 2026 22:08
@james-elicx
james-elicx force-pushed the codex/cacheability-use-cache-ownership branch from 19eaf4c to dbc198b Compare August 26, 2026 22:31
@james-elicx
james-elicx force-pushed the codex/cacheability-use-cache-ownership branch 2 times, most recently from 64a6c96 to 5374d52 Compare August 26, 2026 23:59
@james-elicx
james-elicx force-pushed the codex/cacheability-use-cache-ownership branch from 5374d52 to f46e5b6 Compare August 27, 2026 00:43
@james-elicx
james-elicx force-pushed the codex/cacheability-use-cache-ownership branch 4 times, most recently from 02de876 to bc44dcc Compare August 27, 2026 01:41
@james-elicx
james-elicx force-pushed the codex/cacheability-use-cache-ownership branch from bc44dcc to e2f0558 Compare August 27, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant