Skip to content

Show sizes that round to 1000 MB in GB - #81

Merged
omlahore merged 2 commits into
omlahore:mainfrom
Parth-Jadhav-2004:fix-73-size-gb-rounding
Oct 23, 2026
Merged

omlahore merged 2 commits into
omlahore:mainfrom
Parth-Jadhav-2004:fix-73-size-gb-rounding

Conversation

@Parth-Jadhav-2004

@Parth-Jadhav-2004 Parth-Jadhav-2004 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Term.size checked for 1 GB before rounding, so 999,999,999 bytes came out as "1000 MB". Anything from 999.5 MB up now takes the GB branch and shows "1.0 GB" instead.

Includes a selftest check covering the boundary on both sides (999,499,999 stays "999 MB"; 999,500,000 and 999,999,999 show "1.0 GB") plus the unchanged 1 GB and small-MB paths.

Testing: I could not run swift build/selftest locally (Linux checkout, no Swift toolchain, macOS-15.1 target), so this relies on CI's build + self-test gate. The boundary logic was verified separately: old code prints "1000 MB" for 999,999,999 and 999,500,000; fixed code prints "1.0 GB", and a sweep of every byte from 999,499,990 to 1,000,000,009 never prints "1000 MB".

Fixes #73.

Summary by CodeRabbit

  • Bug Fixes
    • File sizes near the megabyte-to-gigabyte boundary now display in gigabytes when their rounded value would otherwise appear as 1,000 MB. This provides clearer, more consistent size formatting while preserving the existing display for exact megabyte and gigabyte values.

Term.size checked for 1 GB before rounding, so 999,999,999 bytes
came out as "1000 MB". Anything from 999.5 MB up now takes the
GB branch and shows "1.0 GB", with a selftest check covering the
boundary on both sides.

Fixes omlahore#73.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 19:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 08fceeab-b8ca-4b77-b853-ac8120830ce5
📥 Commits

Reviewing files that changed from the base of the PR and between 2feb038 and 9e236dd.

📒 Files selected for processing: 2
  • Sources/removemacai/SelfTest.swift
  • Sources/removemacai/Term.swift
+-----------------------------------------+
| Code review: now with 100% more rabbit. |
+-----------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 67415596-94bb-4081-98bd-69d85632e4ef
📥 Commits

Reviewing files that changed from the base of the PR and between e110446 and 2feb038.

📒 Files selected for processing: 2
  • Sources/removemacai/SelfTest.swift
  • Sources/removemacai/Term.swift

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

📝 Walkthrough

Term.size now switches from MB to GB at 999,500,000 bytes. Self-tests cover values around this rounding boundary and retain a megabyte-format check.

Changes: Size formatting

Layer / File(s) Summary
GB rounding boundary
Sources/removemacai/Term.swift, Sources/removemacai/SelfTest.swift
Term.size now uses GB formatting from 999,500,000 bytes. Self-tests check values below and at the boundary, plus an existing MB case.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: bubleg

Merge Risk: ⚪ Minimal · up to 2feb0

No actionable merge-blocking issue was found.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: sizes that round to 1000 MB now display in GB.
Linked Issues check Passed Issue #73 requires GB formatting for sizes that would round to 1000 MB and a regression check. Term.size now uses the 999,500,000-byte threshold and formats those values as GB. SelfTest.swift chec…
Out of Scope Changes check Passed The pull request changes only Term.size and adds its focused SelfTest coverage. These changes directly implement Issue #73. No unrelated change is shown in the whole-pull-request diff.
Full details: Linked Issues check

Explanation

Issue #73 requires GB formatting for sizes that would round to 1000 MB and a regression check. Term.size now uses the 999,500,000-byte threshold and formats those values as GB. SelfTest.swift checks 999,499,999, 999,500,000, 999,999,999, 1,000,000,000, and 5,000,000 bytes.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

# Conflicts:
#	Sources/removemacai/SelfTest.swift
@omlahore
omlahore merged commit 1f4d226 into omlahore:main Oct 23, 2026
1 of 2 checks passed
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.

Sizes just under 1 GB show as "1000 MB"

3 participants