backups: scheduled-runs-and-verification — unattended snapshot, replicate, verify #88

Closed
opened 2026-07-25 04:59:22 +00:00 by ben · 1 comment
Owner

Parent

Feature spec: #20 (backups).

What to build

The scheduled run engine (P7-S2 → S3, ADR 0079) that makes recoverability independent of the operator's laptop being awake. When a confirmed policy's scheduled run fires, the backup orchestrator snapshots the dataset (through the port's snapshot verb), replicates to each target, and verifies by sampled restore test — running fleet-side, in the control plane, with every browser closed and the operator app off. Verification is what makes a copy count: when a run's snapshot passes its sampled restore test it is promoted to the dataset's last good and counted in coverage; when it fails verification it counts nowhere and the failure publishes a fault (CONTEXT: Sampled restore test, Last good). Retention never prunes a dataset's last good snapshot — the most recent verified snapshot is always kept until a newer one verifies, so however short the window a dataset is never left with nothing (DDR 0083). The runs-and-verification screen (P7-S3) shows the run progressing through its steps.

Every scheduled run lands a structured entry in the standing logging pipeline, attributed to the scheduler for automatic runs and drillable from the overview (ADR 0027). The engine is driven by the fake clock in the seam so schedules, verification promotion, and retention windows are asserted headlessly; per-target partial outcomes and the fault-publishing details are the next slice's concern.

Acceptance criteria

  • (story 11) Given a confirmed policy, when a scheduled run fires, then it snapshots the dataset, replicates to each target, and verifies by sampled restore test, running fleet-side with every browser closed and the operator app off.
  • (story 12) Given a run's snapshot, when its sampled restore test passes, then it is promoted to the dataset's last good and counted in coverage; when it fails verification, then it counts nowhere and the failure publishes a fault.
  • (story 14) Given any retention window however short, when retention prunes old snapshots, then the most recent verified snapshot is always kept until a newer one verifies.
  • (story 32) Given a scheduled run, then a structured audit entry lands attributed to the scheduler, drillable from the overview.

Blocked by

  • #86 — a confirmed policy is what a run executes

Task manifest

task: backups:scheduled-runs-and-verification
implements_flow: p7-backups
implements_edge: S2→S3, S3→S1
interface: backup orchestrator — scheduled run (snapshot verb → replicate to targets → verify-sample verb), promote verified snapshot to last good and into coverage, fail verification → counts nowhere + publish fault, retention prune that always keeps last good; audit entry per run
wireframe: docs/ux/wireframes/p7-backups/p7-s3-runs-and-verification.html
seam: backup orchestrator seam tests (control plane, Go) — fake clock (schedules, retention windows), fake port backup contracts (snapshot / verify-sample succeed or fail), fake targets, in-memory coverage state, in-memory audit ledger
acceptance:
  - given: a confirmed policy
    when: a scheduled run fires
    then: it snapshots, replicates to each target, and verifies by sampled restore test, fleet-side with the browser closed and operator app off
  - given: a run's snapshot
    when: its sampled restore test passes
    then: it is promoted to last good and counted in coverage
  - given: a run's snapshot
    when: it fails verification
    then: it counts nowhere and the failure publishes a fault
  - given: any retention window however short
    when: retention prunes old snapshots
    then: the most recent verified snapshot is always kept until a newer one verifies
  - given: a scheduled run
    then: a structured audit entry lands attributed to the scheduler, drillable from the overview
depends_on: [policy-confirm-and-edit]
out_of_scope:
  - story 13, 15–19 per-target outcomes, faults, staleness, gone targets — per-target-honesty-and-staleness's
  - stories 20–26 restore — the restore slices'
  - snapshot pinning (deferred); throttling / bandwidth shaping (out of scope)
needs_human_decision: []
## Parent Feature spec: #20 (backups). ## What to build The scheduled run engine (P7-S2 → S3, ADR 0079) that makes recoverability independent of the operator's laptop being awake. When a confirmed policy's scheduled run fires, the `backup` orchestrator **snapshots** the dataset (through the port's snapshot verb), **replicates** to each target, and **verifies by sampled restore test** — running fleet-side, in the control plane, with every browser closed and the operator app off. Verification is what makes a copy count: when a run's snapshot passes its sampled restore test it is promoted to the dataset's **last good** and counted in coverage; when it fails verification it counts **nowhere** and the failure publishes a fault (CONTEXT: *Sampled restore test*, *Last good*). Retention never prunes a dataset's **last good** snapshot — the most recent verified snapshot is always kept until a newer one verifies, so however short the window a dataset is never left with nothing (DDR 0083). The runs-and-verification screen (P7-S3) shows the run progressing through its steps. Every scheduled run lands a structured entry in the standing logging pipeline, attributed to the scheduler for automatic runs and drillable from the overview (ADR 0027). The engine is driven by the fake clock in the seam so schedules, verification promotion, and retention windows are asserted headlessly; per-target partial outcomes and the fault-publishing details are the next slice's concern. ## Acceptance criteria - [ ] (story 11) Given a confirmed policy, when a scheduled run fires, then it snapshots the dataset, replicates to each target, and verifies by sampled restore test, running fleet-side with every browser closed and the operator app off. - [ ] (story 12) Given a run's snapshot, when its sampled restore test passes, then it is promoted to the dataset's last good and counted in coverage; when it fails verification, then it counts nowhere and the failure publishes a fault. - [ ] (story 14) Given any retention window however short, when retention prunes old snapshots, then the most recent verified snapshot is always kept until a newer one verifies. - [ ] (story 32) Given a scheduled run, then a structured audit entry lands attributed to the scheduler, drillable from the overview. ## Blocked by - #86 — a confirmed policy is what a run executes ## Task manifest ```yaml task: backups:scheduled-runs-and-verification implements_flow: p7-backups implements_edge: S2→S3, S3→S1 interface: backup orchestrator — scheduled run (snapshot verb → replicate to targets → verify-sample verb), promote verified snapshot to last good and into coverage, fail verification → counts nowhere + publish fault, retention prune that always keeps last good; audit entry per run wireframe: docs/ux/wireframes/p7-backups/p7-s3-runs-and-verification.html seam: backup orchestrator seam tests (control plane, Go) — fake clock (schedules, retention windows), fake port backup contracts (snapshot / verify-sample succeed or fail), fake targets, in-memory coverage state, in-memory audit ledger acceptance: - given: a confirmed policy when: a scheduled run fires then: it snapshots, replicates to each target, and verifies by sampled restore test, fleet-side with the browser closed and operator app off - given: a run's snapshot when: its sampled restore test passes then: it is promoted to last good and counted in coverage - given: a run's snapshot when: it fails verification then: it counts nowhere and the failure publishes a fault - given: any retention window however short when: retention prunes old snapshots then: the most recent verified snapshot is always kept until a newer one verifies - given: a scheduled run then: a structured audit entry lands attributed to the scheduler, drillable from the overview depends_on: [policy-confirm-and-edit] out_of_scope: - story 13, 15–19 per-target outcomes, faults, staleness, gone targets — per-target-honesty-and-staleness's - stories 20–26 restore — the restore slices' - snapshot pinning (deferred); throttling / bandwidth shaping (out of scope) needs_human_decision: [] ```
Author
Owner

Done in 6dd0b0b (on origin/main). The P7-S2 → S3 scheduled run engine.

What shipped

  • internal/backup/run.go — Tick() clock-driven scheduler fires each confirmed policy's due 02:00 run fleet-side (browser closed, operator app off, ADR 0079): snapshot → replicate to each target → verify by sampled restore test through the port's new Snapshot/VerifySample verbs (ADR 0080).
  • story 11 — a due run snapshots, replicates, and verifies (TestScheduledRunSnapshotsReplicatesVerifies).
  • story 12 — a verified run promotes its snapshot to last good and counts in coverage (TestVerifiedRunPromotesToLastGoodAndCounts); a failed verification counts nowhere and publishes a verification-failed Fault with evidence for monitoring (TestFailedVerificationCountsNowhereAndPublishesFault, ADR 0081 — per-target/monitoring-edge detail is the next slice's).
  • story 14 — retention prune always keeps the most recent verified snapshot until a newer one verifies, however short the window (TestRetentionAlwaysKeepsLastGood, DDR 0083 §4).
  • story 32 — each run lands an AuditEntry attributed to ActorScheduler, drillable from the overview via the audit trail (TestScheduledRunAuditsToTheScheduler, ADR 0027).
  • P7-S3 screen BackupRunsScreen.vue renders the RunsView projection to the wireframe's data-field/data-status contract, composed under BackupsSurface (edge S2 → S3 on confirm, back → S1).

Evidence: 8 Go seam tests + 4 Vue tests; go test ./internal/backup green, go vet + gofmt clean; dashboard vitest 348 tests green, vue-tsc + eslint clean.

Out of scope (next slices): per-target partial outcomes / staleness / gone targets (S3x, DDR 0083 §1–3), the restore ladder, snapshot pinning.

Done in `6dd0b0b` (on `origin/main`). The P7-S2 → S3 scheduled run engine. **What shipped** - `internal/backup/run.go` — `Tick()` clock-driven scheduler fires each confirmed policy's due 02:00 run fleet-side (browser closed, operator app off, ADR 0079): snapshot → replicate to each target → verify by sampled restore test through the port's new `Snapshot`/`VerifySample` verbs (ADR 0080). - **story 11** — a due run snapshots, replicates, and verifies (`TestScheduledRunSnapshotsReplicatesVerifies`). - **story 12** — a verified run promotes its snapshot to last good and counts in coverage (`TestVerifiedRunPromotesToLastGoodAndCounts`); a failed verification counts **nowhere** and publishes a `verification-failed` Fault with evidence for monitoring (`TestFailedVerificationCountsNowhereAndPublishesFault`, ADR 0081 — per-target/monitoring-edge detail is the next slice's). - **story 14** — retention `prune` always keeps the most recent verified snapshot until a newer one verifies, however short the window (`TestRetentionAlwaysKeepsLastGood`, DDR 0083 §4). - **story 32** — each run lands an `AuditEntry` attributed to `ActorScheduler`, drillable from the overview via the audit trail (`TestScheduledRunAuditsToTheScheduler`, ADR 0027). - P7-S3 screen `BackupRunsScreen.vue` renders the `RunsView` projection to the wireframe's `data-field`/`data-status` contract, composed under `BackupsSurface` (edge S2 → S3 on confirm, back → S1). **Evidence:** 8 Go seam tests + 4 Vue tests; `go test ./internal/backup` green, go vet + gofmt clean; dashboard vitest 348 tests green, vue-tsc + eslint clean. **Out of scope (next slices):** per-target partial outcomes / staleness / gone targets (S3x, DDR 0083 §1–3), the restore ladder, snapshot pinning.
ben closed this issue 2026-07-26 00:57:37 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#88
No description provided.