Skip to content

fix(mobile): a relay status we could not read is not "offline" - #20065

Open
nwparker wants to merge 3 commits into
fix/18211-lan-mode-applies-to-paired-devicesfrom
nwparker/mobile-relay-status-unreadable
Open

nwparker wants to merge 3 commits into
fix/18211-lan-mode-applies-to-paired-devicesfrom
nwparker/mobile-relay-status-unreadable

Conversation

@nwparker

@nwparker nwparker commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​53 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​51
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23

Stacked on #19870 (fix/18211-lan-mode-applies-to-paired-devices). Review the top commit only.

Two problems in the same newly-extracted diagnostics collector — both in the artifact a user pastes into a bug report, which is the one place a wrong answer costs a support engineer a round trip.

1. offline was asserted for a status nobody read

.catch(() => 'offline' as const) reported the definite neighbour for a lookup that observed nothing. A support engineer could not tell a host that genuinely reported offline from one that never answered at all.

It reports unreadable now. This is the same distinction docs/reference/ssh-execution-boundary.md draws for execution verdicts: loss of contact is not evidence of a state.

2. The collector could reject, and killed the whole interaction

window.api.mobile.getRelayStatus() throws synchronously when the bridge has no mobile — before .catch is attached. Both call sites fire this as void copyRelayDiagnostics() with the await sitting ahead of their try/catch.

Measured: the click wrote no clipboard and showed no toast at all. Not a wrong diagnostic — no response whatsoever to a button press. The pre-extraction inline payload build could not fail this way, so this was introduced by the extraction.

The collector is total now, and the await moved inside the try, so a future addition cannot silently kill the toast again.

Base

main does not work — the collector this fixes is introduced by fb135c95f71 "share the diagnostics payload with the settings pane", which is in #19870's stack. This is a fix for a defect in that extraction. Merge order: #19870 → this.

Verification

tsc --noEmit -p config/tsconfig.node.json clean · src/renderer/src/components/mobile + src/renderer/src/components/settings — 184 files / 1208 tests passed, 0 failures.

Note for anyone re-running: these are renderer tests and need vitest run --config config/vitest.config.ts. Invoking vitest without it silently fails to resolve the @/ alias and reports 144 files failing with 0 test failures — an infrastructure error that looks nothing like a real regression and reproduces identically on the untouched base.

oxlint clean · oxfmt --check clean. Cherry-picked from nwparker/adv3-failure-fixes, which has no PR.

Rebase record (2026-09-11)

Stack preserved: base stays fix/18211-lan-mode-applies-to-paired-devices (#19870), rebased onto main at 5fa62feda7c264c6eda99ba4788ffebab9aae26c first. Replayed with git rebase --onto 13eee7eacf8a6fcd4bb77ff680d18f727fca1171 9ce190247edbdb508b452e8c62a63c4c2cdd0089.

SHA
old head 42ec350247d40d6fc40f4155f040198653f16459
new head a8a8a954c72b3e21fdc73240cb2b7d7a0a627170
new base (#19870) 13eee7eacf8a6fcd4bb77ff680d18f727fca1171

No conflicts.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • mobile-relay-diagnostics-payload.ts — introduces MobileRelayDiagnosticsStatus (MobileRelayStatus | 'unreadable') and a readRelayStatusForDiagnostics() helper that returns 'unreadable' whenever the status lookup throws or rejects, keeping a host-answered offline distinct from a lookup that observed nothing.
  • MobilePage.tsx / MobilePane.tsx — moves await collectMobileRelayDiagnosticsPayload(...) inside the try so a future collector rejection still surfaces the failure toast instead of a silent dead click.
  • mobile-relay-diagnostics-payload.test.ts — three collector cases: unreadable on rejection, unreadable when the mobile bridge is absent (exercising the synchronous-throw path), and offline when the host actually answers offline.

The fix is well-scoped and the tests are meaningful (each would fail against the prior .catch(() => 'offline') / unwrapped-await behavior). The unreadable vocabulary correctly mirrors the ssh-execution-boundary.md principle without polluting MOBILE_RELAY_STATUSES, and the payload type has no consumers beyond the two Copy-diagnostics buttons, so the widening is safe.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker force-pushed the fix/18211-lan-mode-applies-to-paired-devices branch from 9ce1902 to 13eee7e Compare September 11, 2026 08:10
Two problems in the same newly-extracted collector, both in the artifact a user
pastes into a bug report.

`.catch(() => 'offline' as const)` reported the definite neighbour for a lookup
that observed nothing, so a support engineer could not tell a host that reported
offline from one that never answered. It now reports `unreadable`.

And the collector could reject: `window.api.mobile.getRelayStatus()` throws
synchronously when the bridge has no `mobile` — before `.catch` is attached —
while both call sites fire this as `void copyRelayDiagnostics()` with the await
sitting AHEAD of their try/catch. Measured: the click wrote no clipboard and
showed no toast at all, where the pre-extraction inline payload build could not
fail. The collector is total now, and the await moved inside the try so a future
addition cannot silently kill the toast again.
@nwparker
nwparker force-pushed the nwparker/mobile-relay-status-unreadable branch from 42ec350 to a8a8a95 Compare September 11, 2026 08:13
Clean auto-merge. MobilePage/MobilePane were touched by both sides; verified
the base's mint-override split (recoverWithLanMint) survives intact.

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