Skip to content

fix(backups): watchdog reports mesh restore verification per leg and store (#13463) - #13671

Merged
dezren39 merged 1 commit into
mainfrom
lane/oc-code-03-13463
Nov 24, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane/oc-code-03-13463

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

First slice of #13463: the laptop-backups-watchdog gains a mesh job that reports restore verification, not just backup freshness.

 watchdog(maxAgeHours, jobs)
   (a) dashboard run record
   …
   (f) cold-store completion evidence
+  (g) mesh restore verification   FIXED_RESTORE_RECORDS/<leg>.<store>.json
+      per leg × store: missing / unreadable / result≠ok / future / stale
+      -> "leg=<leg> store=<store>: <verdict>"

Records are the rotation's durable evidence (design §9), one JSON per pair:

{"leg":"class-a","store":"r2","verified_at":"2026-11-20T12:00:00Z","result":"ok","detail":"scratch restore; row counts match manifest"}

Default legs class-a,class-b,replicate,class-d,class-e,embeds (class F is gated on #9094) and stores r2,laptop,drive, both env-overridable. Quarterly bound: 2200h.

Module: services.laptop-backups.watchdog.meshEnable (default false, so no host fails before rotation runners exist) adds mesh to watchdogJobs; meshMaxAgeHours sets the bound. No new timer/schedule is created in this slice, so doc/fleet-schedule-registry.md is intentionally unchanged.

Evidence

  • Before (on origin/main): the suite has no mesh scenarios and the script rejects mesh as an unknown job name (it would silently check nothing).
  • After (bash nixos/home/laptop-backups-watchdog.test.sh, all 56 assertions pass, including the new ones):
ok: mesh-rotation-fresh: watchdog exited 0
ok: mesh-stalled-leg: watchdog exited non-zero (1)
ok: mesh-stalled-leg: output names class-a
ok: mesh-stalled-leg: output names store=laptop
ok: mesh-failed-restore: watchdog exited non-zero (1)
ok: mesh-failed-restore: output names class-a
ok: mesh-missing-record: watchdog exited non-zero (1)
ok: mesh-missing-record: output names leg=embeds store=drive
laptop-backups-watchdog tests: all passed

The stalled-leg case is the acceptance demo: class-a/laptop verified 100 days ago while the other 17 pairs are 10 days old. nix-instantiate --parse nixos/home/laptop-backups.nix passes; bash -n and shellcheck -S warning clean on both scripts.

Not in this slice: the rotation runner that writes the records (cold-store-drill-style self-gating script + timer), the registry row that comes with it, and the corrupted-snapshot check — those stay on #13463 behind the leg issues' first verifications.

Merge Danger

Door: two-way — the mesh job is off by default; the only behavior change on enabled hosts is a new job name they must opt into.

Blast Radius: one script and its test, plus two optional module settings.

{
  "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-23T20:17:33Z",
    "session_id": "ses_e5df648f0e5ffejf6itcSx5WLs",
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/git/code-worktrees/oc-code-03-13463",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/git/code-worktrees/oc-code-03-13463",
      "repo": "developing-today/code",
      "branch": "lane/oc-code-03-13463",
      "sha": "089206098b9b6ab83986da2a1f1f1cf76b822b2e"
    },
    "auth_subject": "oc-code-04",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

See it in action
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…store (#13463)

Add a mesh job to laptop-backups-watchdog: every leg x store pair in
the backup mesh must have a successful restore-verification record no
older than a quarter, or the watchdog fails naming the leg and store.
The records are the rotation's durable evidence; a missing, unreadable,
failed, future or stale record is each named distinctly.

Add services.laptop-backups.watchdog.meshEnable (default false, so no
host fails before the rotation runners exist) and meshMaxAgeHours.

Test with a fresh 18-pair fixture, a deliberately stalled class-a/laptop
leg, a fresh-but-failed restore, and a missing embeds/drive record.

No schedule is created in this slice, so the schedule registry is
unchanged.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

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 20 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: 4dd083e7-caaf-4c8e-b948-d959b236e501
Commits

Reviewing files that changed from the base of the PR and between 375b974 and 0892060.

Files selected for processing: 3

  • nixos/home/laptop-backups-watchdog.sh
  • nixos/home/laptop-backups-watchdog.test.sh
  • nixos/home/laptop-backups.nix
  • 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

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

Labels

audit:partial PR partially implemented; gap filed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant