Skip to content

docs: correct the format.duration examples and list format.harnessIcon in the view helpers table - #274

Open
connorburgess wants to merge 3 commits into
spacesheep-dev:mainfrom
connorburgess:docs/view-format-helpers
Open

connorburgess wants to merge 3 commits into
spacesheep-dev:mainfrom
connorburgess:docs/view-format-helpers

Conversation

@connorburgess

@connorburgess connorburgess commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Updated against v0.8.19 / main e8bfe999 on 2026-12-05. Current validation and refresh details.

What

Docs only: two rows of the format.* helpers table in docs/theme-authoring.md now match what the host hands a view.

  • format.duration(ms) listed "4 m 12 s", which it never returns: seconds show only in the first minute. The row now gives the examples dur() returns: "<0.1 s", "0.4 s", "12 s", "4 m", "2 h 05 m", "3 d".
  • format.harnessIcon(harness) had no row, though the contract has it (shared/theme-api.ts, optional) and the host wires it (web/src/themes/host/api.ts). The new row is worded from the contract's comment and harnessIconSvg(): { svg, name }, a 14 px mark drawn in currentColor, null for a harness without one, called as format.harnessIcon?.(harness) from TypeScript since it is optional in the type.

The format.ago examples already hold, so that row is unchanged.

Why

format.duration is dur() in web/src/lib/time.ts, and its grammar shows seconds only under a minute; the table kept an example from before that grammar. A theme author sizing a column from the doc expects "4 m 12 s" and gets "4 m". harnessIcon has been on the API since the harness marks landed (in every tag from v0.1.0), but a theme author reading the table would not know it exists.

Original proof (before the v0.8.18 refresh)

A node script that imports web/src/lib/time.ts and web/src/lib/harnessIcons.ts at 6165bed (the functions api.ts wires to format.duration, format.ago and format.harnessIcon):

duration [[20,"<0.1 s"],[400,"0.4 s"],[12000,"12 s"],[252000,"4 m"],[7500000,"2 h 05 m"],[259200000,"3 d"]]
ago [[12000,"12 s ago"],[180000,"3 m ago"],[108000000,"yesterday"]]
harnessIcon claude-code {"name":"Claude Code","svgStart":"<svg xmlns=\"http://www.w3.org/2000/svg\" ","currentColor":true}
harnessIcon no-such-harness null

npm run typecheck && npm run lint && npm test on 48bb870:

Checked 983 files in 202ms. No fixes applied.
Found 135 warnings.

 Test Files  248 passed (248)
      Tests  3367 passed | 2 skipped (3369)

Typecheck printed nothing, and the lint warnings were already there on main. On an earlier run of the suite on this branch, server/control/remote.parity.test.ts hit its 15 s timeout. Unmodified main (6165bed) times out the same way when the whole suite runs (TestTimeoutError: Test timed out in 15000ms, remote.parity.test.ts:343). The test passes when run alone.

Checklist

  • Every commit is signed off (git commit -s): the DCO is the only paperwork.
  • npm run typecheck && npm run lint && npm test pass; npm run test:e2e for a UI change. (No UI change.)
  • New source files start with // SPDX-License-Identifier: Apache-2.0. (None added.)
  • No secret, real address, hostname or home path in code, fixtures or screenshots (screenshots come from --demo).
  • A change to shared/* names the wire-contract change in the description. (No shared/* change.)
  • A line under Unreleased in CHANGELOG.md if a person would notice. (Not added: a person running the GUI would not notice a docs fix.)

…n in the view helpers table

Symptom: docs/theme-authoring.md says format.duration(ms) gives "4 m 12 s",
but a view calling it for 252000 ms gets "4 m". The table also leaves out
format.harnessIcon(harness), which the host has handed to views since the
harness marks landed.

Cause: format.duration is dur() in web/src/lib/time.ts, whose grammar shows
seconds only in the first minute; the table kept an example from before
that grammar. harnessIcon was added to the contract (shared/theme-api.ts)
and wired in web/src/themes/host/api.ts without a row here.

Fix: give the duration row the examples dur() returns ("<0.1 s", "0.4 s",
"12 s", "4 m", "2 h 05 m", "3 d") and add a harnessIcon row worded from
the contract's comment and harnessIconSvg(). The format.ago examples
already hold.

Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
@connorburgess

Copy link
Copy Markdown
Contributor Author

The view format helper documentation correction still applies to SessionPipe GUI v0.8.18. Merged current main (d16a2c01) into this branch; the refreshed head is fdad5e4c. The affected files have not changed upstream, and the original change is preserved.

Validation on this head, macOS / Node 22.23.2:

  • npm run typecheck, npm run lint, and npm run build passed. Lint has the same 135 warnings and one informational diagnostic as current main, with no errors.
  • npx vitest run --maxWorkers=2 web/src/lib/format.test.ts: 41 tests passed.

GitHub CI run 47453783730 for head fdad5e4c is not green. Passed: typecheck · lint · unit · build, e2e (control channel), e2e (desktop 1/3), e2e (desktop 2/3), e2e (phone · duo). Failed: e2e (desktop 3/3), typecheck · lint · unit · build · e2e.

The desktop shard 3 failure is test/e2e/split.spec.ts:662, “covering the page locks both and

with zero background scrollbar and restores window.scrollY on close”: the restored scroll position differs by more than 2 px. Neither this PR nor its refresh changes that test or the split-panel UI. On unmodified main d16a2c01, npx playwright test test/e2e/split.spec.ts --project=desktop --grep "covering the page locks" --repeat-each=6 --workers=2 reproduced four first-attempt failures; all four passed on retry, with two other repetitions passing initially. This establishes baseline flakiness, but does not turn the failed PR run green.

A maintainer needs to rerun the failed job (and aggregate gate), or resolve the baseline flake, before merging. The job-rerun API rejected this account with HTTP 403: “Must have admin rights to Repository.”

Independently evaluated the documented duration examples against the current implementation; every value matches. Also checked the harness icon return shape, Claude Code name, currentColor SVG and unknown-harness null fallback.

Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
@connorburgess

Copy link
Copy Markdown
Contributor Author

Merged current main (e8bfe999, v0.8.19) into this branch; the head is now 63d8c205. The merge was clean; this PR changes only docs/theme-authoring.md.

CI run 47497352567 for head 63d8c205 passed every job: typecheck · lint · unit · build, e2e (desktop 1/3), e2e (desktop 2/3), e2e (desktop 3/3), e2e (phone · duo), e2e (control channel) and the aggregate typecheck · lint · unit · build · e2e gate.

The earlier run 47453783730 on fdad5e4c failed e2e (desktop 3/3) at split.spec.ts:662 ("restores window.scrollY on close", scroll offset 52 px against <= 2). That test also failed on main in run 46543174302 and in run 46536894782 on the unrelated branch fix/workflow-stale-claim-hijack. It passes in the new run.

Locally on 63d8c205 (macOS, Node 22.23.2): npm run typecheck, npm run lint (135 warnings, no errors, as on main) and npm run build passed; npx vitest run web/src/lib/format.test.ts: 41 tests passed.

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