GeezerVison is showing github.com — feat(hosted-worker): D1QueueStore — the fleet queue over Cloudflare D1 (#14866 slice) by dezren39 · Pull Request #14868 · developing-today/code
Conversation
dezren39
commented
Nov 25, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
First slice of the #14866 Cloudflare-first programme for the fleet queues: the storage, without the wire — a D1-backed implementation of the hosted door's QueueStore interface in pkgs/fleet/hosted-worker, beside LibSQLQueueStore (embedded/Turso file) and HranaQueueStore (remote Turso).
src/d1-queue-store.ts — D1QueueStore over an injectable D1Client (one self-contained statement per execute; insert ids and affected-row counts come from the statement's own meta, never connection-scoped state), plus D1DatabaseClient, the production adapter over a D1Database binding (prepare/bind; all() for row-returning statements, run() otherwise), and the openD1QueueStore opener. Same shared schema DDL (LIBSQL_QUEUE_SCHEMA), same row codecs, same conditional-UPDATE claim primitive — one queue, one schema, three transports; rows move between backends by export, never by translation.
- Selection —
buildDeps resolves the D1 store when the QUEUE_D1 binding is present (HostedEnv.QUEUE_D1 in config.ts; [[d1_databases]] stanza in wrangler.toml). The binding's presence is the operator's explicit choice; no deployment binds it yet, so existing shapes are unchanged until one does. No deploy, no data movement, no behaviour change to the live doors in this slice.
test/d1-queue-parity.test.ts — the parity scenarios the other stores pin, plus the two proofs only this door gives (below). Registered in package.json's test script.
Refs #14866.
Evidence
Ran on the laptop at base 2123f2629fd (worktree off origin/main; named fallback — CI runs on main only):
- Failing-first: the new suite failed on origin/main with
ERR_MODULE_NOT_FOUND for src/d1-queue-store.ts — the slice's subject, not a fixture error.
- After:
node --experimental-transform-types --test test/d1-queue-parity.test.ts — 6/6 pass: full QueueStore surface round-trip; cross-door claim both directions on one timeline; preempted-claim race re-picks to nothing; two doors over the production D1DatabaseClient (driven by a faithful in-process D1 API double over a real SQLite file) enqueue/claim/complete; D1-written rows read field-for-field identically through the embedded store on the same database and vice versa; buildDeps selects D1 with the binding present, the fixture without.
- Full package suite: 254 tests, 252 pass, 0 fail, 2 skipped (the endpoint-gated Hrana wire pair — pre-existing skips).
tsc --noEmit clean.
- Evidence level, plainly: the store and its binding adapter are proven against the documented D1 API shape over a real SQLite engine. A run against a real D1 database belongs to the deployment slice that creates it — not claimed here.
Merge Danger
Low. The new store is inert until a deployment binds QUEUE_D1; the only changed live-path code is one ternary in buildDeps whose false branch is the previous expression verbatim. Reverting this PR removes the D1 option and nothing else.
{
"direct_parent": null,
"links": [],
"lineage": {
"design": null,
"roadmap_item": null,
"priority": null
},
"pm_meta": 1,
"provenance": {
"queue_id": null,
"scheduled_start": null,
"picked_up_at": null,
"work_started_at": null,
"created_at": "2026-11-25T05:38:40Z",
"session_id": null,
"lane": null,
"host": "amd",
"worktree": "/home/user/wt-lane-iw280-14866",
"model": null,
"lane_start_issues": [],
"workspace_ref": {
"kind": "worktree",
"id": "/home/user/wt-lane-iw280-14866",
"repo": "developing-today/code",
"branch": "lane/iw280-14866-d1-queue-store",
"sha": "7b468cf13ddad9a2cea2b2a91887756e7b14cad3"
},
"auth_subject": "agent-next-20-local",
"stamped_by": "fleet 0.1.0 (native)"
}
}
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
#14866 slice)
First slice of the #14866 Cloudflare-first programme for the fleet
queues: a D1-backed implementation of the hosted door's QueueStore
interface, beside LibSQLQueueStore (embedded/Turso file) and
HranaQueueStore (remote Turso). Same shared schema DDL
(LIBSQL_QUEUE_SCHEMA), same row codecs, same conditional-UPDATE
claim primitive — one queue, one schema, three transports; rows
move between backends by export, never by translation.
- src/d1-queue-store.ts: D1QueueStore over an injectable D1Client
(one self-contained statement per execute; insert ids and
affected-row counts from the statement's own meta, never
connection-scoped state), plus D1DatabaseClient, the production
adapter over a D1Database binding (prepare/bind, all() for
row-returning statements, run() otherwise), and openD1QueueStore.
- Selection: buildDeps resolves the D1 store when the QUEUE_D1
binding is present (config.ts HostedEnv field, wrangler.toml
[[d1_databases]] stanza). The binding's presence is the
operator's explicit choice; no deployment binds it yet, so
existing shapes are unchanged until one does. No deploy, no data
movement, no behaviour change to the live doors in this slice.
- test/d1-queue-parity.test.ts: the parity scenarios the other
stores pin (full surface round-trip, cross-door claim both
directions on one timeline, preempted-claim race) over an
in-process D1Client, plus the binding suite (two doors over the
production D1DatabaseClient driven by a faithful D1 API double
over a real SQLite file: enqueue/claim/complete), cross-store
interop with the embedded store on the same database, and the
buildDeps wiring proof. Registered in package.json's test script.
Evidence (laptop worktree at 2123f26, named fallback — CI runs
on main only): the new suite failed before the store existed
(ERR_MODULE_NOT_FOUND) and passes after, 6/6; full package suite
254 tests, 252 pass, 0 fail, 2 skipped (the endpoint-gated Hrana
wire pair, pre-existing); tsc --noEmit clean. A run against a real
D1 database belongs to the deployment slice that creates it.
Refs #14866
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 49 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e74becf8-7f55-4475-801f-190622ebb161
Commits
-
Reviewing files that changed from the base of the PR and between 2123f26 and 7b468cf.
Files selected for processing: 6
-
pkgs/fleet/hosted-worker/package.json
pkgs/fleet/hosted-worker/src/config.ts
pkgs/fleet/hosted-worker/src/d1-queue-store.ts
pkgs/fleet/hosted-worker/src/worker.ts
pkgs/fleet/hosted-worker/test/d1-queue-parity.test.ts
pkgs/fleet/hosted-worker/wrangler.toml
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 25, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|