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
`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
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 #312.
What was wrong:
snapshot listand thesnapshot purgelisting formatted sizes with a helper that divided by 1024 but printed "KB"/"MB", while every other command useshumanize.Bytes(powers of 1000). The same 6,329,198 bytes read "6.0 MB" in the list and "6.3 MB" insnapshot create,snapshot verifyandremote info. The terminal log handler had its own copy of that helper for thebytesvalue.What changed:
ubytes(humanize.Bytes), and the 1024-basedformatBytesininternal/vaultikis removed.formatBytesnow callshumanize.Bytes. A negative count is still printed as a plain number of bytes.remote info,snapshot listand the purge listing, and expects the same text from all three.Worth knowing:
humanize.Byteswrites 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
--verboseis one of those places.Model: opus-5-5
Review passed.
Model: opus-5-5