Repository navigation
fix(resource-renderers): show MB when an image size rounds to 1024 KB - #1096
Merged
Rinat S (rsolmano) merged 3 commits intoNov 1, 2026
Merged
Conversation
kevin (kevin9327)
requested review from
Olga Lavrichenko (OLavrik),
Rustam Sadykov (SBOne-Kenobi),
danyaberezun and
Rinat S (rsolmano)
as code owners
October 31, 2026 01:00
Rinat S (rsolmano)
approved these changes
Oct 31, 2026
Rinat S (rsolmano)
enabled auto-merge
November 1, 2026 12:55
3 of 5 tasks
2 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
formatByteLength(the size shown in the image viewer's info line and in the image diff) picks KB for anything under 1 MiB, then rounds. Sizes in the last half-kilobyte before 1 MiB round up to 1024, so they are shown as1024 KBinstead of moving to MB:A 1,048,575-byte image reads
1024 KBwhile a 1,048,576-byte one reads1.0 MB.Approach
The KB figure is formatted first, and KB is used only while that rounded figure is below 1024; otherwise the existing MB branch formats it. Every other size, and the 1-decimal/0-decimal rule, is unchanged.
Changes
imageState.ts:formatByteLengthchecks the rounded KB figure before choosing KB.index.test.ts: one size just under 1 MiB reads1.0 MB, one that rounds to 1023 stays1023 KB, and exactly 1 MiB stays1.0 MB. The first case fails onmain(1024 KB) and passes with the change.Screenshots
Not applicable: the visible effect is the size text above (
1.0 MBinstead of1024 KB).Related issues
None found.
Checklist
bun run lint,bun run typecheck,bun run test. I ranbiome check(2.5.0) on the two changed files and the new cases againstimageState.tswithbun test(the fullindex.test.tsneeds the locales package installed): they pass, and the first one fails without the fix. I did not run the full workspace gates.SPEC.md/ top-level specs updated to reflect any boundary, contract, or behavior change (no contract change)This change was prepared with AI assistance; I reviewed it and ran the tests above locally.