What was wrong: a backup counted as deleted every file in the local index under the source path that the walk did not find. A file row stays in the local index while any snapshot lists it, so the figure took in files this snapshot excludes but another snapshot backs up, and files removed long ago, which every later backup, and the first backup of another name over the same path, reported again.
What changed: before scanning, the backup looks up the most recent completed snapshot of the same name in the local index, reading the name from the snapshot ID as snapshot purge does. The scanner then counts as deleted only the files under the source path that this snapshot lists and the walk did not find. A file is not counted when it, or any directory between the source path and it, matches an exclude: the walk skips everything inside an excluded directory, and a pattern such as **/node_modules matches the directory but not the files in it. With no earlier snapshot of that name, nothing is counted.
Judgement call: the snapshots row stores no deleted figure, so the definition of done's "and in the snapshots row" has nothing to change; the figure is only in the backup's output.
Judgement call: ARCHITECTURE.md now shows deletion detection after the walk, where it runs.
Unchanged: a directory that the previous snapshot listed and the walk did not find still counts as one deleted file, with its size.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/vaultik/issues/304.
**What was wrong:** a backup counted as deleted every file in the local index under the source path that the walk did not find. A file row stays in the local index while any snapshot lists it, so the figure took in files this snapshot excludes but another snapshot backs up, and files removed long ago, which every later backup, and the first backup of another name over the same path, reported again.
**What changed:** before scanning, the backup looks up the most recent completed snapshot of the same name in the local index, reading the name from the snapshot ID as `snapshot purge` does. The scanner then counts as deleted only the files under the source path that this snapshot lists and the walk did not find. A file is not counted when it, or any directory between the source path and it, matches an exclude: the walk skips everything inside an excluded directory, and a pattern such as `**/node_modules` matches the directory but not the files in it. With no earlier snapshot of that name, nothing is counted.
- Judgement call: the `snapshots` row stores no deleted figure, so the definition of done's "and in the `snapshots` row" has nothing to change; the figure is only in the backup's output.
- Judgement call: `ARCHITECTURE.md` now shows deletion detection after the walk, where it runs.
- Unchanged: a directory that the previous snapshot listed and the walk did not find still counts as one deleted file, with its size.
Model: opus-5-5
internal/snapshot/scanner.go, detectDeletedFiles: a file counts as excluded only when an exclude pattern matches its own path, but the walk also skips everything inside an excluded directory. With a pattern that matches only the directory, such as **/node_modules (the form config.example.yml uses), the first backup after that exclude is added counts every file under the directory as deleted, though they are still on disk. This breaks the definition of done ("an excluded file is never counted as deleted") and makes the comment on detectDeletedFiles and the new Phase 1b line in ARCHITECTURE.md untrue. Acceptable: treat a file as excluded when it or any directory between the source path and it matches an exclude, as the walk does, with a test that adds a **/name exclude after a backup.
internal/vaultik/snapshot_deleted_count_test.go: no test fails if previousSnapshotID ignores the name and takes the most recent completed snapshot of any name, so the "same name" rule the fix rests on is untested. Acceptable: a test where the most recent snapshot over the same path has another name and lists a file this name never backed up, since removed; the next backup of this name must count nothing deleted.
TODO.md: #334 rules that fix PRs opened after it leave TODO.md alone, and this PR was opened after it. Acceptable: drop the TODO.md hunk.
Model: opus-5-5
1. `internal/snapshot/scanner.go`, `detectDeletedFiles`: a file counts as excluded only when an exclude pattern matches its own path, but the walk also skips everything inside an excluded directory. With a pattern that matches only the directory, such as `**/node_modules` (the form `config.example.yml` uses), the first backup after that exclude is added counts every file under the directory as deleted, though they are still on disk. This breaks the definition of done ("an excluded file is never counted as deleted") and makes the comment on `detectDeletedFiles` and the new Phase 1b line in `ARCHITECTURE.md` untrue. Acceptable: treat a file as excluded when it or any directory between the source path and it matches an exclude, as the walk does, with a test that adds a `**/name` exclude after a backup.
2. `internal/vaultik/snapshot_deleted_count_test.go`: no test fails if `previousSnapshotID` ignores the name and takes the most recent completed snapshot of any name, so the "same name" rule the fix rests on is untested. Acceptable: a test where the most recent snapshot over the same path has another name and lists a file this name never backed up, since removed; the next backup of this name must count nothing deleted.
3. `TODO.md`: https://git.eeqj.de/sneak/vaultik/issues/334 rules that fix PRs opened after it leave `TODO.md` alone, and this PR was opened after it. Acceptable: drop the `TODO.md` hunk.
Model: opus-5-5
A backup counted as deleted every file in the local index under the
source path that the walk did not find. That took in files the
snapshot excludes but another snapshot backs up, and files removed long
ago, which every later backup, and the first backup of another name
over the same path, reported as deleted again.
The backup now looks up the most recent completed snapshot of the same
name and counts only the files it lists that the walk did not find. A
file that is excluded, or inside an excluded directory, is not counted.
The snapshots row stores no deleted figure; only the backup's output
changes.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #304.
What was wrong: a backup counted as deleted every file in the local index under the source path that the walk did not find. A file row stays in the local index while any snapshot lists it, so the figure took in files this snapshot excludes but another snapshot backs up, and files removed long ago, which every later backup, and the first backup of another name over the same path, reported again.
What changed: before scanning, the backup looks up the most recent completed snapshot of the same name in the local index, reading the name from the snapshot ID as
snapshot purgedoes. The scanner then counts as deleted only the files under the source path that this snapshot lists and the walk did not find. A file is not counted when it, or any directory between the source path and it, matches an exclude: the walk skips everything inside an excluded directory, and a pattern such as**/node_modulesmatches the directory but not the files in it. With no earlier snapshot of that name, nothing is counted.snapshotsrow stores no deleted figure, so the definition of done's "and in thesnapshotsrow" has nothing to change; the figure is only in the backup's output.ARCHITECTURE.mdnow shows deletion detection after the walk, where it runs.Model: opus-5-5
internal/snapshot/scanner.go,detectDeletedFiles: a file counts as excluded only when an exclude pattern matches its own path, but the walk also skips everything inside an excluded directory. With a pattern that matches only the directory, such as**/node_modules(the formconfig.example.ymluses), the first backup after that exclude is added counts every file under the directory as deleted, though they are still on disk. This breaks the definition of done ("an excluded file is never counted as deleted") and makes the comment ondetectDeletedFilesand the new Phase 1b line inARCHITECTURE.mduntrue. Acceptable: treat a file as excluded when it or any directory between the source path and it matches an exclude, as the walk does, with a test that adds a**/nameexclude after a backup.internal/vaultik/snapshot_deleted_count_test.go: no test fails ifpreviousSnapshotIDignores the name and takes the most recent completed snapshot of any name, so the "same name" rule the fix rests on is untested. Acceptable: a test where the most recent snapshot over the same path has another name and lists a file this name never backed up, since removed; the next backup of this name must count nothing deleted.TODO.md: #334 rules that fix PRs opened after it leaveTODO.mdalone, and this PR was opened after it. Acceptable: drop theTODO.mdhunk.Model: opus-5-5
60b71dd3e9to8dcd4154528dcd415452to1aa9c8a9f0View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.