Count a file a backup could not store as failed #282

Merged
clawbot merged 1 commits from issue-280-count-failed-files into next 2026-10-08 10:12:11 +02:00
Collaborator

Fixes #280.

A file that phase 1 of snapshot create counted and phase 2 could not open (unreadable under --skip-errors, or removed between the phases) went into the unchanged count, and its size stayed in BytesScanned. The summary showed it as unchanged with its bytes backed up, and the snapshots row's file_count and total_size included it.

Changes:

  • ScanResult gains FilesFailed. Both skip paths in phase 2 now count the file there and subtract its size from BytesScanned, where they used to increment FilesSkipped.
  • The summary's files line adds , N failed when N is not zero. "backed up" is now examined minus unchanged minus failed.
  • file_count is the files examined minus the failed ones. total_size is right through BytesScanned.
  • The comment on BackupStats.TotalSize said "all files examined" and now says the files in the snapshot.

Things the diff does not show:

  • "examined" still includes the failed file, so examined = backed up + unchanged + failed.
  • The test fails the open through an afero.Fs wrapper rather than chmod 000. The Docker test phase runs as root, and root can open a mode-000 file.
  • The live progress reporter's counters are not changed.

Judgement call: a directory that phase 2 cannot record is not counted as failed, because phase 1 does not count directories. Not tested: phase 2 fails on a directory only when a database write fails.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/280. A file that phase 1 of `snapshot create` counted and phase 2 could not open (unreadable under `--skip-errors`, or removed between the phases) went into the unchanged count, and its size stayed in `BytesScanned`. The summary showed it as unchanged with its bytes backed up, and the `snapshots` row's `file_count` and `total_size` included it. Changes: - `ScanResult` gains `FilesFailed`. Both skip paths in phase 2 now count the file there and subtract its size from `BytesScanned`, where they used to increment `FilesSkipped`. - The summary's files line adds `, N failed` when N is not zero. "backed up" is now examined minus unchanged minus failed. - `file_count` is the files examined minus the failed ones. `total_size` is right through `BytesScanned`. - The comment on `BackupStats.TotalSize` said "all files examined" and now says the files in the snapshot. Things the diff does not show: - "examined" still includes the failed file, so examined = backed up + unchanged + failed. - The test fails the open through an `afero.Fs` wrapper rather than `chmod 000`. The Docker test phase runs as root, and root can open a mode-000 file. - The live progress reporter's counters are not changed. Judgement call: a directory that phase 2 cannot record is not counted as failed, because phase 1 does not count directories. Not tested: phase 2 fails on a directory only when a database write fails. Model: opus-5-5
clawbot added the needs-review label 2026-10-08 08:56:46 +02:00
clawbot self-assigned this 2026-10-08 08:56:46 +02:00
clawbot added 1 commit 2026-10-08 09:37:14 +02:00
A file that phase 1 of a backup counted and phase 2 could not open,
because it was unreadable under --skip-errors or removed in between,
was added to the unchanged count while its size stayed in
BytesScanned. The summary showed it as unchanged with its bytes backed
up, and the snapshots row's file_count and total_size included it.

The scanner now counts such a file in FilesFailed and takes its size
out of BytesScanned. The summary's files line adds "N failed", and
file_count leaves the file out.

A directory phase 2 cannot record is not counted as failed, since
phase 1 counts no directories; that case has no test.

Model: opus-5-5
clawbot force-pushed issue-280-count-failed-files from ca98a6d5e1 to 403598ff25 2026-10-08 09:37:14 +02:00 Compare
Author
Collaborator

Rebased onto current next after #279 landed; the only conflict was TODO.md, where both entries are kept with this one first. No other change.

Model: opus-5-5

Rebased onto current `next` after https://git.eeqj.de/sneak/vaultik/pulls/279 landed; the only conflict was `TODO.md`, where both entries are kept with this one first. No other change. Model: opus-5-5
Author
Collaborator

Review passed.
Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 79a73fa122 into next 2026-10-08 10:12:11 +02:00
clawbot deleted branch issue-280-count-failed-files 2026-10-08 10:12:11 +02:00
Sign in to join this conversation.