backups: restore-in-place-replaces — deliberate REPLACES restore with a fallback snapshot #91

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

Parent

Feature spec: #20 (backups).

What to build

The deliberate in-place restore path (P7-S4 → S4x → S5, DDR 0084). Opening Restore for a dataset offers a moment picker of verified snapshots only — snapshots that passed their sampled restore test — so the operator never gambles current data on an unproven copy. Choosing to restore in place (replacing current data) promotes to a destructive confirm using the trigger word REPLACES (the third word beside ERASES and LOSES, ADR 0060 family): the confirm names what is destroyed in the community's own terms — e.g. "Replaces Files & documents on rimu with the snapshot from yesterday 02:00 — everything members added or changed since then will be gone" — with action Replace & restore, and states headroom needs when space is tight.

Confirming Replace & restore has the engine first take a pre-restore snapshot of the current data (outside the retention schedule, kept until the restore verifies), then quiesce the service on its port's terms (pause → replace → resume → verify) and run the restore, logged. A restore ends at verify, like a run: when the restored data passes the dataset's own verify-sample the restore is called done and the overview refreshes (P7-S5 → S1); a half-applied restore is never reported as success. If an in-place restore fails partway (P7-S5 → S5x) the service is restored from the pre-restore snapshot so it comes back on the data it had, the failure is named and retryable, and nothing half-applied is called done; retrying lets the operator restore from the same snapshot or pick another verified moment. Every restore, including the REPLACES path, is audit-logged, attributed to the operator, drillable from the overview (ADR 0027).

Notes: the REPLACES trigger and the pre-restore snapshot are agent-invented machinery Ben kept at sign-off. This restore machinery is invoked by rescue's ladder rung and Tier-3 data return — the running engine stays backups' while the control plane is up.

Acceptance criteria

  • (story 20) Given I open Restore for a dataset, when I pick a moment, then only snapshots that passed their sampled restore test are offered.
  • (story 21) Given I choose to restore in place (replacing current data), when I proceed, then a destructive confirm (trigger word REPLACES, beside ERASES and LOSES) names what is destroyed in the community's own terms, with action Replace & restore, and states headroom needs when space is tight.
  • (story 22) Given I confirm Replace & restore, when the restore begins, then the engine first snapshots the current data (outside the retention schedule, kept until the restore verifies), then quiesces the service on its port's terms (pause → replace → resume → verify) and runs the restore, logged.
  • (story 24) Given a restore is running, when the restored data passes the dataset's own verify-sample, then the restore is called done and the overview refreshes — a restore ends at verify, like a run.
  • (story 25) Given an in-place restore fails partway, when the failure occurs, then the service is restored from the pre-restore snapshot, the failure is named and retryable, and nothing half-applied is called done.
  • (story 26) Given a restore that failed partway, when I retry, then I can restore from the same snapshot or pick another verified moment.
  • (story 32) Given a restore (including REPLACES), then a structured audit entry lands attributed to the operator, drillable from the overview.

Blocked by

  • #88 — verified snapshots are what restore offers

Task manifest

task: backups:restore-in-place-replaces
implements_flow: p7-backups
implements_edge: S1→S4, S4→S4x, S4x→S5, S5→S1, S5→S5x, S5x→S4
interface: "backup orchestrator \u2014 restore moment picker (verified snapshots only), in-place restore = REPLACES confirm \u2192 pre-restore snapshot \u2192 quiesce (port terms: pause/replace/resume/verify) \u2192 run \u2192 verify-before-done, fail-partway rollback to pre-restore snapshot + retry; audit entry per restore"
wireframe:
  - docs/ux/wireframes/p7-backups/p7-s4-restore.html
  - docs/ux/wireframes/p7-backups/p7-s4x-restore-confirm-replaces.html
  - docs/ux/wireframes/p7-backups/p7-s5-restore-running-verified.html
  - docs/ux/wireframes/p7-backups/p7-s5x-restore-failed-partway.html
seam: backup orchestrator seam tests (control plane, Go) — fake port restore/verify-sample verbs (incl. quiesce, hang/fail partway), fake targets, in-memory coverage state, in-memory audit ledger
acceptance:
  - given: I open Restore for a dataset
    when: I pick a moment
    then: only snapshots that passed their sampled restore test are offered
  - given: I choose in-place restore
    when: I proceed
    then: a REPLACES destructive confirm names what is destroyed in the community's terms, action `Replace & restore`, headroom stated when space is tight
  - given: I confirm Replace & restore
    when: the restore begins
    then: the engine first takes a pre-restore snapshot (outside retention, kept until verify), quiesces on the port's terms, and runs the restore, logged
  - given: a restore is running
    when: the restored data passes verify-sample
    then: it is called done and the overview refreshes — a restore ends at verify
  - given: an in-place restore fails partway
    then: the service is restored from the pre-restore snapshot, the failure is named and retryable, nothing half-applied is called done
  - given: a restore that failed partway
    when: I retry
    then: I can restore from the same snapshot or pick another verified moment
  - given: a restore including REPLACES
    then: a structured audit entry lands attributed to the operator
