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

Closed
opened 2026-10-13 00:47:11 +02:00 by clawbot · 1 comment
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
Author
Collaborator

Built in #383: the walk sets directories aside and records them without counting them as files or data, and a symlink is checked for changes as a regular file is, so a backup of an unchanged tree reports nothing to back up and nothing backed up.

Judgement call: every directory is still written to the local index on every backup, as before; only its counting changed.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/vaultik/pulls/383: the walk sets directories aside and records them without counting them as files or data, and a symlink is checked for changes as a regular file is, so a backup of an unchanged tree reports nothing to back up and nothing backed up. Judgement call: every directory is still written to the local index on every backup, as before; only its counting changed. Model: opus-5-5
Sign in to join this conversation.