Skip to content

Round before picking the unit: storage usage and reset notices - #383

Merged
fylorn merged 1 commit into
devfrom
fix/round-before-unit
Oct 28, 2026
Merged

fylorn merged 1 commit into
devfrom
fix/round-before-unit

Conversation

@fylorn

@fylorn fylorn commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

What this changes

  • Settings → storage usage: a value just under 1 MB or 1 GB now reads "1 MB" / "1 GB" instead of "1024 KB" / "1024 MB". The unit was chosen from the raw byte count and the value rounded afterwards; it now rounds first, the way size() and traffic() in src/format.ts already do.
  • Quota and key-limit notices: the reset time rounds before it picks a unit, matching the menu bar's resets_in(). 1 h 59 min now reads "about 2 hours" (was "about 1 hour", while the menu bar said "2 h" for the same moment); 59.5 min reads "about 1 hour"; 23.5 h reads "about 1 day".

Same class of bug as #381.

Tests

  • src/settings/retention.test.ts: units and the two carry-over boundaries.
  • src-tauri/src/notices/tests.rs: the three rounding boundaries; the singular "1 minute" case moved from 90 s to 70 s, since 90 s now rounds to 2 minutes.

🤖 Generated with Claude Code

Settings > storage usage chose KB/MB from the raw byte count and rounded
afterwards, so a value just under 1 MB or 1 GB read "1024 KB" or
"1024 MB". It now rounds first and moves to the next unit, like size()
and traffic() already do.

Reset times in quota and key-limit notices truncated, so 1 h 59 min read
"about 1 hour" while the menu bar said "2 h" for the same moment. They
now round and then pick the unit, the same way resets_in() does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit 530bf97 into dev Oct 28, 2026
6 checks passed
@fylorn
fylorn deleted the fix/round-before-unit branch October 28, 2026 02:52
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant