Repository navigation
Backlog
Labels
effort/lLarge: multi-day or open-ended; expect staged check-inskind/enhancementmeta/epicEpic / bundle of related workmeta/protocol-gapAn agent touched this without the required agent-note comment or labels; needs review of whypriority/normalOrdinary priority (the default)status/in-reviewuser/reviewNeeds a user-look: Muse reviews first and handles what it canwork/assignedQueue worker lifecycle state
Description
Programme tracking for the Turso-to-D1 migration audit (2026-11-23). Full audit + design record lands as a dated doc record (linked from this issue once merged). Research/design only so far — no migrations have been made.
What the audit found (measured, Turso API, current billing period)
- 50 Turso databases. Estate totals: ~65.8M rows written, ~7.47B rows read, ~10.0 GB storage this period.
- fleet-platform is 87% of all writes (57.4M rows written, 465 MB) — PM-stack/dashboard state owned end-to-end by Cloudflare Workers in pm-stack/.
- fleet-queue is 81% of all reads (6.08B) — broker/poller scanning; a query-shape problem, not a store-location problem.
- atlas is 73% of storage (7.28 GB) and is a native libSQL vector store (107,639 chunks + vec tables) across 33 sharded databases.
- The compile coordinator's tables (fleet placement: central coordinator for compile dispatch — atomic slots, true load view, global budgets, cross-seat queueing #13765: placement_owner_state / placement_claims / placement_budgets) live in the same single fleet-queue database as the rest of the broker store (not yet landed; build is queue task 21517).
Groups
- G1 MOVE-CLEAN — fleet-platform telemetry mirror & aggregates (agent_mirror_, agent_quota_records, agg_). Derived/rebuildable data, Worker-only access. Recommended first slice.
- G2 MOVE-CLEAN — fleet-platform ingest families (ainventory/automation/research/engineering/finance/home *_sheet_rows + *_events + *_sources).
- G3 MOVE-CLEAN — fleet-platform operational ledgers (alerts_, decision_set_events, ci_events, ideas_, orch_*). Completes the fleet-platform evacuation: all 57.4M writes/month off Turso.
- G4 STAY-TURSO — fleet-queue broker core (tasks, events, leases, placement_, coordinator tables, actions_exec_). Rust broker on the laptop; transactional claim path; D1 has no local/embedded access path. Separate fix filed by the audit: index/cursor the pollers (the real read win).
- G5 MOVE-WITH-BRIDGE — fleet-queue read-side mirrors (github_mirror_*, agent_events_pg_history). D1-first reads, Turso fallback, watermark sync (pattern per design(atlas): D1 tenant hot cache — admission, invalidation, Turso-hop skip #9134's D1 hot cache).
- G6 MOVE-WITH-BRIDGE (low priority) — muse-meta coord_events + small tables; coord_tasks/leases stay.
- G7 STAY-TURSO — Atlas (atlas + 32 shards). Vector search is libSQL-native; D1 has no vector index. Drew's sketch holds here: Turso remains the sharded embedding store.
- G8 MOVE-CLEAN (opportunistic) — small stores (notes-submissions, bedside-and-away, voice-line-ledger, fleet-dispatch-jobs). Exception: great-star-lord stays (standing keep + third-party app DB).
Honest constraints
- Moving G1–G3 alone does NOT permit a Turso plan downgrade: remaining reads (~6.9B, queue-dominated) exceed Developer-plan inclusion, and remaining storage (~9.5 GB) sits at its line. Downgrade needs the G4 read-shape fix too.
- D1 walls respected in the design: 10 GB per database (one D1 DB per family), single-writer sequential processing (sync writers must batch), Workers/HTTP-API access only.
- Housekeeping decision needed: 8 frozen staging/recovery copies from the 2026-11-17/18 Supabase recovery (~480 MB) should be exported to object storage and deleted — never migrated.
First slice (recommended)
G1: agent_mirror_* + agent_quota_records + agg_* from fleet-platform into one D1 database, dual-write cutover behind the pm-stack workers. Biggest write win (presumed majority of fleet-platform's 57.4M writes/month; per-table attribution is inference — the Turso API reports per-database only) at the lowest risk (derived data, rebuildable, Worker-only consumers). Side effect: fleet-mirror's duplicate copy of the same dataset can be retired after a parity check.
{
"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-23T23:16:16Z",
"session_id": null,
"lane": null,
"host": "htch-runtime",
"worktree": null,
"model": null,
"lane_start_issues": [],
"workspace_ref": null,
"auth_subject": "archer",
"stamped_by": "fleet 0.1.0 (native)"
}
}Acceptance criteria
- The audit record lands as a dated doc record and is linked from this issue.
- G1 (fleet-platform telemetry mirror and aggregates) migrates first, per the recommended first slice, with the D1 client path proven (PR feat(pm-stack): add laptop D1 store transport #14680 merged the D1 HTTP SqlClient).
- The G4 verdict is reconciled with Drew's 2026-11-26 move-everything-to-Cloudflare ruling (recorded on program: move PM Stack, queues, and all unblocked services to Workers + D1 (Cloudflare-first) #14866 and design(pm-stack): PM service, Workers edition — TypeScript equivalent of aggregator/dashboard/reconcile as one hosted service #9079) and recorded here before G5/G6 are planned against it.
- The 8 frozen staging/recovery copies from 2026-11-17/18 are exported to object storage and deleted, never migrated (housekeeping decision from the audit).
- Each remaining group (G2, G3, G5-G8) migrates or receives a recorded stay verdict with its evidence.
Metadata
Metadata
Assignees
Labels
effort/lLarge: multi-day or open-ended; expect staged check-inskind/enhancementmeta/epicEpic / bundle of related workmeta/protocol-gapAn agent touched this without the required agent-note comment or labels; needs review of whypriority/normalOrdinary priority (the default)status/in-reviewuser/reviewNeeds a user-look: Muse reviews first and handles what it canwork/assignedQueue worker lifecycle state
Activity
developing-today commentedon Nov 23, 2026
CODE-5080
Merge pull request #13845 from developing-today/lane/turso-d1-audit
dezren39 commentedon Nov 23, 2026
Audit record landed: PR #13845 merged — doc/2026-11-23T23-15-07Z_design_turso-d1-migration-audit/ (plus the doc/README.md index line).
Headline results:
dezren39 commentedon Nov 24, 2026
AUDIT-7 Lane 5 (DESIGN-REVIEW, #13876) — verdict on doc/2026-11-23T23-15-07Z_design_turso-d1-migration-audit: sound.
dezren39 commentedon Nov 24, 2026
Direction correction (Drew, 2026-11-23)
Recording Drew's ruling: the aim for Turso is to scale it, not to downgrade it. The audit's Scaler→Developer downgrade framing — including the "downgrade enabler" language for the slice-3 read-shape fix — is superseded.
Housekeeping decision also recorded here: export + delete of the 8 frozen 2026-11-17/18 staging/recovery copies is approved (Drew, 2026-11-23). Execution evidence will be posted on this issue.
developing-today-fleet commentedon Nov 24, 2026
Housekeeping executed — 8 frozen staging/recovery copies exported + deleted
Drew approved export + delete on 2026-11-23. Executed the same day from the laptop (turso CLI v1.0.33, org
dezren39). All 8 databases named in the audit record (§"Not a D1 question") are done. Estate count: 50 → 42 databases (verified byturso db listafter deletion; none of the 8 names remain).Export location. The audit named no bucket, so this location was chosen and is stated here: R2 bucket
supabase-backups(the estate's backup bucket, Developing.today account), prefixturso-exports/2026-11-23/— oneturso db exportsnapshot per database (.db, plus the.db-logsidecar for the four Turso-format databases; the recovery and runtime-tx logs are empty files). The export run log is in the same prefix asexport.log. Local copies also remain on the laptop at~/turso-exports/2026-11-23/.Premise check (per database, before touching anything). Rows-written counters read via
turso db inspectimmediately before and after the export window were identical for all 8 — zero write activity. The non-zero counters are the one-time 2026-11-17/18 staging loads, which fall inside the current billing period; nothing showed signs of live use, so no database was held back.Verification (every database, before its deletion).
tursodb/sqlite3on the export vsturso db shellon the live database).PRAGMA integrity_check= ok on the four SQLite-format exports; the four Turso-format exports open and query undertursodb..dbbytes.dbfleet-supabase-recovery-20261117665fe5a4b793e3f59ca7bf9cc49b34768c21b5677ef999135a87990d10f93616fleet-supabase-runtime-stage-20261118cc8f2e46853463a97838ffb78b7c334bdb00af7cb7a20416606ab69915a705f2fleet-supabase-runtime-legacy-stage-2026111838b8cd566506a3ef8511e956122463ece5ddcf5f37d0a798e9628f65804b22f4fleet-supabase-runtime-tx-stage-2026111804c9d4d2723020cdc81072e9a21997728a8b8f9e498a6e2616523b35ccf07ce0fleet-platform-reconcile-stage-20261118793899f860d01609126cdc887c85058eb8e695022b35647166fb27e4850ccc57fleet-platform-batched-stage-20261118d0a4b64eb10d2fe85f624cd723a0e27c1c63f5da9b4bc0ceeb9a2fb6193504edfleet-platform-short-tx-stage-20261118d0a4b64eb10d2fe85f624cd723a0e27c1c63f5da9b4bc0ceeb9a2fb6193504edfleet-mirror-recovery-stage-20261118fd333f0364327ad84c803585b50936598d6f20f85a5da180d2d3b200302d7b12Notes:
fleet-platform-batched-stage-20261118andfleet-platform-short-tx-stage-20261118have identical hashes — they were twin copies of the same staged dataset (their usage counters were also identical), not an export error..db-loghashes, also verified byte-identical in R2: runtime-stage (994,146 B)12a6e867e0ab1e74b1631b6000b9b94c3966dd7df13985c7f5e8c855c722efcf; runtime-legacy (133,660 B)321e399abc373e9b483a73c930b3ef671cfb2f922448d83eb731216ddf0af65a; recovery and runtime-tx logs are empty.payment_failing_since: 2026-11-04state did not block exports or deletions.dezren39 commentedon Nov 24, 2026
Triage verdict (lane any-o, queue task 22438, 2026-11-24): programme verified, first slice routed.
Fresh verification: audit record on main, DESIGN-REVIEW sound, Drew's fit-based direction + approved housekeeping both recorded and housekeeping executed (50→42 DBs). G1 tables confirmed referenced under pm-stack/aggregator. No existing queue item for G1. Follow-on feature_slice packet for slice 1 (G1 MOVE-CLEAN → one D1 database, dual-write cutover, parity check) enqueued; fleet-mirror retirement explicitly left as follow-up. Later slices (G2/G3, G4 read-shape scaling fix) stay untriaged until G1 proves the dual-write/parity pattern.
dezren39 commentedon Nov 24, 2026
Triage (oc-code-01, 2026-11-24): slice G1 (telemetry mirror and aggregates to D1) is the first build step of the Turso-to-D1 programme. The audit is measured and no migration has run. Slice 1 touches live telemetry data, so it needs a worktree, a fleet build and a verified mirror against the oracle before any cutover. This lane cannot run that. Left open for an implementation session.
dezren39 commentedon Nov 24, 2026
G1 sizing (oc-code-03, queue task 23241, 2026-11-24 14:40Z): parked, nothing landed.
dezren39 commentedon Nov 24, 2026
🤖 G1 sizing update · lane oc-code-03, queue task 23241 (recheck 2026-11-24 ~18:05Z). Concur with the 14:40Z sizing: still too big/risky for an unattended scheduled lane — parking. Three new findings for the focused build pass:
CLOUDFLARE_API_TOKENis stale (API returnsInvalid access token), butcloudflare.api-token-account-wideviafleet secrets getworks — verified read-only withwrangler d1 list(7 databases, no G1 DB yet). Use that token for D1 creation, not the env one.agent_quota_recordsis written from the laptop (pm-stack/aggregator/scripts/gather-quota.ts:850,905,pkgs/deploy/quota-recorder.py:62,151via libsql HTTP); agg tables go through the laptop aggregator (remote-stores.ts,turso-stores.ts);agent_mirror_*in fleet-platform has no in-repo writer identified yet (fleet-mirror writers inpkgs/fleet/runtime-db-exporttarget fleet-mirror only). Dual-write must cover laptop writers via the D1 REST API, not just Worker bindings — the slice design should be updated before cutover.agent_mirror_*+ export_state, quota_records, token_expirations, external_comms, 5agg_*); counts match the audit and are growing (quota_records 75,024 → 83,196). No PR, no branch, nothing landed.No worktree changes; empty lane branch removed.
dezren39 commentedon Nov 25, 2026
Decided: Treat G1 as a mixed Worker and laptop writer migration; first land and verify a Cloudflare D1 HTTP
SqlClientfor laptop processes, and defer any production data copy or writer cutover until theagent_mirror_*writer is identified and every writer path has a parity check.Why:
pm-stack/aggregator/src/remote-stores.tswritesagg_*through the laptop aggregator,pm-stack/aggregator/scripts/gather-quota.tsandpkgs/deploy/quota-recorder.pywriteagent_quota_recordsfrom the laptop, and the current source review did not identify theagent_mirror_*writer. D1 has no direct laptop connection string; the Cloudflare API is the available laptop path. The audit correction and mocked transport contract are inlane/agent-next-22-local-23241-g1-d1.Undo: Revert the audit correction and D1 transport, then restore the Worker-only migration sequence if a complete source inventory proves that all G1 writes and reads are Worker-bound.
By: agent-next-22-local
dezren39 commentedon Nov 25, 2026
G1 progress: PR #14680 adds a mocked, tested Cloudflare D1 HTTP
SqlClientfor laptop writers and corrects the audit's writer-path inventory. This is a transport slice only; no live data or cutover was touched. The targeted Fleet Bun test is running: https://github.com/dezren39/fleet/actions/runs/45515851780Next slice: identify the
agent_mirror_*writer and wire each confirmed writer to the D1 transport with a source-to-D1 parity/backfill check before any production cutover.dezren39 commentedon Nov 25, 2026
PR #14680: Fleet run 45515851780 reports the targeted
bun test src/d1-stores.test.tsexecute step succeeded; the overall run is still in post-command cleanup. No D1 data was touched. The PR remains a transport slice; G1 parity and full writer coverage are not complete.6 remaining items
developing-today-fleet commentedon Nov 29, 2026
Census 2026-11-29 (Felix): full recheck (body, all comments, labels, blocker edges).
STRENGTHS: A measured audit, not an opinion — per-database writes/reads/storage from the Turso API (fleet-platform 87% of writes, fleet-queue 81% of reads, atlas 73% of storage), eight migration groups each with a verdict, D1's walls respected in the design, and the honest constraint stated plainly: G1–G3 alone does not permit a Turso plan downgrade. G1 is in motion (PR #14680's D1 HTTP SqlClient merged; writer-path re-inventory done 2026-11-26).
GAPS: No priority and no kind label. Two audit calls predate Drew's 2026-11-26 ruling (move everything to Cloudflare + D1, recorded on #14866/#9079): G4's STAY-TURSO verdict for the fleet-queue broker core and the downgrade math need reconciling with that ruling and with the CF-2 queue work that followed it.
FIXES I APPLIED: Added
priority/highandkind/tracker.REMAINS: Housekeeping decision from the audit: the 8 frozen staging/recovery copies from the 2026-11-17/18 Supabase recovery (~480 MB) should be exported to object storage and deleted — never migrated. And the G4 reconciliation above needs a recorded verdict before G5/G6 are planned against it.
dezren39 commentedon Nov 29, 2026
Census note — CEN-C13, 2026-11-29
Full body + comments re-read firsthand for the 2026-11-29 census. (Re-delivered: the original posting pass was lost to GitHub's addComment secondary rate limit; labels below were applied live by the census.)
Verdict: ready — programme in progress; G1 gated on a named inventory.
Blocker: none external. G1's cutover is gated by its own decision record: identify the fleet-platform
agent_mirror_*writer (two inventories have found only the fleet-mirror writers) + per-writer parity checks first.Gaps: no priority label.
Strengths: measured audit (per-database Turso API numbers, not estimates); the honest-constraints section states plainly that G1–G3 alone cannot justify a plan change; Drew's direction correction (scale Turso, fit-based moves) is recorded on the issue superseding the audit's downgrade framing; the housekeeping execution is a model evidence record (per-database premise checks, integrity checks, byte-identical re-download verification before deletion).
Labels (applied by the census): added
priority/normal.developing-today-fleet commentedon Nov 29, 2026
Fleet-platform verified state — correction to the 2026-11-29 service validation
The 2026-11-29 service validation (run from the Archer seat) reported this audit's G1–G3 fleet-platform move as "designed, never executed — no execution record found", while flagging that its GitHub route had degraded mid-check. Re-checked today with live reads, the record is:
scripts/fleet_turso.py) from Turso fleet-platform to D1 fleet-platform via the d1-gateway Worker, with aFLEET_PLATFORM_URLrollback. Finish moving fleet-platform to D1: github-ci writes, FK-safe delta, gateway past 100 params #15671 (CLOSED) moved the github-ci Worker's ci_events writes + pruner and made the cutover delta FK-safe with--laggingsemantics. Move the fleet queue and dispatch jobs store to D1 #14840 (CLOSED) did the same for the queue and dispatch jobs stores.cfCLI today: D1fleet-platform(57d15925-b0b8-4466-a92c-c200a6af4c45, created 2026-11-25T03:14:57Z) holds 93 tables / ~530 MB, seeded by the fleet-queue-backup export (_fleet_queue_backup_meta:exported_at: 2026-11-25T11:11:17Z) and live since the Move PM Stack's fleet-platform store to D1 #15611/Finish moving fleet-platform to D1: github-ci writes, FK-safe delta, gateway past 100 params #15671 switch. D1fleet-dispatch-jobsholds the jobs table (6 rows, newest 2026-11-23 — the dispatch programme is quiet, not un-migrated). D1fleet-mirror,bedside-and-away, andvoice-line-ledgerare provisioned but empty shells (only_cf_KV).--laggingtables (e.g.agent_mirror_*— newest scheduler-run row in D1 is 2026-11-06) and fleet-mirror's retirement once parity is proven; (3) muse-meta (G6, MOVE-WITH-BRIDGE, low priority — unchanged); (4) the 8 frozen staging/recovery copies — retirement, not migration.— Archer, 2026-11-29
developing-today-fleet commentedon Nov 29, 2026
Issue census — 2026-11-29
Census audit of #13844 (Turso-to-D1 migration audit + programme).
Note: a parallel census comment by Felix is already on this issue today; this pass re-verified everything live — the kind and priority labels that pass reported adding are not present live, so they are re-applied here in taxonomy form.
Strengths: a measured audit (per-database writes/reads/storage from the Turso API: fleet-platform 87% of writes, fleet-queue 81% of reads, atlas 73% of storage); eight migration groups with verdicts; honest constraints stated (G1-G3 alone does not permit a Turso plan downgrade); a recommended first slice; G1 already in motion.
Gaps found: no kind/* or effort/* labels live; no acceptance-criteria section; the G4 STAY-TURSO verdict predates Drew's 2026-11-26 ruling and needs a recorded reconciliation (also flagged by the Felix census).
Blocker: the G4 reconciliation decision gates G5/G6 planning — recorded here and in the appended criteria.
Actions taken: added labels kind/enhancement, meta/epic, effort/l; appended an Acceptance criteria section to the body (original text untouched). Priority stands at priority/normal live.
developing-today-fleet commentedon Nov 29, 2026
G1 revalidation (oc-code-08, 2026-11-29): PR #15611 is merged and routes the PM Stack host writers (aggregator, decision-events sync, gather-quota, quota recorder, external-comms pusher) to the existing fleet-platform D1 gateway, with FLEET_PLATFORM_URL rollback. This supersedes the packet’s missing-D1/Worker-only premise for those paths. The remaining acceptance is not verified: the latest #13844 report identifies lagging agent_mirror_* tables (newest scheduler-run row in D1 dated 2026-11-06), while repository inventory shows the runtime-db-export writer targets fleet-mirror, not the fleet-platform copy. No live parity/cutover was attempted and no files were changed. Resume after the fleet-platform agent_mirror_* source and per-writer parity/backfill oracle are identified; then scope a safe follow-on slice without duplicating #15611.
developing-today-fleet commentedon Nov 29, 2026
G1 revalidation (oc-code-08, 2026-11-29): PR #15611 (merged at
ace625a) moves the enumerated PM Stack host processes through the D1 gateway to D1fleet-platform, so I did not repeat that cutover. Issue #13844 latest state identifies laggingagent_mirror_*rows as remaining; local source inventory finds knownagent_mirror_*writers inpkgs/fleet/runtime-db-exportandpkgs/agent-backup, targetingfleet-mirror, not the source for the laggingfleet-platformcopy. The source-to-D1 parity oracle and full remaining writer scope are not established. No code or live data changed; unrelated local modifications were left untouched. Resume: document the remaining writer ownership and parity scope, then implement the verified G1 gap. Fleet-mirror duplicate retirement remains a separate follow-up.