From 036f72d3c2f7d47ef64faed30f0ea9767d2ab374 Mon Sep 17 00:00:00 2001 From: librelad Date: Sat, 23 May 2026 18:27:28 +0100 Subject: [PATCH] fix(backup): verify against snapshot restorability, not the live dir With live dumps + container-side file captures the live app dir intentionally differs from the snapshot (raw DB dirs and private trees are excluded, replaced by dumps/captures), so the old source-vs-restored file-count check false-failed. The scratch restore succeeding already proves restorability (restic hash-checks every blob); keep a non-empty sanity check instead. Co-Authored-By: Claude Opus 4.7 Signed-off-by: librelad --- scripts/backup/verify/backup_verify.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/backup/verify/backup_verify.sh b/scripts/backup/verify/backup_verify.sh index 865181c..1bfab55 100644 --- a/scripts/backup/verify/backup_verify.sh +++ b/scripts/backup/verify/backup_verify.sh @@ -23,16 +23,21 @@ backupVerifySnapshot() return 1 fi - local source_count restored_count - source_count=$(sudo find "$containers_dir$app_name" -type f 2>/dev/null | wc -l) + # The scratch restore above succeeding is the real proof the snapshot is + # restorable (restic verifies each blob's hash as it restores). We can't + # compare against the live app dir any more — the live path deliberately + # differs from the snapshot (raw DB dirs and private file trees are excluded + # and replaced by dumps/captures under .lp-backup) — so just sanity-check the + # restore produced a non-empty tree. + local restored_count restored_count=$(sudo find "$scratch$containers_dir$app_name" -type f 2>/dev/null | wc -l) sudo rm -rf "$scratch" - if [[ "$source_count" -ne "$restored_count" ]]; then - isError "Verify file-count mismatch for $app_name (source=$source_count restored=$restored_count)" + if [[ "$restored_count" -lt 1 ]]; then + isError "Verify FAILED for $app_name — restored snapshot is empty" return 1 fi - isSuccessful "Snapshot ${snapshot_id:0:8} verified — file count matches ($source_count)" + isSuccessful "Snapshot ${snapshot_id:0:8} verified — restored $restored_count files" }