Fix #189. If you think this has some "consistency", follow "/do-issue". Otherwise, fix…
- User
Fix #189. If you think this has some "consistency", follow "/do-issue". Otherwise, fix directly.
Assistant· claude-opus-4-8
This is a simple, self-contained change. I'll fix it directly. Let me find the code.
Assistant· claude-opus-4-8
There's already byte-formatting logic in two places. Let me check for a shared util and look at the folder_sync context.
Assistant· claude-opus-4-8
Let me check the LogLevel enum and existing formatters to decide on a shared util.
Assistant· claude-opus-4-8
No test asserts the summary string. Now let me implement. First add a shared
format_bytestodisk.py.Assistant· claude-opus-4-8
Now update the folder_sync log. Let me check its imports.
Assistant· claude-opus-4-8
Now consolidate the duplicate in
disk_space_monitor.py. Let me view it.Assistant· claude-opus-4-8
Already imports from
pcswitcher.disk. I'll replace the two call sites and remove the duplicate method.Assistant· claude-opus-4-8
Now remove the now-unused
_format_bytesmethod.Assistant· claude-opus-4-8
Now check the orchestrator's local
format_bytesclosure — different format (no space). Let me see its usage and any test coverage.Assistant· claude-opus-4-8
Let me consolidate the orchestrator closure too. Check its disk imports.
Assistant· claude-opus-4-8
Now run lint, typecheck, and relevant tests.
Assistant· claude-opus-4-8
All checks pass. Now run the relevant tests.
Assistant· claude-opus-4-8
All 206 pass. Let me add a focused test for the new shared
format_bytes.Assistant· claude-opus-4-8
Let me lint the new test and run the full unit suite.
Assistant· claude-opus-4-8
All green (595 tests). Let me commit on this issue branch.
Assistant· claude-opus-4-8
Fixed #189 directly (no consistency workflow needed — it's a self-contained log-formatting change).
What changed:
folder_sync.py:614— the INFO per-folder summary now shows human-readable size (e.g.531.8 MiBinstead of557587395 bytes). Added a DEBUG line that keeps the exact byte count, per the issue's "bytes are ok for DEBUG log."- Added
format_bytes()todisk.pyand routed the two pre-existing duplicate formatters (disk_space_monitor._format_bytes, orchestrator's localformat_bytesclosure) through it — removing triplication. Binary/IEC units (KiB/MiB/GiB/TiB), one decimal place. - New test
tests/unit/test_disk_format.pycovering the formatter, including the issue's exact557587395 → 531.8 MiB.
Verification:
ruff check/format,basedpyrightclean on touched files; full unit suite 595 passed.The resulting log line reads:
Completed sync of '/home/janfr': 6244 files transferred, 531.8 MiB, 2225 deletionsCommitted to branch
189-human-transfer-size(261f347). Not pushed / no PR — say the word and I'll open a draft PR and run CI.