Skip to content

fix(cli): revert the Class A wrangler asset-config write - #293

Merged
Brooooooklyn merged 6 commits into
mainfrom
fix/revert-class-a-asset-config
Aug 9, 2026
Merged

Brooooooklyn merged 6 commits into
mainfrom
fix/revert-class-a-asset-config

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

Reverts the void:framework-build-wrapper config hook that shipped in 0.10.12.

What broke

The hook wrote assets.not_found_handling into the built wrangler config for Class A apps whenever routing.notFound was set — without run_worker_first. Cloudflare's asset layer serves unmatched requests itself once not_found_handling is anything but none; only run_worker_first sends them to the Worker first.

self-hosted Class A, SSR route with no matching asset

  before 0.10.12          0.10.12                  this PR
  nfh absent = "none"     nfh = "404-page"          nfh absent = "none"
  asset miss                 asset miss               asset miss
     ↓ falls through            ↓ 404.html               ↓ falls through
  framework worker ✓        worker never runs ✗      framework worker ✓

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 assets binding:

$ cat playground/tanstack-start/dist/server/wrangler.json
"assets": { "directory": "../client" }        # no binding

So env.ASSETS is undefined, serveWithAssets returns on its first guard, and worker-first routing with no asset access 404s the whole site. Making it work needs Void to 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.

Not affected

Managed void deploy never was. runFullDeploy resolves manifest.assetConfig from resolveAssetConfig({ ..., notFound }) independently of the built wrangler config, and that is what the platform applies to the uploaded script. routing.notFound works for Class A on void deploy before and after this PR.

Also reverts the per-field mergeBindings stale-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-wrapper behavior that wrote assets.not_found_handling into Class A (TanStack Start, React Router, vinext) built wrangler configs when routing.notFound was set. That partial policy let Cloudflare’s asset layer handle unmatched requests without run_worker_first, so the framework worker never ran for SSR misses.

Managed void deploy is unchanged: deploy sets VOID_DEPLOY_BUILD=1 on build children and still applies asset routing via manifest.assetConfig. Self-hosted vite build && wrangler deploy now gets a one-time vite build warning when routing.notFound is set (suppressed when VOID_DEPLOY_BUILD is set), explaining that Void does not emit an assets policy and that a complete user wrangler assets block is required for self-host—not that the setting is inert.

Also restores full mergeBindings replacement of stale not_found_handling / run_worker_first when 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.

`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>
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/void/src/index.ts Resolved
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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>
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/void/src/index.ts Resolved
Comment thread docs/guide/edge/static-assets.md Resolved
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>
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread docs/guide/edge/static-assets.md Resolved
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>
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread docs/guide/edge/static-assets.md Resolved
`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>
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@Brooooooklyn
Brooooooklyn merged commit cc128cf into main Aug 9, 2026
9 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/revert-class-a-asset-config branch August 9, 2026 09:09
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