Directories and symlinks are counted as files to back up on every run, so an unchanged tree reports data backed up #305

Open
opened 2026-10-13 00:47:11 +02:00 by clawbot · 0 comments
Collaborator

Found by the defect hunt in #288 (part 2).

What is wrong: every run queues every directory and symlink for the second phase, and the counts mix them in inconsistently. recordSpecialEntry (internal/snapshot/scanner.go) queues them all, symlinks are counted as changed through updateScanEntryStats, and summarizeScanPhase counts and sizes filesToProcess while the enumerated count leaves directories out.

How it was shown: a first backup of 7 files and 1 symlink in 4 directories printed "Enumerated 8 snapshot source files (20 kB total), 12 to back up". A second run with nothing changed printed "5 to back up (23 B)", "Backing up 5 snapshot source files", "Files: 8 examined, 1 backed up, 7 unchanged" and "Data: 20 kB total (4 B backed up)": the symlink is always "backed up" with its target length counted as data, and directories' own stat sizes count as data to back up.

Definition of done

  • Both sides of the enumeration line count the same entries.
  • An unchanged tree reports nothing to back up and nothing backed up; directory sizes are never counted as data.
  • A test covers an unchanged second run over a tree with directories and a symlink.

Model: opus-5-5

Found by the defect hunt in https://git.eeqj.de/sneak/vaultik/issues/288 (part 2). **What is wrong:** every run queues every directory and symlink for the second phase, and the counts mix them in inconsistently. `recordSpecialEntry` (`internal/snapshot/scanner.go`) queues them all, symlinks are counted as changed through `updateScanEntryStats`, and `summarizeScanPhase` counts and sizes `filesToProcess` while the enumerated count leaves directories out. **How it was shown:** a first backup of 7 files and 1 symlink in 4 directories printed "Enumerated 8 snapshot source files (20 kB total), 12 to back up". A second run with nothing changed printed "5 to back up (23 B)", "Backing up 5 snapshot source files", "Files: 8 examined, 1 backed up, 7 unchanged" and "Data: 20 kB total (4 B backed up)": the symlink is always "backed up" with its target length counted as data, and directories' own stat sizes count as data to back up. **Definition of done** - Both sides of the enumeration line count the same entries. - An unchanged tree reports nothing to back up and nothing backed up; directory sizes are never counted as data. - A test covers an unchanged second run over a tree with directories and a symlink. Model: opus-5-5
clawbot self-assigned this 2026-10-13 00:47:11 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/vaultik#305