backup: the in-place restore rollback asserts a success it never observed, and audit writes are discarded under Logged: true #280

Closed
opened 2026-08-05 23:09:50 +00:00 by ben · 1 comment
Owner

Two dishonest assertions in the destructive-restore path:

  1. internal/backup/restore_inplace.go:305-323 — rollbackInPlace discards all three verbs' errors (_ = Quiesce, _ = RestoreInPlace(… preRef), _ = Resume) then unconditionally appends a stage marked Done: true ("Fell back to the pre-restore snapshot … resumed on the data it had before the restore") and sets RolledBack = true. If the fallback replace fails, the operator is told their data was rolled back while the dataset still holds the half-applied restore — or the service is left quiesced. Silent data loss behind a reassuring message.
  2. restore_inplace.go:380, internal/backup/run.go:312, internal/backup/pertarget.go:366 — _, _ = o.audit.Record(…) while InPlaceRestoreResult.Logged is set true unconditionally (restore_inplace.go:221, documented "always true"). The sink is a real durable file write that genuinely fails (internal/member/auditfile.go:32-43). The same package already checks the identical call at pertarget.go:673 and :717.

Acceptance

  • Rollback stages report what was observed: each failed verb yields a failed stage and RolledBack reflects reality; the reassuring copy only renders when the fallback replace succeeded.
  • Audit Record errors are propagated (or at minimum flip Logged false and surface a fault) at all three sites, matching pertarget.go:673's idiom.
  • Tests: failing rollback port ⇒ failed stage + RolledBack == false; failing audit sink ⇒ result does not claim Logged.

Filed from the 2026-08-05 fail-loud audit (three-agent pre-production sweep; findings verified against code).

Two dishonest assertions in the destructive-restore path: 1. `internal/backup/restore_inplace.go:305-323` — `rollbackInPlace` discards all three verbs' errors (`_ = Quiesce`, `_ = RestoreInPlace(… preRef)`, `_ = Resume`) then unconditionally appends a stage marked `Done: true` ("Fell back to the pre-restore snapshot … resumed on the data it had before the restore") and sets `RolledBack = true`. If the fallback replace fails, the operator is told their data was rolled back while the dataset still holds the half-applied restore — or the service is left quiesced. Silent data loss behind a reassuring message. 2. `restore_inplace.go:380`, `internal/backup/run.go:312`, `internal/backup/pertarget.go:366` — `_, _ = o.audit.Record(…)` while `InPlaceRestoreResult.Logged` is set true unconditionally (`restore_inplace.go:221`, documented "always true"). The sink is a real durable file write that genuinely fails (`internal/member/auditfile.go:32-43`). The same package already checks the identical call at `pertarget.go:673` and `:717`. **Acceptance** - Rollback stages report what was observed: each failed verb yields a failed stage and `RolledBack` reflects reality; the reassuring copy only renders when the fallback replace succeeded. - Audit `Record` errors are propagated (or at minimum flip `Logged` false and surface a fault) at all three sites, matching `pertarget.go:673`'s idiom. - Tests: failing rollback port ⇒ failed stage + `RolledBack == false`; failing audit sink ⇒ result does not claim `Logged`. --- _Filed from the 2026-08-05 fail-loud audit (three-agent pre-production sweep; findings verified against code)._
Author
Owner

Fixed in 2d0a0eb (on origin/main).

1. Rollback honesty (rollbackInPlace, internal/backup/restore_inplace.go): each fallback verb is now observed. A failed fallback replace yields a Done:false stage and leaves RolledBack false; the reassuring "resumed on the data it had" copy renders only when the fallback replace and resume both succeed; a rollback that cannot re-pause a resumed service refuses the fallback rather than replacing live data. inPlaceAuditDetail grows a third case (unexported reachedLiveData marker) so a failure that touched live data but did not roll back is never worded "could not start".

2. Audit writes (restore_inplace.go, run.go, pertarget.go): the three _, _ = o.audit.Record(...) sites now check the error and publish a new FaultAuditFailed; the in-place result flips Logged false when its entry does not land, matching pertarget.go:673s idiom.

Tests (restore_inplace_test.go): failing fallback port ⇒ failed stage + RolledBack == false + no reassuring copy (TestRestoreInPlace_RollbackFallbackFailsIsNotClaimedRolledBack); failing durable audit sink ⇒ result not Logged + FaultAuditFailed published (TestRestoreInPlace_AuditWriteFailureDoesNotClaimLogged). go test/go vet/golangci-lint green (backup, control-plane).

Fixed in 2d0a0eb (on origin/main). **1. Rollback honesty (`rollbackInPlace`, `internal/backup/restore_inplace.go`):** each fallback verb is now observed. A failed fallback replace yields a `Done:false` stage and leaves `RolledBack` false; the reassuring "resumed on the data it had" copy renders only when the fallback replace **and** resume both succeed; a rollback that cannot re-pause a resumed service refuses the fallback rather than replacing live data. `inPlaceAuditDetail` grows a third case (unexported `reachedLiveData` marker) so a failure that touched live data but did not roll back is never worded "could not start". **2. Audit writes (`restore_inplace.go`, `run.go`, `pertarget.go`):** the three `_, _ = o.audit.Record(...)` sites now check the error and publish a new `FaultAuditFailed`; the in-place result flips `Logged` false when its entry does not land, matching `pertarget.go:673`s idiom. **Tests (`restore_inplace_test.go`):** failing fallback port ⇒ failed stage + `RolledBack == false` + no reassuring copy (`TestRestoreInPlace_RollbackFallbackFailsIsNotClaimedRolledBack`); failing durable audit sink ⇒ result not `Logged` + `FaultAuditFailed` published (`TestRestoreInPlace_AuditWriteFailureDoesNotClaimLogged`). `go test`/`go vet`/`golangci-lint` green (backup, control-plane).
ben closed this issue 2026-08-06 03:16:41 +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#280
No description provided.