Skip to content

fix(cli): carry rounded-up seconds and kilobytes into the next unit - #5817

Open
rudycelekli wants to merge 2 commits into
heygen-com:mainfrom
rudycelekli:fix/cli-format-rounding-rollover
Open

rudycelekli wants to merge 2 commits into
heygen-com:mainfrom
rudycelekli:fix/cli-format-rounding-rollover

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What

formatDuration and formatBytes in packages/cli/src/ui/format.ts print an out-of-range value when rounding reaches the next unit.

Why

  • formatDuration(59_960) prints 60.0s, and formatDuration(119_970) prints 1m 60.0s. The seconds part is rounded after the minute split, so it can reach 60.
  • formatBytes(1_048_575) prints 1024.0 KB instead of 1.0 MB.

These feed hyperframes cloud render progress and upload lines, info size, and Chrome download progress.

Related work

No overlapping PR found.

How

Round formatDuration to tenths of a second before splitting into minutes and seconds. Round the KB value before comparing it with the MB threshold. Output for all other inputs is unchanged.

Test plan

  • Unit tests added: both rollover cases fail on main and pass with the fix (vitest run src/ui/format.test.ts, 26 tests).
  • oxfmt --check and oxlint clean on the changed files.
  • Manual testing performed (not applicable; pure formatting functions)
  • Documentation updated (not applicable)
  • Comments follow CONTRIBUTING.md "Comments".

Not run locally: workspace typecheck, comment citation/ratchet scripts (they failed to start in my minimal install).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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