GeezerVison is showing github.com — impl(backups): mesh leg — D1 exports → Turso backup home (fleet-queue-backup D1 first) · Issue #13458 · developing-today/code
impl(backups): mesh leg — D1 exports → Turso backup home (fleet-queue-backup D1 first) #13458DescriptionParent: #9093 (backup mesh) · Program: #8983 · Design: doc/2026-11-23T16-34-18Z_design_backup_mesh/note.md (landed with the #9093 design PR).
House rules: any schedule this creates lands its doc/fleet-schedule-registry.md row in the same PR; secrets by name only (Bitwarden at runtime, repo-archive pattern); builds/tests run via remote dispatch, never on the laptop or sandbox.
Scope
The reverse-direction leg for Cloudflare D1: scheduled D1 exports land in a dedicated Turso database as their backup home, per the design's appropriateness line (§6) — D1 is SQL-shaped, small, and its native export is a SQL file, so a Turso home gives it PITR + the mesh's restic coverage for free. First tenant: the fleet-queue-backup D1 database created under #8584. The #8584 export timer (fleet-queue Turso → D1) is the opposite direction and is untouched by this leg; this leg protects the D1 side itself.
Terms (from the design)
- Cadence: weekly export of each in-scope D1 database, imported into its own Turso home DB (
d1-backup-<name>), replacing the prior import wholesale (the Turso home is a backup target, never a live read path).
- An export whose import fails leaves the previous import intact and is named in the run record.
- Out of scope by the appropriateness line: D1 databases that are themselves pure replicas of a Turso source (their source's mesh coverage is their backup) — each exclusion is recorded by name on this issue when the leg is implemented.
Acceptance
-
fleet-queue-backup D1 exported and imported into its Turso home on the weekly schedule; import record (row counts per table) posted on this issue.
- Restore verification: the D1 database is rebuilt from its Turso home into a scratch D1 (or local SQLite equivalent) and table row counts match the export. Recorded on this issue.
- The appropriateness line is applied explicitly: every D1 database in the account is listed on this issue as in-scope or excluded-with-reason.
- Schedule registry row updated in the implementation PR.
Activitydeveloping-today commented on Nov 23, 2026 dezren39 commented on Nov 23, 2026 Triage record — lane oc-code-07 (queue task 21374)
Verdict: live and ungated — route the first implementation step.
Scope check (fresh 2026-11-23): issue OPEN, no held/user/owned/do-not-merge/do-not-auto-edit labels. Design doc/2026-11-23T16-34-18Z_design_backup_mesh/note.md present on main; Class D (§4, §6, §10) fully specifies this leg. Parent #9093 priority/high. No gate: Class D is independent of the restic mesh legs (#13455–13457) and of #9094/#13462; #13463 (verification rotation) consumes this leg's output, it does not precede it. The #8584 Turso→D1 timer is explicitly untouched.
First step packet (route this): build the fleet-queue-backup pipeline — weekly scheduled D1 export → import into new Turso home d1-backup-fleet-queue-backup (wholesale replace; home is backup target, never live read path) → import record with per-table row counts posted here → first restore verification to a scratch target (row counts match export, never a production write, per §9) → doc/fleet-schedule-registry.md row in the same PR. House rules apply: secrets by name only, remote dispatch for builds/tests, schedule row in the same PR.
Second step (follow-on, not in the first packet): account-wide D1 inventory — list every D1 database, apply the §6 appropriateness line, record in-scope vs excluded-with-reason by name on this issue (covers acceptance item 3, including the pure-replica-of-Turso exclusion).
Acceptance carried from the issue: pipeline on weekly schedule with import record; restore verification recorded; full D1 list classified; registry row landed.
dezren39 commented on Nov 23, 2026 Claim — lane felix, 2026-11-23: starting the first-step packet routed by the triage of record (task 21374). Done check against origin/main: criteria for this leg are NOT landed — infra/fleet-queue-backup/ holds only the Turso -> D1 direction (#8584). Building the class-D pipeline here: weekly D1 export -> staged wholesale import into the Turso home d1-backup-fleet-queue-backup (a failed import leaves the previous import intact), import record in the home, restore-verification drill (home -> local SQLite, counts vs the import record), systemd weekly units + schedule-registry row in the same PR. The live provisioning + first live run/record/verification and the account-wide D1 inventory (step 2 of the triage packet) will be dispositioned exactly on this issue when the code lands. dezren39 commented on Nov 23, 2026
Picked up by felix — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while felix posts progress markers; after 30 minutes of silence any other worker may pick this up.) dezren39 commented on Nov 23, 2026 Lane felix — class D first packet landed in PR #13539 (not merged; Felix reviews/merges).
Landed: the D1 → Turso-home pipeline for the fleet-queue-backup D1 database — staged wholesale import into the new home d1-backup-fleet-queue-backup with emitted-count verification cross-checked against the source (a mid-run source move fails the run and leaves the previous import intact), a marker-witnessed swap with interrupted-swap recovery, an import record with per-table counts, a restore drill that rebuilds the database from the home alone into a local SQLite file and verifies counts against the record, the weekly systemd service/timer (Sun 03:40) with its registry row, and 9 hermetic tests. Suite evidence: fleet-command run 45230221803, conclusion success — 38 tests across the 9 files in infra/fleet-queue-backup/tests/ (7 new export tests + 3 new D1-home drill tests) plus test-export-arguments.sh all passing. Two earlier runs against the branch caught real defects in the new swap/recovery code; both are fixed in-branch with regression tests.. No new dependencies; fq_common.py/restore_drill.py untouched.
Remaining acceptance after the PR merges — the live leg (the #8584 pattern; needs provisioning, so it is not done from this seat):
- Provision the Turso database
d1-backup-fleet-queue-backup and mint the vault secret turso.d1-backup-fleet-queue-backup-rw-token (steps in the infra README/RUNBOOK).
- Install the units on the laptop (
systemd/install-units.sh) — until then the registry row reads declared-not-installed.
- First live run: post the import record (per-table counts) on this issue.
- Live restore verification from the home, recorded here.
Follow-on, explicitly not in this packet: step 2, the account-wide D1 inventory (acceptance item 3). dezren39 commented on Nov 23, 2026
Released by felix (outcome: free). Class D first packet landed in PR #13539 (unmerged, Felix reviews): D1-to-Turso-home pipeline, restore drill, weekly units + registry row, 38-test suite green (run 45230221803). Issue stays open for the live leg (provision home + vault token, laptop install, first live import record, live restore verification) and the step-2 D1 inventory follow-on. Disposition: issue comment 7109425269. dezren39 commented on Nov 23, 2026 Merged by Felix after review — PR #13539.
The Class D code packet: staged D1 → Turso-home import for the fleet-queue-backup database, with the swap committed behind a marker whose import_id must match the import record, the pre-swap live set carried in the marker so an interrupted swap rolls back precisely, and a restore drill that rebuilds from the home alone. I spot-checked the commit-witness logic in export_to_turso.py before merging. The weekly timer's registry row landed in the same PR per the schedule rule.
Evidence: full directory suite green on run 45230221803 (38 tests across 9 files + the argument checks). The two earlier red runs were the suite doing its job — they caught a staging-table swap defect and a rollback ordering defect, both fixed in-branch with a regression test.
#13458 stays open for the live leg, named on the issue: provision the Turso home, mint the vault token, install the units on the laptop, first live import + restore verification; step 2 (account-wide D1 inventory) follows. dezren39 commented on Nov 23, 2026 Lane xaltha — queue task 21385 (Class D step 1) was handed to this lane, but the step-1 code packet already landed and merged as PR #13539 (felix/13458-d1-turso-home, merged 2026-11-23T17:59:59Z): D1 → Turso-home pipeline, staged wholesale import, restore drill, weekly units + registry row. No duplicate implementation started; the queue task is being closed as already-delivered by merged #13539. What remains open on this issue is the live leg noted in the release comment (provision the Turso home, vault token, laptop install, first live import + import record) — that is follow-up work, not this step-1 packet. dezren39 commented on Nov 24, 2026
Triage pass (task 22316, lane oc-code-02, 2026-11-24)
Fresh state: issue open. The code packet is merged as PR #13539 (D1 → Turso home pipeline, staged import, restore drill, weekly units, registry row). Queue task 21385 was already closed as delivered by #13539.
Remaining, per the 2026-11-23 release comment: the live leg. That covers provisioning the Turso home, the vault token, the laptop install, and the first live import with its import record. These are hands-on steps and need a person's action on the vault and laptop.
Verdict: keep #13458 open for the live leg. No code change is needed in this pass. dezren39 commented on Nov 24, 2026 Re-triage confirmation (queue task 22700, follow-on of task 22316, 2026-11-24): no change since the 08:11Z triage pass. PR #13539 is MERGED (2026-11-23T17:59:59Z); queue task 21385 already closed as delivered by it; no queued/blocked queue items remain for this issue. Verdict stands: keep open for the live leg (provision Turso home, vault token, laptop install, first live import + import record) and the step-2 D1 inventory follow-on — both are hands-on vault/laptop steps, not code a lane can run, so no new packet routed. developing-today-fleet commented on Nov 25, 2026
Evidence for this leg's remaining step, recorded during the #14302 fix (2026-11-25):
- The weekly d1-home units are now installed from the dedicated service-owned checkout (
~/.local/share/fleet-queue-backup/repo, following main per PR fix(backups): backup units update their service-owned checkout to main before running #15025) and the timer is enabled: next fire Sun 2026-11-29 03:43 CST.
- The leg's token,
turso.d1-backup-fleet-queue-backup-rw-token, is absent from the secrets store — verified by name via fleet secrets list (257 entries) on 2026-11-25. The export leg's tokens (turso.fleet-queue-rw-token, cloudflare.api-token-account-wide) are present.
- So the d1-home service will fail at its first fire until the Turso home
d1-backup-fleet-queue-backup is provisioned and that token is minted — the provisioning step this issue still owns. The failure will be visible through the unit-failure notification, not silent.
developing-today-fleet commented on Nov 26, 2026 Triage recheck (2026-11-26, task 24336): #13458 remains OPEN. Code acceptance for the first leg is already in merged PR #13539 (weekly D1→Turso-home pipeline, restore drill, and registry row); the timer was subsequently installed and enabled from the service-owned checkout (evidence in the 2026-11-25 comment; next fire Sun 2026-11-29 03:43 CST). Fresh fleet secrets list still does not contain turso.d1-backup-fleet-queue-backup-rw-token, so the live service cannot yet authenticate to the Turso home. Resume condition: provision d1-backup-fleet-queue-backup and mint/store its write token under that exact secret name; then run the service, record the per-table import counts, and perform the restore drill. Account-wide D1 inventory/classification remains afterward. This is a hands-on provisioning/credential step, not a code gap; no new code packet was filed.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|