depends_on: [scheduled-runs-and-verification]
out_of_scope:
  - story 23 alternate-device restore — restore-alternate-device's
  - member self-service restore (out of scope — operator act in v1)
  - the running Tier-3 rebuild engine — rescue's (invokes this machinery)
needs_human_decision: []
## Parent Feature spec: #20 (backups). ## What to build The deliberate in-place restore path (P7-S4 → S4x → S5, DDR 0084). Opening Restore for a dataset offers a moment picker of **verified snapshots only** — snapshots that passed their sampled restore test — so the operator never gambles current data on an unproven copy. Choosing to restore **in place** (replacing current data) promotes to a destructive confirm using the trigger word **REPLACES** (the third word beside ERASES and LOSES, ADR 0060 family): the confirm names what is destroyed in the community's own terms — e.g. "Replaces Files & documents on rimu with the snapshot from yesterday 02:00 — everything members added or changed since then will be gone" — with action `Replace & restore`, and states headroom needs when space is tight. Confirming Replace & restore has the engine first take a **pre-restore snapshot** of the current data (outside the retention schedule, kept until the restore verifies), then **quiesce** the service on its port's terms (pause → replace → resume → verify) and run the restore, logged. A restore ends at **verify**, like a run: when the restored data passes the dataset's own verify-sample the restore is called done and the overview refreshes (P7-S5 → S1); a half-applied restore is never reported as success. If an in-place restore fails partway (P7-S5 → S5x) the service is restored from the **pre-restore snapshot** so it comes back on the data it had, the failure is named and retryable, and nothing half-applied is called done; retrying lets the operator restore from the same snapshot or pick another verified moment. Every restore, including the REPLACES path, is audit-logged, attributed to the operator, drillable from the overview (ADR 0027). Notes: the REPLACES trigger and the pre-restore snapshot are agent-invented machinery Ben kept at sign-off. This restore machinery is invoked by rescue's ladder rung and Tier-3 data return — the running engine stays backups' while the control plane is up. ## Acceptance criteria - [ ] (story 20) Given I open Restore for a dataset, when I pick a moment, then only snapshots that passed their sampled restore test are offered. - [ ] (story 21) Given I choose to restore in place (replacing current data), when I proceed, then a destructive confirm (trigger word REPLACES, beside ERASES and LOSES) names what is destroyed in the community's own terms, with action `Replace & restore`, and states headroom needs when space is tight. - [ ] (story 22) Given I confirm Replace & restore, when the restore begins, then the engine first snapshots the current data (outside the retention schedule, kept until the restore verifies), then quiesces the service on its port's terms (pause → replace → resume → verify) and runs the restore, logged. - [ ] (story 24) Given a restore is running, when the restored data passes the dataset's own verify-sample, then the restore is called done and the overview refreshes — a restore ends at verify, like a run. - [ ] (story 25) Given an in-place restore fails partway, when the failure occurs, then the service is restored from the pre-restore snapshot, the failure is named and retryable, and nothing half-applied is called done. - [ ] (story 26) Given a restore that failed partway, when I retry, then I can restore from the same snapshot or pick another verified moment. - [ ] (story 32) Given a restore (including REPLACES), then a structured audit entry lands attributed to the operator, drillable from the overview. ## Blocked by - #88 — verified snapshots are what restore offers ## Task manifest ```yaml task: backups:restore-in-place-replaces implements_flow: p7-backups implements_edge: S1→S4, S4→S4x, S4x→S5, S5→S1, S5→S5x, S5x→S4 interface: "backup orchestrator \u2014 restore moment picker (verified snapshots only), in-place restore = REPLACES confirm \u2192 pre-restore snapshot \u2192 quiesce (port terms: pause/replace/resume/verify) \u2192 run \u2192 verify-before-done, fail-partway rollback to pre-restore snapshot + retry; audit entry per restore" wireframe: - docs/ux/wireframes/p7-backups/p7-s4-restore.html - docs/ux/wireframes/p7-backups/p7-s4x-restore-confirm-replaces.html - docs/ux/wireframes/p7-backups/p7-s5-restore-running-verified.html - docs/ux/wireframes/p7-backups/p7-s5x-restore-failed-partway.html seam: backup orchestrator seam tests (control plane, Go) — fake port restore/verify-sample verbs (incl. quiesce, hang/fail partway), fake targets, in-memory coverage state, in-memory audit ledger acceptance: - given: I open Restore for a dataset when: I pick a moment then: only snapshots that passed their sampled restore test are offered - given: I choose in-place restore when: I proceed then: a REPLACES destructive confirm names what is destroyed in the community's terms, action `Replace & restore`, headroom stated when space is tight - given: I confirm Replace & restore when: the restore begins then: the engine first takes a pre-restore snapshot (outside retention, kept until verify), quiesces on the port's terms, and runs the restore, logged - given: a restore is running when: the restored data passes verify-sample then: it is called done and the overview refreshes — a restore ends at verify - given: an in-place restore fails partway then: the service is restored from the pre-restore snapshot, the failure is named and retryable, nothing half-applied is called done - given: a restore that failed partway when: I retry then: I can restore from the same snapshot or pick another verified moment - given: a restore including REPLACES then: a structured audit entry lands attributed to the operator depends_on: [scheduled-runs-and-verification] out_of_scope: - story 23 alternate-device restore — restore-alternate-device's - member self-service restore (out of scope — operator act in v1) - the running Tier-3 rebuild engine — rescue's (invokes this machinery) needs_human_decision: [] ```
Author
Owner

