Print snapshot list and purge sizes like every other command #358

Merged
clawbot merged 1 commits from issue-312-decimal-byte-sizes into next 2026-10-13 16:22:04 +02:00
Collaborator

Fixes #312.

What was wrong: snapshot list and the snapshot purge listing formatted sizes with a helper that divided by 1024 but printed "KB"/"MB", while every other command uses humanize.Bytes (powers of 1000). The same 6,329,198 bytes read "6.0 MB" in the list and "6.3 MB" in snapshot create, snapshot verify and remote info. The terminal log handler had its own copy of that helper for the bytes value.

What changed:

  • The list table and the purge listing use the existing ubytes (humanize.Bytes), and the 1024-based formatBytes in internal/vaultik is removed.
  • The log handler's formatBytes now calls humanize.Bytes. A negative count is still printed as a plain number of bytes.
  • A new test prints one snapshot size through remote info, snapshot list and the purge listing, and expects the same text from all three.
  • The size the list tests share is now 5,000,000 bytes instead of 5 MiB, so the two ways of counting print it differently (4.8 MB against 5.0 MB). The log handler test uses 1,000,000 bytes for the same reason.

Worth knowing: humanize.Bytes writes kilobytes as "kB" with a lower-case k, so small sizes in the list now read e.g. "512 kB" instead of "500.0 KB".

Judgement call: the log handler goes beyond the two places the issue names. Its definition of done asks that every command print a byte count the same way, and the log line shown on a terminal under --verbose is one of those places.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/312. **What was wrong:** `snapshot list` and the `snapshot purge` listing formatted sizes with a helper that divided by 1024 but printed "KB"/"MB", while every other command uses `humanize.Bytes` (powers of 1000). The same 6,329,198 bytes read "6.0 MB" in the list and "6.3 MB" in `snapshot create`, `snapshot verify` and `remote info`. The terminal log handler had its own copy of that helper for the `bytes` value. **What changed:** - The list table and the purge listing use the existing `ubytes` (`humanize.Bytes`), and the 1024-based `formatBytes` in `internal/vaultik` is removed. - The log handler's `formatBytes` now calls `humanize.Bytes`. A negative count is still printed as a plain number of bytes. - A new test prints one snapshot size through `remote info`, `snapshot list` and the purge listing, and expects the same text from all three. - The size the list tests share is now 5,000,000 bytes instead of 5 MiB, so the two ways of counting print it differently (4.8 MB against 5.0 MB). The log handler test uses 1,000,000 bytes for the same reason. Worth knowing: `humanize.Bytes` writes kilobytes as "kB" with a lower-case k, so small sizes in the list now read e.g. "512 kB" instead of "500.0 KB". Judgement call: the log handler goes beyond the two places the issue names. Its definition of done asks that every command print a byte count the same way, and the log line shown on a terminal under `--verbose` is one of those places. Model: opus-5-5
clawbot added the needs-review label 2026-10-13 14:55:04 +02:00
clawbot self-assigned this 2026-10-13 14:55:04 +02:00
clawbot added 1 commit 2026-10-13 14:55:04 +02:00
`snapshot list`, the `snapshot purge` listing and the `bytes` value in
terminal log lines divided by 1024 while labelling the result KB or MB,
so 6,329,198 bytes read 6.0 MB there and 6.3 MB in every other command.
All three now use humanize.Bytes, as the rest of the program does, and
the 1024-based helper in internal/vaultik is removed.

The size shared by the list tests is now 5,000,000 bytes, which the two
ways of counting print differently.

Judgement call: the log handler's copy of the formatter is changed too,
since the issue asks that every command print a byte count the same way.

Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 005927a7fc into next 2026-10-13 16:22:04 +02:00
clawbot deleted branch issue-312-decimal-byte-sizes 2026-10-13 16:22:05 +02:00
Sign in to join this conversation.