ui-react: run durations read "1m 60s" and "60.0s" because rounded seconds never carry
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- bun, typescript
- Domain
- frontend
Research direction
Start with packages/ui-react/src/lib/duration.ts and the existing formatDuration tests in packages/ui-react/tests/tool-views.test.ts. Round to the displayed precision before splitting seconds and minutes, then add the listed edge cases and sweep; done means no output has a seconds part of 60 or more and the existing expectations still pass. Run bun run test packages/ui-react/tests/tool-views.test.ts to verify.
Written by the indexing model from the issue text.
Description
Context
formatDuration (packages/ui-react/src/lib/duration.ts:2-10) rounds the seconds part on its own, after it has already taken the minutes, so the seconds can round up to 60 without carrying. It also rounds sub-minute values to one decimal without carrying into minutes. Run against the current tree:
| Input (ms) | Output | Expected |
|---|---|---|
59_950 |
60.0s |
1m 0s |
59_999 |
60.0s |
1m 0s |
119_500 |
1m 60s |
2m 0s |
3_599_500 |
59m 60s |
60m 0s |
It labels every run duration, approval wait and timeline row in Activity. Callers include activity-run-list.tsx:42, :71; activity-run-detail.tsx:189, :267, :299, :353; run-lanes.tsx:43, :64; turn-timing.tsx:6-17; and tool-call-timeline.tsx:168, :426. There are 20 call sites in all. Its tests (packages/ui-react/tests/tool-views.test.ts:162-173) cover only exact boundaries.
Guide: js/format-human-readable-durations (the fix needs no Intl; consolidation is #2606).
Scope
- Round the whole value to the precision that will be displayed before splitting it into units: tenths of a second below one minute, whole seconds from one minute up. A value that rounds to 60.0s renders as
1m 0s. - Add the four rows above, plus
999.9 → "1.0s"and60_000 → "1m 0s", to theformatDurationtests.
Out of scope
- An hours unit.
3_600_000stays60m 0shere, and #2606 owns the format. Intl.DurationFormat, and any other formatter.- Callers.
Acceptance criteria
-
formatDuration(119_500) === "2m 0s",formatDuration(59_950) === "1m 0s"andformatDuration(3_599_500) === "60m 0s". - No output of
formatDurationcontains60sor60.0s. A test sweeps 0–7_200_000 ms in 50 ms steps and asserts that the seconds part is below 60 everywhere. - The new tests fail on the tree before the change and pass after. Record both runs in the PR.
- Existing expectations (
0.5s,2.5s,1m 0s,1m 30s) are unchanged.
Verification
bun run test packages/ui-react/tests/tool-views.test.ts
bun run test
bun run typecheck
bun run lint
Contract impact
- This touches the integration contract, so it needs the
contractlabel, aCONTRACT:commit prefix, and the doc updated in the same commit. - This changes a published package's behaviour, so it needs a changeset.
@schlessera/brain-ui-react: patch.
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- Avg merge
- 5h 38m
- Merged PRs (30d)
- 960
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from schlessera/brain-kit
-
area: ci type: test
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
schlessera/brain-kit#2769 ·
Maintainers usually reply within 1 day
-
agent-ready area: ui-server priority: p2 type: test
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
schlessera/brain-kit#2758 ·
Maintainers usually reply within 1 day
-
agent-ready area: ui-react blocked priority: p0 type: fix
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
schlessera/brain-kit#2723 · 1 comment ·
Maintainers usually reply within 1 day
-
agent-ready area: ci area: ui-react priority: p2 type: test
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
schlessera/brain-kit#2615 · 1 comment ·
Maintainers usually reply within 1 day
-
agent-ready area: ci area: docs type: docs
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
schlessera/brain-kit#2612 ·
Maintainers usually reply within 1 day
All issues in schlessera/brain-kit
Similar issues
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefixPossibly taken @ItsDeadlyProgrammer claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
appsmithorg/appsmith#42471 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ehmpathy/rhachet-roles-bhrain#705 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Status: Triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
mermaid-js/mermaid#8546 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
braintrustdata/braintrust-sdk-javascript#2659 ·
Maintainers usually reply within 1 day