The "deleted" figure of a backup counts files that were not deleted since the previous snapshot of that name #304

Open
opened 2026-10-13 00:47:10 +02:00 by clawbot · 1 comment
Collaborator

Found by the defect hunt in #288 (parts 1 and 2).

What is wrong: loadKnownFiles and detectDeletedFilesFromMap (internal/snapshot/scanner.go) count as deleted every indexed file under the source path that this run's walk did not record. That includes:

  • files this snapshot excludes but another snapshot backs up (in config.example.yml, home excludes /Library/Caches, which system backs up);
  • files deleted long ago: a deleted file keeps its index row while any older snapshot lists it, so every later backup reports it as deleted again, and so does the first backup of another snapshot name over the same path.

How it was shown: home = src excluding /photos, and photos = src/photos with 3 files: every run of home after the first printed "detected 4 deleted files" and "4 deleted", "6.0 kB deleted", with nothing deleted. After two files were removed, the next backup correctly reported "2 deleted (202 kB)", and every later unchanged backup reported "2 deleted (202 kB)" again.

Definition of done

  • A backup counts a file as deleted only when the previous snapshot of the same name had it and it no longer exists on disk; an excluded file is never counted as deleted.
  • The figure is right in the summary and in the snapshots row.
  • Tests cover both cases above.

Model: opus-5-5

Found by the defect hunt in https://git.eeqj.de/sneak/vaultik/issues/288 (parts 1 and 2). **What is wrong:** `loadKnownFiles` and `detectDeletedFilesFromMap` (`internal/snapshot/scanner.go`) count as deleted every indexed file under the source path that this run's walk did not record. That includes: - files this snapshot excludes but another snapshot backs up (in `config.example.yml`, `home` excludes `/Library/Caches`, which `system` backs up); - files deleted long ago: a deleted file keeps its index row while any older snapshot lists it, so every later backup reports it as deleted again, and so does the first backup of another snapshot name over the same path. **How it was shown:** `home` = `src` excluding `/photos`, and `photos` = `src/photos` with 3 files: every run of `home` after the first printed "detected 4 deleted files" and "4 deleted", "6.0 kB deleted", with nothing deleted. After two files were removed, the next backup correctly reported "2 deleted (202 kB)", and every later unchanged backup reported "2 deleted (202 kB)" again. **Definition of done** - A backup counts a file as deleted only when the previous snapshot of the same name had it and it no longer exists on disk; an excluded file is never counted as deleted. - The figure is right in the summary and in the `snapshots` row. - Tests cover both cases above. Model: opus-5-5
clawbot self-assigned this 2026-10-13 00:47:10 +02:00
Author
Collaborator

Built in #342: a backup now counts a file as deleted only when the most recent completed snapshot of the same name lists it, the walk did not find it, and the snapshot's excludes do not match it. The snapshots row stores no deleted figure, so only the backup's output changes.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/vaultik/pulls/342: a backup now counts a file as deleted only when the most recent completed snapshot of the same name lists it, the walk did not find it, and the snapshot's excludes do not match it. The `snapshots` row stores no deleted figure, so only the backup's output changes. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/vaultik#304