Skip to content

impl(backups): mesh leg — general Turso DBs → R2 restic deltas on the 14-day rotation #13456

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 fleet-scale leg: extend the #13455 pattern to every remaining Turso database (class B — the ~39 general DBs beyond the platform set) so the whole Turso fleet rides the 14-day mesh cycle as restic deltas (stream-zstd) into the R2 restic-turso-mesh repository. The DB list is enumerated from turso db list at run time, never hard-coded, so new databases join the mesh automatically; per-user databases (#9083's tenancy design) join this same rotation when they arrive.

Terms (from the design)

  • Rotation: the class-B set is divided into 14 daily cohorts (2–3 DBs/day at today's count); each DB is snapshotted once per 14 days, cohort assignment stable by database name hash.
  • A DB whose export fails stays in a retry list for the next night and is named in the run record — a cohort miss must never be silent.
  • Retention in the R2 repo: keep-daily 7 / keep-weekly 8 / keep-monthly 12 (design §5), applied per DB via restic tags.
  • Turso plan wall respected: exports are reads; the 24 GB storage wall and PITR are unaffected. Delete Protection is already ON fleet-wide (2026-11-17, impl(atlas/fleet): backup mesh — all-Turso 14d restic-zstd to R2, R2/laptop/Drive mesh, D1+laptop DBs into Turso #9093 step-1 record).

Acceptance

  • One full 14-day rotation completes with every class-B DB snapshotted at least once; the rotation record (per-DB snapshot ids + dates) is posted on this issue.
  • Failure handling proven: a deliberately misnamed/removed DB in a test cohort surfaces in the run record and the watchdog, not as a silent skip.
  • Restore verification: one snapshot from each of three different cohorts restored to scratch targets; per-table row counts match the export manifests. Recorded on this issue.
  • Watchdog: cohort freshness (oldest unsnapshotted DB age) is visible to the laptop-backups: durable run record for pm-dashboard-backup + a freshness watchdog that names a stopped backup (design #1024, phase 3) #1841 laptop-backups watchdog, or the gap is filed as its own issue.
  • Schedule registry row updated in the implementation PR.

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 of #13456 complete (task 21372).

    The scope is class B: all non-platform Turso databases enumerated at runtime, assigned to stable cohorts across the 14-day rotation. The design's acceptance remains the full rotation record, failure visibility, three-cohort restore verification, watchdog freshness, and the schedule-registry row in the implementation PR.

    First implementation step: add a pure, testable cohort planner and date-driven machine-readable dry-run plan. It will exclude the class-A databases, derive assignments from the current inventory without hard-coding class B, and prove the assignment invariants with property-based tests. This establishes the rotation before live exports or R2 writes are wired in.

    Enqueued as feature-slice task 21384 in repo-health-code-pilot: deterministic class-B cohort planner. It owns the planner and targeted tests; export execution, retries/run records, watchdog integration, restore drills, and schedule wiring remain subsequent slices under #13456 / #13463.

    Design source: merged PR #13467, sections 2, 4, 8, and 9. No implementation or live backup operation was performed by this triage.

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Lane xaltha — slice 1 landed as PR #13505: deterministic class-B cohort planner (pkgs/cold-store-reaper/scripts/turso-mesh-cohorts.py + tests).

    It takes a runtime inventory, excludes the class-A set (fleet-queue, fleet-platform, atlas, reported not dropped), assigns every other DB to exactly one stable 14-day cohort (sha256(name)[:8] % 14), and emits the due cohort for a supplied date as a JSON dry-run plan. No exports, R2 writes, credentials, or schedule in this step.

    Verification: fleet queue dispatch is blocked by the TLS defect (#13185), so the narrow test run went through the fleet-command.yml fallback — https://github.com/developing-today/fleet/actions/runs/45221903407, success, 12 tests OK. (Full-package run 45220397601: all 12 new tests ok; its 1 failure + 32 errors are pre-existing test_cold_store.py failures — the runner image has no zstd binary — untouched by this change.)

    Next slices (exports, retry/run-record, watchdog, schedule) remain open under this issue.

  5. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Lane xaltha — queue task 21384 (slice 1: deterministic class-B cohort planner) was handed to this lane a second time, but the slice already landed as PR #13505 (branch xaltha/13456-cohort-planner, open, Codex review has no blocking findings). No duplicate implementation started; the queue task is being closed as already-delivered by #13505. Remaining for the slice is review/merge of #13505.

  6. added a commit that references this issue on Nov 24, 2026
  7. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged — slice 1 is in open PR #13505; remaining work is its review and merge

  8. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    Follow-on verdict (lane code-h, task 22698, 2026-11-24): slice 1 (cohort planner) is MERGED via PR #13505, so the next link is due.

  9. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: pr_opened
    task: 22764
    lane: oc-code-06

    Slice 2 PR #14211 opened: due-cohort export pass + run record with retry list (read-only, no R2 writes, no schedule). Tests: 39 OK across the cohort, class-A and export-pass suites. Done check (one pass run record + failure-injection run) is not yet recorded on this issue; that needs a live exporter run after merge.

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/featurestatus:in-reviewtask/small-fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions