Skip to content

feat(cloudflare): isolate Workers Cache with staged entrypoints - #3079

Closed
james-elicx wants to merge 37 commits into
codex/cdn-stack-corefrom
codex/cdn-entrypoint-cache
Closed

james-elicx wants to merge 37 commits into
codex/cdn-stack-corefrom
codex/cdn-entrypoint-cache

Conversation

@james-elicx

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

Copy link
Copy Markdown
Member

Summary

  • make the default Worker entrypoint an uncached gateway that always runs middleware and routing
  • add a cache-enabled VinextCachedResponse Worker entrypoint for reusable render responses
  • configure per-entrypoint Workers Cache settings in generated Wrangler output
  • use adapter-owned ctx.exports dispatch while keeping ordinary bypass work local and uncached
  • lazy-load both stages so an edge HIT does not evaluate the Worker and a miss does not eagerly load the render graph
  • carry the gateway build identity into configurable-entrypoint props and reject stale stages before rendering or cache admission
  • version the Cloudflare wire cache discriminator so both old-stage/new-gateway and new-stage/old-gateway rollout pairings fail closed before admission
  • route readiness through the response entrypoint and retry required transient BYPASS results within the existing bounded propagation window
  • preserve custom Worker entrypoints, revalidation purges, static assets, and existing app configuration

Stack

  1. tooling baseline (chore(deps): update Cloudflare Workers tooling #3082)
  2. transport-neutral worker stages (feat(build): add transport-neutral worker stages #3083)
  3. This PR: Cloudflare Workers Cache entrypoint isolation (feat(cloudflare): isolate Workers Cache with staged entrypoints #3079)
  4. independently deployed HTTP stages (feat(build): support independently deployed worker stages #3084)
  5. Workers Cache tag parity (fix(cloudflare): preserve Workers Cache tag parity #3085)

Validation

  • Cloudflare warmup/deploy/worker tests: 170 passed
  • rolling-deploy cache emulation covers both pre-protocol directions, retry fill, and subsequent HIT
  • readiness and nested dispatch wire normalization covered
  • full vp check and Knip: passed at the stack head
  • vinext and @vinext/cloudflare builds: passed
  • deployed Workers Cache run 33597158196: 12 warmed, 0 skipped, 0 failed; browser RSC requests were HITs

Comment thread tests/fixtures/multi-stage-http/http-stage-node.ts Fixed
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please use an 8 minute time limit.

@pkg-pr-new

pkg-pr-new Bot commented Aug 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: d30a0ec

@ask-bonk

ask-bonk Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

error: Your local changes to the following files would be overwritten by checkout:
pnpm-lock.yaml
Please commit your changes or stash them before you switch branches.
Aborting

github run

@ask-bonk

ask-bonk Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@james-elicx Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared d30a0ec against base 9e5d0c2 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.4 KB 142.4 KB ⚫ -0.0%
Client entry size (gzip) vinext 129.6 KB 129.6 KB ⚫ -0.0%
Dev server cold start vinext 2.93 s 2.91 s ⚫ -0.7%
Production build time vinext 3.06 s 3.05 s ⚫ -0.4%
RSC entry closure size (gzip) vinext 125.7 KB 125.7 KB ⚫ +0.0%
Server bundle size (gzip) vinext 216.4 KB 216.4 KB ⚫ +0.0%

View detailed results and traces

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

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please use an 8 minute time limit. Review exact head d9c8ac4.

@ask-bonk

ask-bonk Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

error: Your local changes to the following files would be overwritten by checkout:
pnpm-lock.yaml
Please commit your changes or stash them before you switch branches.
Aborting

github run

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please limit this review to 8 minutes.

@ask-bonk

ask-bonk Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

error: Your local changes to the following files would be overwritten by checkout:
pnpm-lock.yaml
Please commit your changes or stash them before you switch branches.
Aborting

github run

@github-actions

github-actions Bot commented Aug 25, 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/cdn-entrypoint-cache branch from bcb2872 to 4d186de Compare August 25, 2026 23:12
@james-elicx
james-elicx changed the base branch from main to codex/cdn-stack-core August 25, 2026 23:13
@james-elicx
james-elicx force-pushed the codex/cdn-stack-core branch from e242325 to 2a1a9d5 Compare August 25, 2026 23:15
@james-elicx
james-elicx force-pushed the codex/cdn-entrypoint-cache branch from 4d186de to 9d0abbb Compare August 25, 2026 23:15
@james-elicx
james-elicx force-pushed the codex/cdn-stack-core branch from 2a1a9d5 to eacb78d Compare August 25, 2026 23:19
@james-elicx
james-elicx force-pushed the codex/cdn-entrypoint-cache branch from 9d0abbb to 379ae5b Compare August 25, 2026 23:19
@james-elicx
james-elicx force-pushed the codex/cdn-entrypoint-cache branch 8 times, most recently from c33a310 to c3d4659 Compare September 2, 2026 03:15
@james-elicx
james-elicx force-pushed the codex/cdn-entrypoint-cache branch from 8e7977a to 23fb088 Compare September 2, 2026 06:15
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please review exact head 23fb088. Time limit: 8 minutes. Focus on Workers Cache entrypoint isolation, lazy startup, mixed-stage identity, required BYPASS propagation retries, and safe promotion after pre-warming.

Comment thread packages/cloudflare/src/cache/cdn-adapter.worker.ts
@ask-bonk

ask-bonk Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please review exact head 17cf0db. Time limit: 8 minutes. Verify that expected response-stage identity is rejected inside VinextCachedResponse before render/cache admission, that required BYPASS retries remain bounded, and that no stale-stage object can poison the new build key.

Comment thread packages/cloudflare/src/cache/cdn-adapter.worker.ts
@ask-bonk

ask-bonk Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please review exact head d30a0ec. Time limit: 8 minutes. Verify the versioned options.cache wire discriminator makes rolling deployment incompatible in both directions before render/cache admission, while source mode, readiness, nested dispatch, retry, and HIT behavior remain correct.

@ask-bonk

ask-bonk Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@james-elicx

Copy link
Copy Markdown
Member Author

Superseded by the focused staged implementation in #3142 through #3156.

@james-elicx james-elicx closed this Sep 2, 2026
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.

2 participants