Skip to content

fix(desktop,mobile,docs): legible rail type scale; drop the stale one-phone pairing note - #1317

Merged
huichen merged 6 commits into
mainfrom
pr/huichen
Oct 23, 2026
Merged

huichen merged 6 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

What

The desktop activity rail had lost its type hierarchy: cn() handed text-13 to tailwind-merge, which does not know that step (it lives in globals.css, not Tailwind's own table) and read it as a text colour, so the size was silently dropped and the rail's rows fell back to the inherited size. cn() now declares the app's own font-size steps, the rail chrome / rows / menus / search / device selector are re-leveled on top of that, and the two smallest steps stop shrinking below 10px when the reader scale is turned down.

The stale "pairing here replaces that desktop's current phone pairing" sentence is removed from the desktop and mobile copy, since a desktop no longer accepts only one phone.

Commits

  • fix(desktop): give the activity rail a readable type hierarchy
  • fix(desktop): floor the two smallest type steps at 10px
  • docs(desktop,mobile): drop the stale single-phone pairing note

Verification

Run locally on branch tip 9346b60f2:

  • npx eslint "src/**/*.{ts,tsx}" "shot/**/*.{ts,tsx}" "vite.shot.config.ts" (desktop) → 0 errors; 1 pre-existing jsdoc/no-multi-asterisks warning in src/components/layout/recentOrder.ts, a file this branch does not touch
  • npx tsc --noEmit (desktop) → clean
  • npx vitest run (desktop) → 375 files, 5215 tests passed
  • npx stylelint "src/styles/globals.css" (desktop) → clean
  • npx tsc --noEmit (mobile) → clean
  • npx jest --runInBand src/i18n (mobile) → 3 suites, 26 tests passed

No Rust crate is touched, so no cargo fmt / clippy / test run.

Notes

  • cn() is now built from extendTailwindMerge with the app's text-13 step declared as a font size. A future --text-<n> token needs a matching line there, otherwise it will be read as a colour again.
  • --text-3xs and --text-2xs use max(10px, scaled); scaling up is unchanged.

A desktop no longer serves one phone pairing: `pair_new_device` adds a
device beside the ones already paired (up to the platform's five-slot
allowance) and only `re_pair` replaces. The copy still told readers the
opposite.

- mobile: the "已配对的桌面端" subtitle stops at "一台手机可配对多个桌面端".
- desktop: the add-desktop form loses `slotWarning` and its paragraph.
- internals docs: the mobile capability line and the two CONNECTION.md
  passages that called the host side single-slot now say what the slot
  book does.
Measured on the real interface (1280x860, 288px rail, default text size), the
rail drew its navigation entries, its workspace headings and its conversation
titles at one size and one weight — 22 leaf labels at 14px/500 — so the level
had to be read off a single step of ink, and the group headings carried neither
weight nor colour to set them apart from the rows they head.

- Rows and headings take `text-13`. At 13px the 203px title column fits about
  one more CJK character, which is enough for the one title that clipped at
  14px (`PRISMA 流程图的筛选数字对不上`, 210px of text in a 203px column); the
  same page now clips nothing.
- A group heading is `font-semibold text-ink` over a row's `font-medium
  text-ink-soft` — weight and colour, not just the folder glyph and its indent.
- One size per tier: the device picker and the search field share a 28px row,
  so both are 13px instead of 12 and 14, and the picker's own menu entries
  match the control that opens them.
- Menus are no longer the loudest layer in the rail: the conversation and
  workspace menus go from 14px/500 to 13px/400, and the account name from 14px
  to 13px.

`cn()` is extended for the same reason the rows needed it: `tailwind-merge`
reads an unknown `text-*` as a *text colour*, so `cn("text-13 … text-ink-soft")`
kept the colour and silently dropped the size — the titles rendered at the
inherited 16px with nothing failing. `cn.test.ts` pins that merge behaviour.

Unchanged on purpose: section headers and the view switch stay at 12px, row
ages and count badges at 11px, and navigation entries stay at 14px — one step
above the list they lead into.
The reader's text size scales every `--text-*` token, including the two steps
below `text-xs`. On "Small" (0.85) that put `--text-2xs` at 9.35px and
`--text-3xs` at 8.5px — the sizes of row ages, count badges and the device
picker's status notes. Those are short CJK strings, and at 8.5–9.35px they are
unreadable rather than merely quiet, which is a usability defect in the size
setting rather than a matter of taste.

Both now read `max(0.625rem, …)`: a 10px floor that only binds on "Small"
(measured: 9.35px → 10px for an age label, unchanged at 11px on Medium).
Scaling up is untouched — 0.625rem × 1.35 is 11.3px, already above the floor.

`--text-*` is the only thing this touches: spacing, borders and widths stay in
design-time pixels.
@huichen
huichen enabled auto-merge (squash) October 23, 2026 10:18
@huichen
huichen merged commit af0a718 into main Oct 23, 2026
12 checks passed
@huichen
huichen deleted the pr/huichen branch October 23, 2026 10:34
huichen added a commit that referenced this pull request Oct 23, 2026
The size scale's floor (10px, #1317/#1318) is only visible in two places: a
pending attachment's byte size in the composer (the 10 design size) and an
approval card's own label (the 11 design size). Neither state was reachable from
the demo catalogue — the composer's draft is empty in every capture, and the
demo conversation never carries an approval — so the only evidence those two
labels clear 10px was a rendering of the numbers, not of the screens.

Two opt-in fixtures, both reproducing state the shipping code reads:

  ?draft=attachments  seeds `draftStorage`'s record for the new-conversation
                      slot, which the composer restores through
                      `loadSessionDraft` exactly as after a visit.
  ?approval=1         feeds a real `approval_request` event through the
                      shipping projection, so the card and its label are the
                      ones the app draws.

Nothing under `src/` is replaced or bypassed, and `leanRender.ts` is untouched:
both hooks are the query-param pattern the mock already uses for `?recent`,
`?held` and `?compactionDelay`.

Two scenarios capture them at the smallest text size and assert what the
capture is for: both sizes are ≥ 10px and neither label overflows its box.
Without the floor they fail (`[9,9]` and `9`) — checked by removing it.

One thing the captures show that is not changed here: the approval label reads
"SHELL 命令" — `textTransform: uppercase` only affects the Latin half of the
localised string, so the zh label is not uniformly uppercase. Cosmetic, and
out of scope for a fixture.

Pre-existing, unrelated: `capture-mobile chat` fails on the base commit too
("the badge carries no glyph: 实验室的 MacBook Pro"), since #1314 moved machine
icons from emoji to components. Not touched here.
huichen added a commit that referenced this pull request Oct 23, 2026
)

The size scale's floor (10px, #1317/#1318) is only visible in two places: a
pending attachment's byte size in the composer (the 10 design size) and an
approval card's own label (the 11 design size). Neither state was reachable from
the demo catalogue — the composer's draft is empty in every capture, and the
demo conversation never carries an approval — so the only evidence those two
labels clear 10px was a rendering of the numbers, not of the screens.

Two opt-in fixtures, both reproducing state the shipping code reads:

  ?draft=attachments  seeds `draftStorage`'s record for the new-conversation
                      slot, which the composer restores through
                      `loadSessionDraft` exactly as after a visit.
  ?approval=1         feeds a real `approval_request` event through the
                      shipping projection, so the card and its label are the
                      ones the app draws.

Nothing under `src/` is replaced or bypassed, and `leanRender.ts` is untouched:
both hooks are the query-param pattern the mock already uses for `?recent`,
`?held` and `?compactionDelay`.

Two scenarios capture them at the smallest text size and assert what the
capture is for: both sizes are ≥ 10px and neither label overflows its box.
Without the floor they fail (`[9,9]` and `9`) — checked by removing it.

One thing the captures show that is not changed here: the approval label reads
"SHELL 命令" — `textTransform: uppercase` only affects the Latin half of the
localised string, so the zh label is not uniformly uppercase. Cosmetic, and
out of scope for a fixture.

Pre-existing, unrelated: `capture-mobile chat` fails on the base commit too
("the badge carries no glyph: 实验室的 MacBook Pro"), since #1314 moved machine
icons from emoji to components. Not touched here.
huichen added a commit that referenced this pull request Oct 23, 2026
… rows and the last log tail (#1321)

* feat(desktop-shot): render the two sub-`text-xs` labels on demand

The size scale's floor (10px, #1317/#1318) is only visible in two places: a
pending attachment's byte size in the composer (the 10 design size) and an
approval card's own label (the 11 design size). Neither state was reachable from
the demo catalogue — the composer's draft is empty in every capture, and the
demo conversation never carries an approval — so the only evidence those two
labels clear 10px was a rendering of the numbers, not of the screens.

Two opt-in fixtures, both reproducing state the shipping code reads:

  ?draft=attachments  seeds `draftStorage`'s record for the new-conversation
                      slot, which the composer restores through
                      `loadSessionDraft` exactly as after a visit.
  ?approval=1         feeds a real `approval_request` event through the
                      shipping projection, so the card and its label are the
                      ones the app draws.

Nothing under `src/` is replaced or bypassed, and `leanRender.ts` is untouched:
both hooks are the query-param pattern the mock already uses for `?recent`,
`?held` and `?compactionDelay`.

Two scenarios capture them at the smallest text size and assert what the
capture is for: both sizes are ≥ 10px and neither label overflows its box.
Without the floor they fail (`[9,9]` and `9`) — checked by removing it.

One thing the captures show that is not changed here: the approval label reads
"SHELL 命令" — `textTransform: uppercase` only affects the Latin half of the
localised string, so the zh label is not uniformly uppercase. Cosmetic, and
out of scope for a fixture.

Pre-existing, unrelated: `capture-mobile chat` fails on the base commit too
("the badge carries no glyph: 实验室的 MacBook Pro"), since #1314 moved machine
icons from emoji to components. Not touched here.

* fix(screenshots): check the machine mark rendered, not for an emoji

`capture-mobile chat` had been failing with "the badge carries no glyph" since
#1314 replaced the emoji machine marks with the shared icon component
(`PeerIconGlyph`). The assertion looked for `💻` in the badge's text, which is
where an emoji would have been — the picture changed, the check kept reading
text. The same assertion in `capture-desktop remote-conversation` looked for
`💻` too and was still passing only by accident: the desktop badge's emoji had
already become an icon, so it was one glyph away from the same failure.

Both now check the fact the assertion was ever about: that the mark rendered.
The badge must contain an `<svg>` at least 8x8 carrying at least one shape. That
still fails when the icon stops drawing — verified by removing it, which turns
both captures red ("draws no machine icon") — and no longer cares whether the
mark is an emoji, a line icon, or something else later.

The two spots are the only glyph lookups in the scenario table; the remaining
single-character assertions all match real copy (中 / 你 / 接管 / 本机 / …), so
nothing else changed. `scripts/screenshots/scenarios.json` is the only file,
two lines replaced.

Not in scope, for the record: the shot scripts run in no workflow, which is why
this assertion could rot from #1314 until now with nothing noticing. Whether to
put them in CI is a cost decision for the product side, not something this
change should slip in.

* feat(host): keep the previous run's log tail and timestamp host reports

`app/logs/desktop.log` is a 1000-line ring buffer, so a launch that never came
back was evicted within minutes of the next ordinary session: the only evidence
left for "what went wrong?" was gone.

`start_logging` now copies the newest 1000 lines left by the previous run to
`desktop.prev.log` beside it, before the live log is opened and trimmed. The
tail is located by scanning backwards in 8 KiB reads (no whole-file buffer),
written through a staging file and renamed into place, and best effort: a copy
that cannot be made never costs this launch its log. The live file keeps its
name, format and retention unchanged.

`report()` output now leads with a UTC stamp shaped like the tracing rows in the
same file (`2026-10-23T12:41:16.186523Z`), on stderr and in the log. Without it,
two launches twenty minutes apart read as one simultaneous pair.

* fix(desktop): keep a remote host's rows through a catalogue read it did not answer

The merged list is built from the hosts' catalogues, and every 5 s poll replaced them wholesale: a connected host whose list_sessions read failed (a store busy serving the page the user had just opened, one round trip timing out over a live socket) had its entry dropped, so its conversations left the sidebar and came back on the following poll - which is the reported 'the session disappears, then reappears a while later' when clicking a remote conversation. The phone already keeps its last snapshot on a failed read.

A host that is asked and silent keeps the snapshot it last sent, for one round only: refresh reads the peer list first, so a host that is genuinely gone is not connected next time, is not asked, and loses its rows then. A host that is not asked at all (disconnected, stopped, in standby, unpaired) keeps the old rule.

* feat(desktop): name this machine on the Remote page

The host section listed only pair ids, which name a connection, so a user holding a phone that had just paired had nothing on either screen to match the two by: the id the phone recorded is this machine's own, and no surface rendered it.

One line under the switch, only while the switch is on, with the same copy affordance the pairing code uses.
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