backups: restore-and-coverage-fixes — verify before resume in-place; coverage gates on source health (#91/#82) #118

Closed
opened 2026-07-26 19:41:07 +00:00 by ben · 1 comment
Owner

Parent

Feature spec: #20 (backups). Follow-up filed by the 2026-07-26 review sweep (code-review Standards/Spec + design-verify Design axes over 6596977..9e946b7). Two seam defects:

  1. Restore-in-place write-loss window (#91) — internal/backup/restore_inplace.go:271-299 resumes the service before VerifySample; on verify failure the pre-restore snapshot rolls back onto the running, un-quiesced service, silently destroying member writes made in the resume→verify window. Port contract (backup.go:106): "data is only replaced while quiesced".
  2. Coverage gate keys on the wrong signal (#82 story 31) — internal/backup/coverage.go:312 gates on the target node's backup-copy job instead of the dataset's source service health; the tests encode the wrong reading.

Acceptance criteria

  • Given an in-place restore whose verify fails, then no member write is lost: verify runs before resume (or the service is re-quiesced before rollback), with a test on the verify-failure path.
  • Given restore-in-place, data is only ever replaced while quiesced — the port contract holds on every path.
  • Given coverage evaluation, the gate reads the dataset's source service health per #82 story 31, and the tests assert the correct signal.

Blocked by

None.

Task manifest

task: backups:restore-and-coverage-fixes
implements_flow: p7-backups
implements_edge: "restore-in-place verify-failure path; coverage gate signal"
wireframe: docs/ux/wireframes/p7-backups/p7-s1-backups-overview.html
interface: "ordering fix in internal/backup restore-in-place + coverage-gate signal fix; screens unchanged"
seam: "Go tests: verify-failure loses no writes; quiesce contract asserted; coverage gate reads source health"
acceptance: "see Acceptance criteria above"
depends_on: []
out_of_scope: [restore-replaces flow (built), export (built), policy semantics]
needs_human_decision: []
## Parent Feature spec: #20 (backups). Follow-up filed by the 2026-07-26 review sweep (code-review Standards/Spec + design-verify Design axes over `6596977..9e946b7`). Two seam defects: 1. **Restore-in-place write-loss window (#91)** — `internal/backup/restore_inplace.go:271-299` resumes the service *before* `VerifySample`; on verify failure the pre-restore snapshot rolls back onto the running, un-quiesced service, silently destroying member writes made in the resume→verify window. Port contract (`backup.go:106`): "data is only replaced while quiesced". 2. **Coverage gate keys on the wrong signal (#82 story 31)** — `internal/backup/coverage.go:312` gates on the target node's `backup-copy` job instead of the dataset's source service health; the tests encode the wrong reading. ## Acceptance criteria - [ ] Given an in-place restore whose verify fails, then no member write is lost: verify runs before resume (or the service is re-quiesced before rollback), with a test on the verify-failure path. - [ ] Given restore-in-place, data is only ever replaced while quiesced — the port contract holds on every path. - [ ] Given coverage evaluation, the gate reads the dataset's source service health per #82 story 31, and the tests assert the correct signal. ## Blocked by None. ## Task manifest ```yaml task: backups:restore-and-coverage-fixes implements_flow: p7-backups implements_edge: "restore-in-place verify-failure path; coverage gate signal" wireframe: docs/ux/wireframes/p7-backups/p7-s1-backups-overview.html interface: "ordering fix in internal/backup restore-in-place + coverage-gate signal fix; screens unchanged" seam: "Go tests: verify-failure loses no writes; quiesce contract asserted; coverage gate reads source health" acceptance: "see Acceptance criteria above" depends_on: [] out_of_scope: [restore-replaces flow (built), export (built), policy semantics] needs_human_decision: [] ```
Author
Owner

Done in 2d8c313 (on origin/main).

#91 — in-place restore write-loss window: RestoreInPlace resumed the service before VerifySample, so on verify failure the pre-restore-snapshot rollback replaced live data on the running, un-quiesced service — silently destroying any member write made in the resume→verify window (violating the port contract backup.go: "data is only replaced while quiesced"). rollbackInPlace now takes a running flag and RE-QUIESCES before the fallback replace on the verify-failure path. The fake port now tracks a paused state and records any replace-while-running; new seam test TestRestoreInPlaceVerifyFailureLosesNoWrite asserts that window is empty and the rollback still falls back to the pre-restore snapshot. Verified red-then-green (the test fails when the re-quiesce is removed).

#82 story 31 / #73 story 16 — coverage gated on the wrong signal: copyCounts gated a copy on the TARGET node's backup-copy job. Coverage now gates each dataset on its SOURCE service health on the home (new sourceHealthy; Identity control-plane exempt) — a failed source claims no coverage anywhere and the data it protects still shows as an open gap. Story-31 test rewritten (TestFailedSourceServiceClaimsNoCoverage) to assert the source signal and that target health is not it; the run/restore/rebuild seams now health-pass the source service; the now-unused backupCopyService const was removed.

All acceptance clauses met. Full Go test suite + go vet ./internal/backup/ pass. Evidence: internal/backup/{restore_inplace,coverage,backup}.go + tests; STATUS.md updated in the same commit.

Done in `2d8c313` (on `origin/main`). **#91 — in-place restore write-loss window:** `RestoreInPlace` resumed the service before `VerifySample`, so on verify failure the pre-restore-snapshot rollback replaced live data on the *running, un-quiesced* service — silently destroying any member write made in the resume→verify window (violating the port contract `backup.go`: "data is only replaced while quiesced"). `rollbackInPlace` now takes a `running` flag and RE-QUIESCES before the fallback replace on the verify-failure path. The fake port now tracks a `paused` state and records any replace-while-running; new seam test `TestRestoreInPlaceVerifyFailureLosesNoWrite` asserts that window is empty and the rollback still falls back to the pre-restore snapshot. Verified red-then-green (the test fails when the re-quiesce is removed). **#82 story 31 / #73 story 16 — coverage gated on the wrong signal:** `copyCounts` gated a copy on the TARGET node's `backup-copy` job. Coverage now gates each dataset on its SOURCE service health on the home (new `sourceHealthy`; Identity control-plane exempt) — a failed source claims no coverage anywhere and the data it protects still shows as an open gap. Story-31 test rewritten (`TestFailedSourceServiceClaimsNoCoverage`) to assert the source signal and that target health is *not* it; the run/restore/rebuild seams now health-pass the source service; the now-unused `backupCopyService` const was removed. All acceptance clauses met. Full Go test suite + `go vet ./internal/backup/` pass. Evidence: `internal/backup/{restore_inplace,coverage,backup}.go` + tests; STATUS.md updated in the same commit.
ben closed this issue 2026-07-26 20:42:04 +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.

Dependencies

No dependencies set.

Reference
Matou/idss#118
No description provided.