Done in 1ab2728 (on origin/main).

The deliberate in-place REPLACES restore (P7-S4x → S5 / S5x, DDR 0084):

  • Seam (internal/backup/restore_inplace.go): Orchestrator.RestoreConfirm composes the REPLACES confirm (trigger word beside ERASES and LOSES) naming what is destroyed in the community's terms + headroom line; Orchestrator.RestoreInPlace takes a pre-restore snapshot (outside retention, never in the ledger, kept until verify), quiesces on the port's terms (pause → replace → resume → verify via new Quiesce/Resume/RestoreInPlace/Headroom port verbs), runs the restore and ends at verify; a fail-partway (in-place verb stops, or verify does not check out) rolls back to the pre-restore snapshot, names the failure, is retryable, and never calls a half-applied restore done. Every restore, verified or failed, is audited to the operator (ADR 0027). Tight headroom refuses with ErrInsufficientHeadroom before touching the service.
  • Screens: dashboard/src/components/backups/BackupRestoreReplacesScreen.vue (S4x confirm → S5 running/verified → S5x failed-partway), composed under BackupsSurface; the S4 picker's in-place choice now carries the chosen verified moment through to the confirm.
  • Tests: internal/backup/restore_inplace_test.go (9 seam tests — confirm/headroom, snapshot-first+quiesce+verify, fail-partway rollback, verify-fail rollback, retry, audit, guards); dashboard/tests/unit/backupRestoreReplaces.test.ts (7 component tests). go test ./... green; dashboard vitest 366 pass; vue-tsc + eslint clean.

All acceptance clauses (stories 20/21/22/24/25/26/32) satisfied. Out of scope untouched: alternate-device restore (#92), the running Tier-3 rebuild engine (rescue's).

Done in `1ab2728` (on `origin/main`). The deliberate in-place REPLACES restore (P7-S4x → S5 / S5x, DDR 0084): - **Seam** (`internal/backup/restore_inplace.go`): `Orchestrator.RestoreConfirm` composes the REPLACES confirm (trigger word beside ERASES and LOSES) naming what is destroyed in the community's terms + headroom line; `Orchestrator.RestoreInPlace` takes a **pre-restore snapshot** (outside retention, never in the ledger, kept until verify), **quiesces** on the port's terms (pause → replace → resume → verify via new `Quiesce`/`Resume`/`RestoreInPlace`/`Headroom` port verbs), runs the restore and **ends at verify**; a fail-partway (in-place verb stops, or verify does not check out) rolls back to the pre-restore snapshot, names the failure, is retryable, and never calls a half-applied restore done. Every restore, verified or failed, is audited to the operator (ADR 0027). Tight headroom refuses with `ErrInsufficientHeadroom` before touching the service. - **Screens**: `dashboard/src/components/backups/BackupRestoreReplacesScreen.vue` (S4x confirm → S5 running/verified → S5x failed-partway), composed under `BackupsSurface`; the S4 picker's in-place choice now carries the chosen verified moment through to the confirm. - **Tests**: `internal/backup/restore_inplace_test.go` (9 seam tests — confirm/headroom, snapshot-first+quiesce+verify, fail-partway rollback, verify-fail rollback, retry, audit, guards); `dashboard/tests/unit/backupRestoreReplaces.test.ts` (7 component tests). `go test ./...` green; dashboard vitest 366 pass; vue-tsc + eslint clean. All acceptance clauses (stories 20/21/22/24/25/26/32) satisfied. Out of scope untouched: alternate-device restore (#92), the running Tier-3 rebuild engine (rescue's).
ben closed this issue 2026-07-26 01:54:57 +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#91
No description provided.