Check blob sizes and the database in shallow verify #193

Merged
clawbot merged 1 commits from issue-169-shallow-verify-sizes into next 2026-09-22 14:28:45 +02:00
Collaborator

Closes #169.

Shallow snapshot verify (without --deep) only checked that each blob
object existed, discarded the size that Stat returned, and then printed
"OK - All blobs verified" — overstating what it had done, and reporting a
pass for a manifest listing no blobs.

Changes:

  • Each blob's stored size is now compared against the manifest's
    compressed_size, using the same comparison as the deep path. A blob
    present but the wrong size fails verification and is not counted as
    verified.
  • The snapshot's encrypted database (metadata/<key>/db.zst.age) must be
    present; its absence fails verification. A snapshot without it is not
    restorable regardless of the blobs.
  • The success line now states only what was checked: "all N blobs listed
    in the manifest are present with the listed size; contents not checked
    (use --deep)". The README verify description and the CLI short/long
    text are corrected to match.

Removed the now-unused resolveAndDownloadManifest helper and the
errBlobsMissing sentinel.

Tests (internal/vaultik/shallow_verify_test.go): a real snapshot is
backed up, then one stored blob is grown so its size no longer matches
the manifest — shallow verify must fail, count it as a mismatch, and drop
it from the verified count; separately, deleting db.zst.age must fail
shallow verify. Both fail without this change. make check is green.

TODO.md is intentionally not updated: the last eight issue PRs to next
did not touch it.

Model: opus-4-8

Closes https://git.eeqj.de/sneak/vaultik/issues/169. Shallow `snapshot verify` (without `--deep`) only checked that each blob object existed, discarded the size that `Stat` returned, and then printed "OK - All blobs verified" — overstating what it had done, and reporting a pass for a manifest listing no blobs. Changes: - Each blob's stored size is now compared against the manifest's `compressed_size`, using the same comparison as the deep path. A blob present but the wrong size fails verification and is not counted as verified. - The snapshot's encrypted database (`metadata/<key>/db.zst.age`) must be present; its absence fails verification. A snapshot without it is not restorable regardless of the blobs. - The success line now states only what was checked: "all N blobs listed in the manifest are present with the listed size; contents not checked (use `--deep`)". The README verify description and the CLI short/long text are corrected to match. Removed the now-unused `resolveAndDownloadManifest` helper and the `errBlobsMissing` sentinel. Tests (`internal/vaultik/shallow_verify_test.go`): a real snapshot is backed up, then one stored blob is grown so its size no longer matches the manifest — shallow verify must fail, count it as a mismatch, and drop it from the verified count; separately, deleting `db.zst.age` must fail shallow verify. Both fail without this change. `make check` is green. TODO.md is intentionally not updated: the last eight issue PRs to `next` did not touch it. Model: opus-4-8
clawbot added the needs-review label 2026-09-22 14:04:34 +02:00
clawbot self-assigned this 2026-09-22 14:04:34 +02:00
clawbot added 1 commit 2026-09-22 14:04:34 +02:00
Check blob sizes and the database in shallow verify (closes #169)
check / check (pull_request) Successful in 1m21s
3d0cd2658c
Shallow `snapshot verify` only checked that each blob object existed and
then reported "All blobs verified", overstating what it did.

It now compares each blob's stored size against the manifest's
compressed_size, using the same comparison as the deep path, and checks
that the snapshot's encrypted database (db.zst.age) is present. A blob of
the wrong size no longer counts as verified. The final line reports only
what was checked: presence and size, not contents.

The README verify description and the CLI short/long text are corrected
to match. Removed the now-unused resolveAndDownloadManifest helper and
errBlobsMissing sentinel.

Model: opus-4-8
Author
Collaborator

PASS

Model: opus-4-8

PASS Model: opus-4-8
clawbot merged commit 7e611b95db into next 2026-09-22 14:28:45 +02:00
clawbot deleted branch issue-169-shallow-verify-sizes 2026-09-22 14:28:46 +02:00
Sign in to join this conversation.