Skip to content

[cli] label sizes with binary units (KiB, MiB, GiB, TiB) - #341

Open
erulkey wants to merge 1 commit into
mainfrom
fix/cli-binary-size-units
Open

erulkey wants to merge 1 commit into
mainfrom
fix/cli-binary-size-units

Conversation

@erulkey

@erulkey erulkey commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

The Drives docs describe sizes in binary units (1 TiB default, 16 TiB quota: https://vercel.com/docs/sandbox/concepts/drives), but the CLI divides by 1024 and labels the result with SI units, so the default drive prints as 1 TB:

$ sandbox drives get-or-create workspace
✅ Drive workspace ready.
   │ region: iad1
   │ max size: 1 TB
   ╰ created: 0 seconds ago

formatBytes is shared by drives, snapshots, sessions, ls and stop, so snapshot sizes and network transfer were mislabeled the same way. This changes the unit labels to KiB/MiB/GiB/TiB and leaves the math alone. Same drive from the patched build:

$ sandbox drives ls
NAME        REGION   CREATED       UPDATED       SIZE    ATTACHED SANDBOX   ATTACHED SESSION
workspace   iad1     3 hours ago   3 hours ago   1 TiB   -                  -

Not touching the max size: label wording here. It reads as a plan ceiling when it is the per-drive cap set by --max-size (a 16 TiB drive creates fine on Pro, 17 TiB gets The maxSizeBytes value must not exceed the Drive quota of 17592186044416 bytes). Happy to fold a wording change in if we want one.

Verification: pnpm vitest run in packages/sandbox, 19 files, 121 tests passed including the new test/util/output.test.ts; pnpm typecheck clean; built CLI run against Internal Playground produced the output above.

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.

1 participant