Backup statistics are wrong in the printed summary and in the snapshots table #225

Closed
opened 2026-10-06 01:49:45 +02:00 by clawbot · 1 comment
Collaborator

Measured on next at 0700901:

  • Bytes are counted twice. BytesScanned is added once per changed file in the walk (internal/snapshot/scanner.go:1022) and again per new chunk during processing (scanner.go:1830). A first backup of 720,909 bytes reported 1,441,818. The figure feeds the summary's "Data: ... total" line (internal/vaultik/snapshot.go:396, :420-422) and snapshots.total_size.
  • "Unchanged" files are counted per chunk. FilesSkipped goes up once per deduplicated chunk (scanner.go:1822). The summary's "backed up" count is totalFiles - totalFilesSkipped (snapshot.go:395), so it goes negative: 4 files examined, "8 unchanged", "-4 backed up".
  • Cron runs record zero upload figures. Under --cron the progress reporter is disabled (snapshot.go:201), and collectUploadStats reads the upload figures from it (snapshot.go:320-328). Every cron snapshot therefore stores blob_size = upload_bytes = upload_duration_ms = 0, and snapshot purge lists those snapshots as 0 B (snapshot.go:521, :595-600).
  • Columns hold something other than what docs/DATAMODEL.md says. blob_size holds the bytes uploaded in this run, not the "total size of all blobs" (DATAMODEL.md:123). blob_uncompressed_size is always 0 and compression_ratio is always 1.0 (snapshot.go:347, internal/database/snapshots.go:734-736). chunk_count and blob_count count only what is new in this run, not the unique chunks and referenced blobs the doc names (DATAMODEL.md:120-121).

Definition of done

  1. Each figure is counted once, by one counter: no file-level counter is touched per chunk, and scanned bytes are counted once.
  2. The upload figures come from the scanner, not from the optional progress reporter, so --cron records them.
  3. Each snapshots column either holds what docs/DATAMODEL.md says or the doc is corrected to say what it holds. Choose whichever is the smaller honest change, and say which in the PR.
  4. Tests assert the summary counts for a first run, an incremental run with deduplicated chunks, and a --cron run.
  5. make check passes.

Model: fable-5-1 (audit); opus-5-5 (issue)

Measured on `next` at `0700901`: - **Bytes are counted twice.** `BytesScanned` is added once per changed file in the walk (`internal/snapshot/scanner.go:1022`) and again per new chunk during processing (`scanner.go:1830`). A first backup of 720,909 bytes reported 1,441,818. The figure feeds the summary's "Data: ... total" line (`internal/vaultik/snapshot.go:396`, `:420-422`) and `snapshots.total_size`. - **"Unchanged" files are counted per chunk.** `FilesSkipped` goes up once per deduplicated chunk (`scanner.go:1822`). The summary's "backed up" count is `totalFiles - totalFilesSkipped` (`snapshot.go:395`), so it goes negative: 4 files examined, "8 unchanged", "-4 backed up". - **Cron runs record zero upload figures.** Under `--cron` the progress reporter is disabled (`snapshot.go:201`), and `collectUploadStats` reads the upload figures from it (`snapshot.go:320-328`). Every cron snapshot therefore stores `blob_size = upload_bytes = upload_duration_ms = 0`, and `snapshot purge` lists those snapshots as `0 B` (`snapshot.go:521`, `:595-600`). - **Columns hold something other than what `docs/DATAMODEL.md` says.** `blob_size` holds the bytes uploaded in this run, not the "total size of all blobs" (`DATAMODEL.md:123`). `blob_uncompressed_size` is always 0 and `compression_ratio` is always 1.0 (`snapshot.go:347`, `internal/database/snapshots.go:734-736`). `chunk_count` and `blob_count` count only what is new in this run, not the unique chunks and referenced blobs the doc names (`DATAMODEL.md:120-121`). ## Definition of done 1. Each figure is counted once, by one counter: no file-level counter is touched per chunk, and scanned bytes are counted once. 2. The upload figures come from the scanner, not from the optional progress reporter, so `--cron` records them. 3. Each `snapshots` column either holds what `docs/DATAMODEL.md` says or the doc is corrected to say what it holds. Choose whichever is the smaller honest change, and say which in the PR. 4. Tests assert the summary counts for a first run, an incremental run with deduplicated chunks, and a `--cron` run. 5. `make check` passes. Model: fable-5-1 (audit); opus-5-5 (issue)
clawbot self-assigned this 2026-10-06 01:49:45 +02:00
Author
Collaborator

Fixed in #254. For the snapshots columns, the code now matches docs/DATAMODEL.md for total_size, blob_size, blob_uncompressed_size, compression_ratio and upload_bytes; the doc now says chunk_count and blob_count count what the run added. The tests found that a backup without --cron panics when a snapshot has two or more paths, filed separately as #253.

Model: opus-5-5

Fixed in https://git.eeqj.de/sneak/vaultik/pulls/254. For the `snapshots` columns, the code now matches `docs/DATAMODEL.md` for `total_size`, `blob_size`, `blob_uncompressed_size`, `compression_ratio` and `upload_bytes`; the doc now says `chunk_count` and `blob_count` count what the run added. The tests found that a backup without `--cron` panics when a snapshot has two or more paths, filed separately as https://git.eeqj.de/sneak/vaultik/issues/253. 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#225