Skip to content

Use one size formatter for gauges and Unraid. - #1273

Merged
calledtoconstruct merged 1 commit into
MyOwnDataCenter:mainfrom
calledtoconstruct:fix/size-unit-boundary
Dec 5, 2026
Merged

calledtoconstruct merged 1 commit into
MyOwnDataCenter:mainfrom
calledtoconstruct:fix/size-unit-boundary

Conversation

@calledtoconstruct

@calledtoconstruct calledtoconstruct commented Dec 5, 2026 •

Copy link
Copy Markdown
Collaborator

What this changes

Machine gauges and the Unraid import list use the same size formatter as the rest of the app. A size that rounds onto the next unit now reads 1.0 MB instead of 1024 KB or 1000 KB.

Fixes #141.

How you tested it

  • npm run typecheck, npm run build and npm test pass
  • Tried on a real Omarchy machine or VM (say which), if it touches install.sh, the helper, apps, machines or storage

Typecheck (tsc --noEmit -p web) passed. Targeted tests passed: test/swarm-gauges.test.mjs, test/unraid-ui.test.mjs, test/desktop-controls.test.mjs (27 tests). Full npm test and npm run build were not run.

Anything to know

Unraid sizes between 10 and 99 of a unit now show one decimal (10.0 KB), matching the shared helper. Null and non-numeric sizes still say "size unknown". Version and What's New are unchanged.


Note

Low Risk
Display-only formatting consolidation with targeted tests; no changes to data handling or security paths.

Overview
Swarm machine gauge subtitles and Unraid import size labels now call the shared bytes helper from formatBytes.ts instead of local duplicates in swarm/gauges.ts and unraidView.ts.

Behavior change: values that round up to the next unit display as 1.0 MB (and similar) rather than awkward strings like 1024 KB or 1000 KB. Unraid formatBytes also treats non-finite numbers as "size unknown", consistent with null.

New tests lock in boundary rounding for swarm memory/storage subtitles and for formatBytes(1048575).

Reviewed by Cursor Bugbot for commit 7a72c8a. Bugbot is set up for automated code reviews on this repo. Configure here.

Machine gauges and the Unraid import list kept their own copies, so a size just under a unit still read 1024 KB or 1000 KB. They now use the shared helper, which steps up after rounding.

Fixes MyOwnDataCenter#141

Co-Authored-By: Grok 4.7
@calledtoconstruct
calledtoconstruct merged commit ff71fb0 into MyOwnDataCenter:main Dec 5, 2026
2 checks passed
@calledtoconstruct

Copy link
Copy Markdown
Collaborator Author

Thank you @nixfred. Machine gauges and the Unraid import list now use the same size formatter as the rest of the app, so a size on a unit boundary reads 1.0 MB. Merged.

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.

Size formatters print "1000 KB", "1024 KB" and "100.0 KB" at unit boundaries

1 participant