Repository navigation
fix(mobile): floor the smallest type sizes at 10px - #1318
Merged
Merged
Conversation
The reader's text size scales every design size from one place (`theme.font` / `theme.leading`). On "Small" (0.85) that took the 10 and 11 design sizes to 9px: the composer's pending-attachment size and the approval card's uppercase labels. Short CJK strings are unreadable rather than merely quiet at 9px, which makes it a defect in the size setting and not a matter of taste. `scaleSize` now clamps to `Math.max(10, Math.round(size * scale))` — the same 10px floor the desktop's `--text-3xs` / `--text-2xs` keep, so both apps answer "how small may text get" identically. It binds on "Small" alone: `medium` is the size everything was drawn at, and the two larger steps only grow. `Math.round`, not `Math.ceil`: ceil lifts every size at 0.85 (12 → 11, 13 → 12, 108 call sites), which pulls "Small" towards "Medium" and stops the setting from being small at all. `round` plus the floor touches only the two design sizes below 12. The clamp stays in the one shared function because `leading` reads it too and every line height clears it — the smallest is `leading(14)`, which lands at 12 on "Small" — so splitting it would only create a second thing to keep in step. At this size 10 and 11 now resolve to the same value. That is accepted: they are an attachment's size and an approval label, on different screens that never appear side by side, and a hierarchy carried by 1px is not one worth keeping.
huichen
enabled auto-merge (squash)
October 23, 2026 10:35
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The mobile app's two smallest type sizes kept scaling down with the reader-size preference until short CJK labels became unreadable rather than merely quiet. They now keep a 10px floor while scaling up is unchanged, so a phone set to the smallest reading size still renders ages, badges and status notes legibly.
This mirrors the floor the desktop's
--text-2xs/--text-3xssteps received.Commits
Verification
Run locally on branch tip
0f8a6b86b(after replaying ontomain):npx jest --runInBand src/theme(mobile) → 4 suites, 31 tests passednpx tsc --noEmit(mobile) → cleanNo Rust crate and no other package is touched, so no cargo builds and no desktop suite run.
Notes
The floor applies only to the two smallest steps; the larger steps still follow
--app-font-scalein both directions.