FEATURE: Add the Cloudflare Queues worker boundary - #33
Conversation
|
Warning Review limit reached
On-demand reviews are free for the next 9 days. After that, they cost $0.25 per reviewed file. Or wait 33 minutes for your next included review. View limit detailsLimit details: You’ve used all 6 included reviews currently available. Your 49 included PR review attempts over the past 7 days set your current allowance at 6 reviews per hour. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (19)
Comment |
31c4541 to
7efff9d
Compare
| const queueProducers = (block) => bindingNames(block.queues?.producers); | ||
| if (!sameJson(queueProducers(config), queueProducers(prod))) { | ||
| drift.push( | ||
| `queues.producers bindings: local=${JSON.stringify(queueProducers(config))} production=${JSON.stringify(queueProducers(prod))}` | ||
| ); | ||
| } |
There was a problem hiding this comment.
Check queue configuration drift
This check reduces producers to binding names and does not compare producer destinations or any consumer configuration. A production queue can therefore use a different destination, retry limit, or consumer queue while this release check reports no drift. This is non-blocking, but it removes the intended deployment safeguard and can leave jobs routed or retried differently in production.
Knowledge Base Used:
Artifacts
- The authored Node script clones the current Wrangler configuration into temporary directories, applies one queue-only mutation per run, and invokes the real drift checker; it reproduces the unchecked queue values.
- The real checker was executed against an unmodified temporary copy of the current Wrangler configuration and exited successfully with no drift.
- The real checker was executed against three temporary copies differing only in a producer destination, consumer retry setting, or consumer destination, and it passed all three; queue configuration drift is not detected.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/check-wrangler-drift.mjs
Line: 184-189
Comment:
**Check queue configuration drift**
This check reduces producers to binding names and does not compare producer destinations or any consumer configuration. A production queue can therefore use a different destination, retry limit, or consumer queue while this release check reports no drift. This is non-blocking, but it removes the intended deployment safeguard and can leave jobs routed or retried differently in production.
**Knowledge Base Used:**
- [Runtime configuration and schema](https://app.greptile.com/davis7dotsh/-/custom-context/knowledge-base/davis7dotsh/adrive/-/docs/runtime-configuration-and-schema.md)
- [Release, backup, and safety automation](https://app.greptile.com/davis7dotsh/-/custom-context/knowledge-base/davis7dotsh/adrive/-/docs/release-backup-and-safety-automation.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Declares the adrive-jobs queue (producer JOBS plus consumer with a dead-letter queue) at the top level and in env.production, keeps the producer bindings covered by the drift check, and regenerates the Worker types. Adds the shared Job discriminated union and JobSchema, a JobQueue service (with a null layer) in the request layer, and a consumer that decodes each message, acks invalid bodies, and retries failed jobs. The Worker facade forwards queue batches to /api/internal/jobs in-process under an HMAC signed over the batch body, then acks or retries per message from the endpoint's decisions. No behaviour moves onto the queue yet; runJob only logs until D2/D3. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
7efff9d to
d460dfd
Compare
Add the typed Cloudflare Queues boundary: the generated Worker signs each batch, forwards it into the SvelteKit bundle, and applies per-message acknowledgment or retry decisions. Missing decisions retry; invalid jobs are acknowledged and logged. Operation handlers are connected in #36.
The internal endpoint limits streamed UTF-8 bytes before verifying the signature over the unchanged request text. Behavioral tests execute the generated facade and cover signatures, mixed decisions, missing decisions, and failed consumers.
Important files:
apps/web/scripts/cloudflare-adapter.mjs: queue entrypoint and signed forwarding.apps/web/src/lib/server/jobs/consumer.ts: typed dispatch and per-message decisions.apps/web/src/routes/api/internal/jobs/+server.ts: authenticated, bounded batch ingestion.apps/web/src/lib/server/services/jobs.tsandapps/web/wrangler.jsonc: producer service and environment bindings.Validation: full root tests including63 route/Postgres tests; TypeScript/Effect/Svelte checks; formatting; Worker build; final independent Codex review clean. Cloudflare delivery remains a deployment-time check.
Stack layer4/11: depends on #32; followed by #34.
Note
Add Cloudflare Queues worker boundary with HMAC-signed batch forwarding
POST /api/internal/jobswith an HMAC signature covering the timestamp and exact body.JobSchema, and returns per-message ack/retry decisions based on a new consumer in consumer.ts.readBoundedTextbefore signature verification.Macroscope summarized d460dfd.
Safe to merge with respect to blocking issues; the remaining configuration-drift concern is non-blocking.
Fix with agent prompt
Summary
Reviews (2) · Last reviewed commit: "BUGFIX: Bound queue requests before sign..."