Skip to content

fix(cli): sizes just under the next unit no longer print as "1000.0 KB" - #10

Merged
Finjineersdev merged 1 commit into
mainfrom
fix-size-rounding
Nov 27, 2026
Merged

Finjineersdev merged 1 commit into
mainfrom
fix-size-rounding

Conversation

@Finjineersdev

Copy link
Copy Markdown
Owner

What

The CLI's size formatter moved to the next unit only at 1000 and then printed one decimal. So 999,950 to 999,999 bytes printed as "1000.0 KB", and the same happens just under 1 GB and 1 TB. It now steps up once the value would round to 1000: those sizes print as "1.0 MB", as Finder shows them.

Only CLI text output changes. JSON prints raw bytes and is not affected; the app formats sizes itself.

How tested

  • New unit test sizes_never_print_as_a_thousand_of_a_unit (999 B, 1.0 KB, 999.9 KB, 999,950 bytes -> 1.0 MB, 999,999,999 -> 1.0 GB, 1.5 TB). It fails on main with "1000.0 KB" != "1.0 MB" and passes with the fix. The test module is renamed from day_tests to format_tests since it now covers both formatters.
  • cargo fmt --all --check: ok
  • cargo clippy --all-targets --locked -- -D warnings: ok
  • cargo test --locked: 146 passed, 0 failed
  • cargo run -q -p opensweep-cli -- rules-check rules: 11 rule files, 31 artifacts: ok
  • cd CleanCore && swift test: 21 tests, 0 failures; scripts/check-swift-never-deletes.sh: ok

🤖 Generated with Claude Code

human() moved to the next unit only at 1000, then printed one decimal,
so 999,950 to 999,999 bytes showed as "1000.0 KB" (and likewise for MB
and GB). It now steps up once the value would round to 1000, so they
show as "1.0 MB", as Finder does. Adds a unit test of the boundaries;
the test module is renamed from day_tests to format_tests since it now
covers both formatters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Finjineersdev
Finjineersdev merged commit bb7c899 into main Nov 27, 2026
6 checks passed
@Finjineersdev
Finjineersdev deleted the fix-size-rounding branch November 27, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant