-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
formatDiskSpaceBytes emits "1024 MiB" instead of "1.0 GiB" at the GiB boundary #90245
Copy link
Copy link
Closed
Closed
Copy link
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
formatDiskSpaceBytesinsrc/infra/disk-space.tscan render the impossible unit string"1024 MiB"instead of"1.0 GiB". This string is operator-facing — it appears in the low-disk-space warning shown during setup/update staging (createLowDiskSpaceWarning).Current behavior on
main(ec3aa5def4)The unit branch tests the unrounded
mib < 1024, but the MiB branch thenMath.round(mib)s. For any value withmib ∈ [1023.5, 1024)the guard is true (stays in MiB) yet the rounded number is1024, so it prints"1024 MiB".Verified by exercising the real exported function:
and the resulting user-facing warning:
Expected behavior
A value that rounds up to 1024 MiB should be promoted to
"1.0 GiB"(the function should never emit1024 MiB):Duplicate search
src/infra/disk-space.ts(scanned all open PRs by file).formatDiskSpaceBytes/ low-disk-warning wording.git log origin/main -- src/infra/disk-space.tsshows no prior fix for this.Candidate fix
Round MiB first, then choose the unit on the rounded value so
roundedMib === 1024falls through to the GiB branch. Add a regression test for the[1023.5, 1024)boundary in the existingsrc/infra/disk-space.test.ts.