Skip to content

fix(ui): carry rounded durations into the next unit - #5858

Merged
chihumyum merged 1 commit into
apache:mainfrom
Jacky040124:fix/duration-seconds-rollover
Sep 30, 2026
Merged

chihumyum merged 1 commit into
apache:mainfrom
Jacky040124:fix/duration-seconds-rollover

Conversation

@Jacky040124

@Jacky040124 Jacky040124 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Both duration formatters round the seconds after splitting off whole minutes, so a value just under a boundary prints an impossible label:

ms tool activity (@maka/ui) session inspector (desktop)
59 600 60s → 1m 0s —
59 960 — 60.0s → 1m0s
119 600 1m 60s → 2m 0s 1m60s → 2m0s
9 960 10.0s → 10s —

Both now round once and then split into units. Everything else keeps its current format. The inspector helper is exported through the workbar testing barrel so the main-process test suite can cover it.

Verification

  • New cases in tool-activity-presentation.test.ts and session-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 via node --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/ui all pass.
  • Desktop app, before and after: a Bash tool row whose result took 119 600 ms. Captured with the turn-narrative e2e fixture, with its tool durationMs changed locally to 119_600 (the fixture change is not part of this PR, which is why the turn header still shows its own fixture time).
Tool row shows 1m 60s on main and 2m 0s with this PR

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

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-by trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

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)
@github-actions github-actions Bot added the effort/S Under 100 readable lines label Sep 29, 2026

@hqhq1025 hqhq1025 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 chihumyum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Approving.

@chihumyum
chihumyum merged commit 0aa2707 into apache:main Sep 30, 2026
2 checks passed
ggbdpq added a commit to ggbdpq/maka that referenced this pull request Sep 30, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants