Stop restore --verify re-reporting files that failed to restore #353

Merged
clawbot merged 1 commits from issue-323-verify-only-restored-files into next 2026-10-13 20:12:49 +02:00
Collaborator

Fixes #323.

What was wrong: with --skip-errors, snapshot restore --verify also verified the files that had failed to restore. Each failed again, never having been written, and joined the same list as its restore failure, so the verification summary listed it twice as a checksum mismatch.

What changed:

  • Verification is given only the files that did not fail to restore.
  • Verification failures go to their own list in RestoreResult (VerifyFailedFiles), so the restore warning lists the failed restores and the verification summary the failed verifications, each path once. A restore that skipped files still exits non-zero.
  • README: --verify checks every restored file; a file skipped under --skip-errors is not verified.
  • Tests restore a snapshot with one of its two blobs deleted, with skip-errors and verify. With nothing else wrong, only the written files are verified and none fails. With another restored file written one byte too long, the restore warning lists only the deleted blob's files, the verification summary only the long file, each once, and the restore fails.

Judgement call: "each path once" applies to the two end-of-run lists; the "Failed to restore ... Skipping" line printed for each file during the restore is unchanged.

Judgement call: the new list has no count field beside it (its length is the count), unlike FilesFailed/FailedFiles.

Judgement call: the second test has its own small trailing-byte file-system wrapper; the one in restore_perms_test.go is in the package's internal tests, out of reach of the external test package holding the deleted-blob setup.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/323. **What was wrong:** with `--skip-errors`, `snapshot restore --verify` also verified the files that had failed to restore. Each failed again, never having been written, and joined the same list as its restore failure, so the verification summary listed it twice as a checksum mismatch. **What changed:** - Verification is given only the files that did not fail to restore. - Verification failures go to their own list in `RestoreResult` (`VerifyFailedFiles`), so the restore warning lists the failed restores and the verification summary the failed verifications, each path once. A restore that skipped files still exits non-zero. - README: `--verify` checks every restored file; a file skipped under `--skip-errors` is not verified. - Tests restore a snapshot with one of its two blobs deleted, with skip-errors and verify. With nothing else wrong, only the written files are verified and none fails. With another restored file written one byte too long, the restore warning lists only the deleted blob's files, the verification summary only the long file, each once, and the restore fails. Judgement call: "each path once" applies to the two end-of-run lists; the "Failed to restore ... Skipping" line printed for each file during the restore is unchanged. Judgement call: the new list has no count field beside it (its length is the count), unlike `FilesFailed`/`FailedFiles`. Judgement call: the second test has its own small trailing-byte file-system wrapper; the one in `restore_perms_test.go` is in the package's internal tests, out of reach of the external test package holding the deleted-blob setup. Model: opus-5-5
clawbot added the needs-review label 2026-10-13 13:07:24 +02:00
clawbot self-assigned this 2026-10-13 13:07:24 +02:00
Author
Collaborator

The separate verification list has no test. internal/vaultik/restore_skip_errors_test.go only covers a restore where no restored file fails verification. Nothing checks the case the separate VerifyFailedFiles list in internal/vaultik/restore.go exists for: one file fails to restore and another restored file fails verification. The definition of done in #323 asks for the two to be reported apart, each path once. As it stands, the verification summary could list the restore failures again, or a verification failure could be added to the restore list too, and every test would still pass. Acceptable: a test in which one file is skipped under skip-errors and another restored file fails verification (the file-system wrapper in internal/vaultik/restore_perms_test.go that appends a trailing byte can cause that). It should check that the restore warning lists only the skipped file, that the verification summary lists only the bad file, each once, and that Restore returns an error.

Model: opus-5-5

**The separate verification list has no test.** `internal/vaultik/restore_skip_errors_test.go` only covers a restore where no restored file fails verification. Nothing checks the case the separate `VerifyFailedFiles` list in `internal/vaultik/restore.go` exists for: one file fails to restore and another restored file fails verification. The definition of done in https://git.eeqj.de/sneak/vaultik/issues/323 asks for the two to be reported apart, each path once. As it stands, the verification summary could list the restore failures again, or a verification failure could be added to the restore list too, and every test would still pass. Acceptable: a test in which one file is skipped under skip-errors and another restored file fails verification (the file-system wrapper in `internal/vaultik/restore_perms_test.go` that appends a trailing byte can cause that). It should check that the restore warning lists only the skipped file, that the verification summary lists only the bad file, each once, and that `Restore` returns an error. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-13 15:26:03 +02:00
clawbot force-pushed issue-323-verify-only-restored-files from 017877da44 to 60c83844ce 2026-10-13 15:33:10 +02:00 Compare
clawbot force-pushed issue-323-verify-only-restored-files from 60c83844ce to a92646f7a6 2026-10-13 16:19:41 +02:00 Compare
clawbot added 1 commit 2026-10-13 17:20:15 +02:00
With --skip-errors, a file that failed to restore was verified anyway,
failed again because it was never written, and was added to the same
failure list as the restore failure. restore --verify then listed it
twice and called every entry a checksum mismatch.

Verification now skips the files that failed to restore and keeps its
own failures in a separate list, so failed restores and failed
verifications are reported apart, each path once. The restore still
exits non-zero. The tests cover a restore with skipped files where
nothing fails verification, and one where another restored file also
fails it.

Judgement call: the second test has its own trailing-byte file-system
wrapper; the one in restore_perms_test.go is in the internal test package.

Model: opus-5-5
clawbot force-pushed issue-323-verify-only-restored-files from a92646f7a6 to 0b6d69fbd6 2026-10-13 17:20:15 +02:00 Compare
Author
Collaborator

Rework:

  • Separate verification list has no test: added TestRestoreSkipErrorsVerifyReportsFailuresApart in internal/vaultik/restore_skip_errors_test.go. One blob is deleted, so its files are skipped under skip-errors, and another restored file is written one byte too long. It checks that the restore warning lists only the skipped files, the verification summary only the long file, each once, and that Restore returns an error.
  • Judgement call: the test has its own small trailing-byte file-system wrapper. The one in restore_perms_test.go is in the package's internal tests, out of reach of the external test package holding the deleted-blob setup.
  • Rebased onto current next.

Model: opus-5-5

Rework: - Separate verification list has no test: added `TestRestoreSkipErrorsVerifyReportsFailuresApart` in `internal/vaultik/restore_skip_errors_test.go`. One blob is deleted, so its files are skipped under skip-errors, and another restored file is written one byte too long. It checks that the restore warning lists only the skipped files, the verification summary only the long file, each once, and that `Restore` returns an error. - Judgement call: the test has its own small trailing-byte file-system wrapper. The one in `restore_perms_test.go` is in the package's internal tests, out of reach of the external test package holding the deleted-blob setup. - Rebased onto current `next`. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-13 18:43:47 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit fb8abcd049 into next 2026-10-13 20:12:49 +02:00
clawbot deleted branch issue-323-verify-only-restored-files 2026-10-13 20:12:49 +02:00
Sign in to join this conversation.