Skip to content

fix(remote): what rendering the client role's screens for real turned up - #983

Merged
huichen merged 2 commits into
mainfrom
fix/remote-render-pass
Oct 11, 2026
Merged

huichen merged 2 commits into
mainfrom
fix/remote-render-pass

Conversation

@huichen

@huichen huichen commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

What

The screenshot harness renders the real app — real CSS, real bundle, real input events — and had never been run against the client role: there was no scenario for any of its screens. Running it found six defects, one of them from the first PR of the series, and none of them visible to the jsdom suite.

1. The harness was rendering blank pages, for every scenario

remote_peer_list was read straight into React state, so a backend answering null — the harness mock does, for a command it does not implement — put null into peers, and the first screen that rendered it threw during render and took the whole application down. Not just the remote screen: every capture since #955 was a white rectangle, and nobody noticed because no scenario runs in CI.

Validated at the helper boundary now: an empty list is the honest reading of "no answer".

2. A turn that ran several tools showed only the first

The transcript did blocks.find(tool_call), so a turn that ran read then shell rendered one row — and the second call's arguments were never fetched, so the line saying what the machine actually ran was missing. One row per call now, each fetching its own target. The old fixture had one tool per turn, which is exactly why the tests agreed with the bug.

3. The local conversation tree disappeared in merged mode

Merged mode turns on as soon as any host is connected, and it passed neither depth nor hasChildren to local rows: forks rendered as roots, with no indent and no fold toggle. Every user of the client role silently lost their tree. The rail now keeps each local row's place, and collapsing a parent hides its forks exactly as the local list does — a toggle that renders but does nothing would have been worse than none.

4. The client direction's explanation was printed twice

The hub renders it as the section subtitle and the section rendered it again. The host half was fixed in the same PR that introduced this; only the client half was missed. Now guarded by an assertion that the sentence appears exactly once.

5. A button's label wrapped into two stacked lines

The host-settings "保存" button measured 44×32 with two line boxes (保 over 存): the shared Button had no whitespace-nowrap. A control whose label is unreadable is not a control.

6. The device selector had no accessible name

Its visible name starts with a decorative glyph, so the control's accessible name was the emoji — unreadable to a screen reader, unaddressable by label. aria-label added.

Verified as not defects, by measurement rather than by eye

A visual read claimed the remote conversation's header overlapped its compress button, and that the button contained an overlapping icon. Measured: the header does not overflow (scrollWidth == clientWidth), no two children's boxes intersect, and the button renders no icon at all ({t("compact")} and nothing else). Both claims were artefacts of a magnified crop; the code is unchanged.

Also

Two scenarios were broken by the #965 rename of the rail entry — they still tapped "手机遥控" — which is what a scenario file nothing runs in CI turns into.

New scenarios (remote-hub, remote-merged, remote-device-picker, remote-conversation, remote-host-settings, remote-host-tasks), each with eval assertions against the rendered DOM: both directions named, this machine's and the host's conversations interleaved, a row naming its host, a remote composer saying where the message runs, tool targets read back, the host's model in the picker, no API key anywhere in the UI, and no duplicated explanation. The desktop mock gained the client-role commands and a two-host fixture — one connected, one disconnected, because "a host that is not reachable" is a state the list has to survive.

Verification: 11/11 scenarios captured (7 new + 4 pre-existing as a regression net) with every assertion passing; 3679 tests; tsc/eslint/stylelint clean; 0 uncovered lines added.

Process note

I again created the branch in the main checkout, against the repo's rule. Recovered properly: cherry-picked into .worktrees/remote-render, stray branch deleted, main left at origin/main and clean. No commit was lost (it was recovered from the reflog) and nothing was pushed from the main checkout.

The screenshot harness renders the real app (real CSS, real bundle, real input
events) and had not been run against this feature — there was no scenario for any
client-role screen. Running it found six defects, one of them mine from the first
PR and none of them visible to the jsdom suite.

**1. The harness was rendering blank pages, for every scenario.** `remote_peer_list`
was read straight into React state, so a backend that answers `null` — the harness
mock does, for a command it does not implement — put `null` into `peers`, and the
first screen that rendered it (`peers.map`) threw during render and took the
*whole application* down. Not just the remote screen: every capture since #955
produced a white rectangle, and nobody noticed because no scenario runs in CI.
Validated at the helper boundary now (an empty list is the honest reading of "no
answer"), with a test.

**2. A turn that ran several tools showed only the first.** The transcript did
`blocks.find(tool_call)`, so a turn that ran `read` then `shell` rendered one row —
and the second call's arguments were never fetched, so the line that says what the
machine actually ran was simply missing. One row per call now, each fetching its
own target, with the fixture updated to a two-call turn (the old fixture had one
tool per turn, which is why the tests agreed with the bug).

**3. The local conversation tree disappeared in merged mode.** Merged mode turns
on as soon as *any* host is connected, and it passed neither `depth` nor
`hasChildren` to the local rows: forks rendered as roots, with no indent and no
fold toggle, so a user with a host connected lost their tree. The rail now keeps
each local row's place, and collapsing a parent hides its forks exactly as the
local list does — a toggle that renders but does nothing would have been worse
than no toggle.

**4. The client direction's explanation was printed twice** on the Remote page:
the hub renders it as the section subtitle and the section rendered it again. The
host half had been fixed in the same PR that introduced this; only the client half
was missed.

**5. A button's label wrapped into two stacked lines.** The host-settings "保存"
button measured 44×32 with the label on two line boxes (保 over 存) — the shared
`Button` had no `whitespace-nowrap`. Now it does, with a test; a control whose
label is unreadable is not a control.

**6. The device selector had no accessible name.** Its visible name starts with a
decorative glyph, so the control's accessible name was the emoji — unreadable to a
screen reader and unaddressable by label. `aria-label` added.

**Verified as *not* defects, by measurement rather than by eye.** A visual read
claimed the remote conversation's header overlapped its compress button and that
the button contained an overlapping icon. Measured: the header does not overflow
(`scrollWidth == clientWidth`) and no two children's boxes intersect; the button
renders no icon at all (it is `{t("compact")}` and nothing else). Both claims were
artefacts of a magnified crop, and I left the code alone.

**Two scenarios were also broken** by the #965 rename of the rail entry — they
still tapped "手机遥控" — which is what a scenario file nothing runs in CI does.

**New scenarios (desktop):** `remote-hub`, `remote-merged`, `remote-device-picker`,
`remote-conversation`, `remote-host-settings`, `remote-host-tasks`, each with `eval`
assertions against the rendered DOM: both directions named, this machine's and the
host's conversations interleaved, a row naming its host, a remote composer saying
where the message runs, tool targets read back, the host's model in the picker, no
API key anywhere in the UI, and no duplicate explanation. The harness's desktop
mock gained the client-role commands (peers, catalogues, workspaces, the routed
`remote_peer_request` family) and a two-host fixture — one connected, one
disconnected, because "a host that is not reachable" is a state the list has to
survive.

11/11 scenarios captured (7 new, 4 pre-existing as a regression net) with every
assertion passing, and 3679 tests with 0 uncovered lines added.
@huichen
huichen enabled auto-merge (squash) October 11, 2026 06:15
CI lints `shot/**` as well as `src/**`; my local run only covered src, so this
reached CI. Running the project's own lint script (which is what CI runs) is the
scope that matters — the same lesson as clippy's --no-default-features earlier.
@huichen
huichen merged commit 14dab17 into main Oct 11, 2026
12 checks passed
@huichen
huichen deleted the fix/remote-render-pass branch October 11, 2026 06:25
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