Skip to content

impl(backups): mesh leg — D1 exports → Turso backup home (fleet-queue-backup D1 first) #13458

Open

Description

@dezren39

Parent: #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.

Acceptance criteria

  • Delivered: Impl(backups): mesh leg — D1 exports → Turso backup home (fleet-queue-backup D1 first) — the outcome named in the title is demonstrably in place.
  • The implementation matches the scope, design record, and constraints stated in this issue body; no stated scope is silently dropped.
  • Verification evidence is recorded on this issue (tests run, commands executed, or measurement output), naming what was checked.
  • Any follow-on gaps found during the work are filed as their own issues and linked from this issue.

Activity

  1. added
    kind/feature
    task/small-fix
    epic/atlas-program
    on Nov 23, 2026
  2. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    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.

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    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.

  5. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    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.)

  6. added
    queue/claimed
    work/assigned
    on Nov 23, 2026
  7. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    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):

    1. 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).
    2. Install the units on the laptop (systemd/install-units.sh) — until then the registry row reads declared-not-installed.
    3. First live run: post the import record (per-table counts) on this issue.
    4. 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).

  8. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    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.

  9. 8 remaining items

  10. developing-today-fleet commented on Nov 25, 2026

    @developing-today-fleet
    Contributor

    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.
  11. developing-today-fleet commented on Nov 26, 2026

    @developing-today-fleet
    Contributor

    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.

  12. added
    queue/parked
    and removed
    queue/queued
    on Nov 26, 2026
  13. added
    priority/high
    status/parked
    and removed on Nov 29, 2026
  14. dezren39 commented on Nov 29, 2026

    @dezren39
    MemberAuthor

    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: blocked — code complete; a provisioning/credential step remains.

    Blocker: the Turso home d1-backup-fleet-queue-backup is not provisioned and the secret turso.d1-backup-fleet-queue-backup-rw-token is absent from the secrets store. The installed weekly timer (Sun 03:40, first fire 2026-11-29 03:43 CST) fails at fire until both exist. This is a hands-on provisioning step, not a code gap. After it: first live import record, live restore verification, and the step-2 account-wide D1 inventory.

    Gaps: no priority label; stale status:in-review (code merged 2026-11-23 via PR #13539, nothing in review); the live blocker was spread across three triage passes.
    Strengths: exemplary body (scope, design terms, 4 checkable acceptance items); merged PR #13539 evidence is complete (38-test suite, run 45230221803); the missing-token finding was verified by name against fleet secrets list twice (2026-11-25, 2026-11-26).

    Labels (applied by the census): added priority/high (parent #9093 is high; live timer failing at fire), added status/parked, removed stale status:in-review.

  15. added
    priority/normal
    and removed
    priority/high
    on Nov 29, 2026
  16. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Priority validation 2026-11-29 (Felix): priority/high → priority/normal — this is one mesh leg of the same class as its sibling legs #13455/#13456/#13457, which sit at normal; its code is complete (PR #13539) and the remainder is a provisioning step (Turso home + token), and being blocked does not raise a band.

  17. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Issue census — 2026-11-29

    Audited live on 2026-11-29 against the house label taxonomy: details, labels, blockers, priority.

    Gaps found: no ## Acceptance criteria section in the body
    Strengths found: detailed body with scope and context a picker-up can start from; links a parent issue and/or design record; active discussion: 14 recent comment(s) skimmed
    Comment skim: comments mention blocking (14 comments in the latest page).
    Actions taken by the census: appended ## Acceptance criteria section to the body (original text unchanged).

    Priority checked: the current priority label matches the census priority bands; no reprioritization made.

  18. developing-today-fleet commented on Nov 30, 2026

    @developing-today-fleet
    Contributor

    Link from lane 0900-FT (xaltha), 2026-11-30: the #17628 pilot slice (first database of this leg) lands its runbook/design record as PR #17641 — doc/2026-11-30_pilot_fleet-queue-backup-d1-turso-home.md — covering export mechanics, the d1-backup-<name> home convention + staged import/integrity record, restore verification via restore_drill_d1_home.py, the appropriateness reason test for the next D1 database, and cadence/retention + watchdog failure surfacing. The live first export + drill is filed as follow-on #17640 (only gate: provision the home + mint the turso.d1-backup-fleet-queue-backup-rw-token vault entry).

  19. developing-today-fleet commented on Nov 30, 2026

    @developing-today-fleet
    Contributor

    Mesh slice landed for review — lane 0900-FN (xaltha), 2026-11-30. #17628 (the fleet-queue-backup pilot slice of this leg) is carried by PR #17645: runbook/design record at doc/2026-11-30_runbook_fleet-queue-backup-turso-home/main.md covering export mechanics, the d1-backup-<name> home + staged import + import-record integrity, restore verification, the §6 appropriateness line applied to this DB, and cadence/retention/failure surfacing. The live first export is filed as follow-on #17643 (home provisioning + token mint + first verified import + drill), since the home d1-backup-fleet-queue-backup is not yet provisioned.

  20. developing-today-fleet commented on Nov 30, 2026

    @developing-today-fleet
    Contributor

    Correction to my note above (lane 0900-FN): the #17628 runbook slice was landed by lane 0900-FT as PR #17641 (MERGED, merge commit 744cf8d) — my PR #17645 was a three-second claim-race duplicate and is closed unmerged. The live-leg follow-on of record is #17640 (FT's), not my #17643 (closed as duplicate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic/atlas-programkind/featurepriority/normalqueue/parkedstatus/parkedtask/small-fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions