Repository navigation
fix(ui): carry rounded durations into the next unit - #5858
Conversation
Both duration formatters rounded the seconds after splitting off whole minutes, so a value just under a boundary printed `1m 60s` (tool activity) or `1m60s` / `60.0s` (session inspector). Round once, then split. Generated-by: Claude Code (Claude Opus 5.5)
hqhq1025
left a comment
There was a problem hiding this comment.
Reviewed commit 68777d9c37177440e9258cc8a94a575c4ab8798b. Both duration formatters now round before splitting into display units, preventing labels such as 60s, 60.0s, and 1m60s at carry boundaries (packages/ui/src/tool-activity/preview-utils.ts:41-52, apps/desktop/src/renderer/application/contracts/session-inspector/session-inspector-panel.tsx:935-943). The new tests cover the 10-second, minute, and second-minute transitions in each surface. I found no substantiated P0–P3 issue in this five-file change.
Locally, the UI and Desktop dependency builds, Desktop main build, renderer typecheck, and both affected test files passed (48/48). The branch merges cleanly with current main and git diff --check is clean. Only the hosted label check is available on this head; I did not independently run the full suite or reproduce the visual Electron fixture. This is not merge approval.
Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.
chihumyum
left a comment
There was a problem hiding this comment.
Looking good. Approving.
Resolve two conflicts: - packages/runtime-host/src/protocol/index.ts: both sides claimed compatibility epoch 199 (main: storage usage query operations from apache#5832; this branch: UsageQuery.callKinds allowlist). Keep main's 199 entry and re-assign the callKinds entry to 200, bumping RUNTIME_HOST_COMPATIBILITY_EPOCH to 200 and updating the comment's rejected-peer reference from epoch-198 to epoch-199. - apps/desktop/src/main/__tests__/session-inspector-usage-stats.test.ts: semantic union. Keep main's new "carries rounded inspector durations into the next unit" test (apache#5858) in its original position and keep all four callKinds/main-summary tests added by this branch; no assertions removed from either side.
Summary
Both duration formatters round the seconds after splitting off whole minutes, so a value just under a boundary prints an impossible label:
@maka/ui)60s→1m 0s60.0s→1m0s1m 60s→2m 0s1m60s→2m0s10.0s→10sBoth now round once and then split into units. Everything else keeps its current format. The inspector helper is exported through the workbar
testingbarrel so the main-process test suite can cover it.Verification
tool-activity-presentation.test.tsandsession-inspector-usage-stats.test.ts; the old implementations produce the values in the left side of each arrow above, so the assertions fail without the change.npm run build, then the two affected suites vianode --test(30/30 and 24/24 pass).npm run lint,npm run format:check,npm run typecheck,npx knip --workspace apps/desktop,npx knip --workspace packages/uiall pass.turn-narrativee2e fixture, with its tooldurationMschanged locally to119_600(the fixture change is not part of this PR, which is why the turn header still shows its own fixture time).AI use
Tool(s) and scope: Claude Code found the bug, drafted the fix and tests, and ran the checks listed above. The commit carries a
Generated-bytrailer.Checklist
Does this PR entail a change in behavior?