Repository navigation
fix(cli): revert the Class A wrangler asset-config write - #293
Conversation
`void:framework-build-wrapper` gained a `config` hook that wrote
`assets.not_found_handling` into the built wrangler config for Class A apps
whenever `routing.notFound` was set. It shipped in 0.10.12 and it is wrong.
Cloudflare's asset layer serves unmatched requests ITSELF once
`not_found_handling` is set to anything other than `none`, and only
`run_worker_first` sends them to the Worker first. Writing one without the
other inverts the routing on a self-hosted `wrangler deploy`: a request for an
SSR route with no matching asset now gets `404.html` from the asset layer and
the framework worker is never invoked. Before this change the key was absent,
CF defaulted to `none`, and the request fell through to the worker correctly.
The half policy is strictly worse than none.
Completing the policy instead is not the fix either. Adding
`run_worker_first: ['/**']` alone makes it worse again — a real Class A build
emits `"assets": {"directory": "../client"}` with NO `binding` (verified in
playground/tanstack-start/dist/server/wrangler.json), so `env.ASSETS` is
undefined, `serveWithAssets` returns on its first guard, and worker-first
routing with no asset access 404s the entire site. Making it work needs Void to
also own `assets.binding` across TanStack Start, React Router and both vinext
modes — and `--backend cloudflare` refuses Class A SSR outright
(cli/deploy.ts), so there is no supported self-host path to serve.
Managed `void deploy` was never affected and is unchanged: `runFullDeploy`
resolves `manifest.assetConfig` from `resolveAssetConfig({ ..., notFound })`
independently of the built wrangler config, and that is what the platform
applies to the uploaded script.
Also reverts the per-field `mergeBindings` stale-value deletion, which existed
only to stop the Class A single-key write from dropping a root wrangler
`run_worker_first`. With both keys generated again in default mode the
object-level gate is equivalent.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_664e7e11-1e92-4805-ae49-087f983ec039) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f972de950
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_a18434dd-d380-4542-bf17-208fc738cba7) |
Reverting the asset-config write fixed the routing inversion but left `routing.notFound` accepted and inert for TanStack Start and React Router on a self-hosted `vite build && wrangler deploy` — and three docs still promised it worked. Silently accepting an option that does nothing is its own bug. This is the treatment Class B/C already gets (`warnIgnoredNotFoundForFramework`, cli/deploy.ts), extended to Class A: warn, and say so in the docs. It changes no emitted config; `not_found_handling` and `run_worker_first` are still not written for these frameworks. The warning has to fire from the plugin, not the CLI, because the self-host path never runs `void deploy`. But Class A DOES honor `routing.notFound` on a managed deploy — `runFullDeploy` resolves `manifest.assetConfig` out-of-band — so warning unconditionally would be false there. `void deploy` now marks its build child with `VOID_DEPLOY_BUILD=1` and the plugin warns only in its absence. It goes through `buildEnv()` into the child env object, never `process.env`, matching the existing `VOID_DEPLOY_PROJECT_ID` precedent, so it cannot leak into a sibling process or a later `void dev`. Deliberately not set by `runCloudflareDeploy` (`--backend cloudflare`), which IS the self-host path the warning is about. Known limitation: `vite build` followed by `void deploy --skip-build` warns spuriously. At build time the plugin cannot know a managed deploy will follow, and the warning's second sentence says managed deploy honors it. Docs corrected — all three were false or false by omission: guide/edge/static-assets.md "TanStack Start and React Router ... not affected" guide/edge/static-assets.md "Void owns the generated asset routing policy" reference/config.md listed only SvelteKit/Nuxt/Analog/Astro as exceptions Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_ecdd999f-d652-4ad4-86cb-eb90fa3f91d6) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71c5f84855
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Two corrections from review of the previous commit. **The warning overclaimed.** It told every self-hosted Class A build that `routing.notFound` "is inert", which is false for anyone who declares a complete `assets` policy in their own wrangler config. The generated wrapper consumes `routing.notFound` and serves through `env.ASSETS`, and `mergeBindings` leaves a Class A root `assets` block untouched — its gate needs `workerConfig.assets`, which the Class A branch never sets. So that configuration WORKS, and the warning was calling a working setup broken. It now states what is actually true — Void generates no policy — and names the four fields that make a self-written one work: `binding`, `directory`, `not_found_handling`, `run_worker_first`. **The docs pointed at a path that does not exist.** `dist/ssr/wrangler.json` is the Void-app artifact. Class A emits per-framework (preset.ts `workerDir`): tanstack-start dist/server/wrangler.json react-router build/server/wrangler.json vinext dist/rsc/wrangler.json Both docs now carry the real paths and the same corrected framing: honored on managed `void deploy`; on self-host it applies if your own config declares the complete policy, which Void leaves alone. Adds a test asserting the warning never matches /\binert\b/ and does name all four fields, so the overclaim cannot come back. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_d5acc982-709b-4cc2-a295-17513bebf038) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09e1a7a92f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
vinext is Class A (`plugin-inference.ts:51,77` — `vinext-pages`, and `vinext-app` when `app/` exists), so the self-host warning fires for it and the caveat applies, but the docs named only TanStack Start and React Router. That left vinext users reading a caveat that looked like it excluded them. Naming it is also what the rest of the docs already do — `guide/jobs.md:87`, `guide/queues.md:144`, `guide/deployment.md:109` and `integrations/cloudflare.md:256` all list vinext alongside the other Class A frameworks. All four generated worker configs, from `FRAMEWORK_PRESETS` (`cli/preset.ts`): tanstack-start dist/server/wrangler.json react-router build/server/wrangler.json vinext-app dist/rsc/wrangler.json vinext-pages dist/ssr/wrangler.json Note the last one: `dist/ssr` is the vinext Pages path, which is why the originally-wrong shared path looked plausible — it was right for exactly one of the four. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_dca582d7-0645-4c8c-8628-0ea2e8f61692) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8a213845e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
`preset.ts:97` declares `workerDir: 'dist/rsc'` for `vinext-app`, and I copied it into the docs without checking it against a build. The build does not agree: playground/vinext-app/dist/server/wrangler.json <- actual playground/vinext-pages/dist/ssr/wrangler.json <- actual, matches preset `test/integration/vinext-app.test.ts:25,33` asserts the same thing against a real build. Docs now state ground truth. The preset itself is left alone — it is a separate latent bug and out of scope here. `runFullDeploy` (the Class A path) calls `resolveWorkerDirName(distDir, fwPreset, …)` at deploy.ts:6093, which derives the subdirectory from `fwPreset.workerDir` and THROWS when it is absent, so `void deploy` on a vinext App Router project should fail with "deploy: Worker output 'dist/rsc' not found" before it ever reaches asset config. Filed rather than fixed: changing a preset's output contract needs its own verification pass across both vinext modes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_35fce3ee-8f7f-4b4e-a4e9-6f54c4fb9a5e) |
Reverts the
void:framework-build-wrapperconfighook that shipped in0.10.12.What broke
The hook wrote
assets.not_found_handlinginto the built wrangler config for Class A apps wheneverrouting.notFoundwas set — withoutrun_worker_first. Cloudflare's asset layer serves unmatched requests itself oncenot_found_handlingis anything butnone; onlyrun_worker_firstsends them to the Worker first.The half policy is strictly worse than no policy.
Why not complete the policy instead
Adding
run_worker_first: ['/**']alone is worse again. A real Class A build emits no assetsbinding:So
env.ASSETSis undefined,serveWithAssetsreturns on its first guard, and worker-first routing with no asset access 404s the whole site. Making it work needs Void to ownassets.bindingacross TanStack Start, React Router and both vinext modes — and--backend cloudflarerefuses Class A SSR outright (cli/deploy.ts), so there is no supported self-host path to serve.Not affected
Managed
void deploynever was.runFullDeployresolvesmanifest.assetConfigfromresolveAssetConfig({ ..., notFound })independently of the built wrangler config, and that is what the platform applies to the uploaded script.routing.notFoundworks for Class A onvoid deploybefore and after this PR.Also reverts the per-field
mergeBindingsstale-value deletion, which only existed to protect the Class A single-key write.Diff is byte-identical to the pre-Class-A state of both files.
🤖 Generated with Claude Code
Note
Medium Risk
Fixes a production routing regression for self-hosted Class A SSR; behavior change is intentional and managed deploy path is explicitly preserved via
VOID_DEPLOY_BUILD.Overview
Reverts the
void:framework-build-wrapperbehavior that wroteassets.not_found_handlinginto Class A (TanStack Start, React Router, vinext) built wrangler configs whenrouting.notFoundwas set. That partial policy let Cloudflare’s asset layer handle unmatched requests withoutrun_worker_first, so the framework worker never ran for SSR misses.Managed
void deployis unchanged: deploy setsVOID_DEPLOY_BUILD=1on build children and still applies asset routing viamanifest.assetConfig. Self-hostedvite build && wrangler deploynow gets a one-timevite buildwarning whenrouting.notFoundis set (suppressed whenVOID_DEPLOY_BUILDis set), explaining that Void does not emit anassetspolicy and that a complete user wranglerassetsblock is required for self-host—not that the setting is inert.Also restores full
mergeBindingsreplacement of stalenot_found_handling/run_worker_firstwhen Void owns generated assets (reverting per-field logic tied to the partial write). Docs expand Class A vs managed deploy and self-host expectations.Reviewed by Cursor Bugbot for commit 7a2ab64. Bugbot is set up for automated code reviews on this repo. Configure here.