Repository navigation
fix(cloudflare): name queues after the Worker so environments don't share them - #597
Merged
Merged
Conversation
…hare them Cloudflare queue names are unique per account, and `void deploy --platform cloudflare` used the bare name from `queues/`. Two Workers from one app, such as staging and production, bound the same queue and fought over its single consumer. Deploys now use `<worker>-<name>`. A queue the Worker already consumes keeps its name, so deployed apps keep their queue and its backlog, and a queue another Worker consumes stops the deploy before the build. The build gets the chosen names, and the generated Worker matches them exactly, since a `-name` suffix can pick the wrong queue. Dev, previews, plain builds and the hosted platform keep plain names. Fixes #547 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Build the queue prefix from the Worker name in resource-name form, as R2 and KV do, so a Worker named `my_app` gets `my-app-jobs` instead of a name Cloudflare rejects. - Stop the deploy when one queue's Worker-named queue is another file in queues/ (`jobs` and `app-jobs` in Worker `app`); nothing says which queue an existing `app-jobs` belongs to. - Read queue consumers with the same identity rules as consumer removal. - Docs: say messages sent while moving off an old queue stay in it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #547.
Cloudflare queue names are unique per account.
void deploy --platform cloudflareused the bare name fromqueues/, so two Workers of one app (staging and production) in one account bound the same queue and fought over its single consumer.How a deploy picks each name
Preflight reads the account before provisioning or building:
<worker>is the Worker name in resource-name form, as for R2 and KV (my_app→my-app-jobs). It is not trimmed, somy-long-app-stagingandmy-long-app-productioncan't collide.void.lock.json, which every Worker deploying from the checkout shares.The #547 repro, as tested:
Where the chosen names go
The generated Worker now matches deploy names exactly. The old
-namesuffix match would sendapp-staging-jobstoqueues/staging-jobs.tswhen bothjobsandstaging-jobsexist. Without a deploy map (dev, preview, hosted), the resolver output is byte-for-byte the same as before.queues.infonow also returns each queue's consumers, read from the same account queue list. That costs no extra API calls. An app with noqueues/makes no queue calls (covered by a test).Tests
queue-cloudflare-names.test.ts: naming rules, the env map reader, and the exact resolver (both wrong-handler layouts, plain names still match, unknown names fail).cloudflare-deploy.test.ts, new queue-naming group: fresh account, kept plain queue, kept scoped queue, the Queue names aren't scoped per Worker/environment, so staging and production collide in one Cloudflare account #547 repro, two Workers in a new account, another Worker's consumer, an HTTP pull consumer, a 64-character name, thejobs+app-jobsclash, amy_appWorker, unreadable and killed probes,--provision, no queues, and an ambient map dropped.wrangler.test.ts: a Void-written framework producer moves to the new name and the old consumer is queued for removal. A producer the user wrote still throws.wrapper.test.ts,cloudflare-operation-process.test.ts: the framework wrapper's exact map, and consumer parsing (including ambiguous shapes, which leave the list unread).integration/cloudflare-deploy-build.test.ts: a real kitchen-sink deploy build emitsvoid-kitchen-sink-demo-queueand the exact map, and still passes the artifact check.vp run check,vp fmt,vp lint,vp run test --base origin/mainand one fullvp test runpass.An independent review in a separate worktree confirmed 4 defects in the first commit, all fixed in the second: a
_Worker name, the shared-name clash, the docs' move steps, and loose consumer parsing.Choices to check
jobsearlier, staging keepsjobsand production moves toapp-production-jobs. The docs explain how to move off a kept queue.void.config.tsmapping. The issue offered "suffix with the Worker name" or "a config mapping". This PR does the first. A mapping would add public config this bug doesn't need.batch.queueon direct deploys is the Cloudflare name (app-staging-jobs), as Cloudflare documents. The hosted platform's native path already exposes prefixed names, and framework handlers must get the originalMessageBatch(seepackages/void/AGENTS.md).jobs+app-jobsclash in Workerappstops even an app that deployed before this change. Nothing says which queue an existingapp-jobsbelongs to.🤖 Generated with Claude Code