Skip to content

fix(desktop,mobile): never display a device name the wire mangled - #1589

Merged
huichen merged 2 commits into
mainfrom
pr/huichen
Nov 11, 2026
Merged

huichen merged 2 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

What

Both clients now refuse to show a device name the wire mangled. A phone's standby notice read, verbatim:

已被 FutureOS Desktop (␦␦␦␦␦␦ļ␦) 接管,现在发不出去。

That is a Chinese computer name that a launcher had decoded with a local code page, arriving as one U+FFFD per lost byte, printed on the one notice that explains why nothing sends.

87b60f7c5 fixed where such a name is produced and where it enters the relay, but the rule never reached a screen: every client printed whatever it was handed. This applies the host's rule (usable_name / declared_name) at the client rendering junctions.

  • Mobile: new readableDeviceName in remote/deviceName.ts, used by the composer's standby notice, the connection popover, the standby page, the settings page, the paired-machines list, and the two toasts that name the holder when a send is refused. A stored pairing name goes through it too, falling back to the machine id, so a name learned before the fix does not stay on the list forever.
  • Desktop: peerHolderName already turned "no name" into null; it now also refuses names carrying replacements or control characters.

A name in Chinese is still a name — the test is replacements, not non-ASCII.

Commits

  • fix(desktop,mobile): never display a device name the wire mangled

Verification

Local, on the branch tip aafc7953d (worktree with the main checkout's node_modules linked in):

  • tsc --noEmit (desktop) → clean; eslint on the two touched desktop files → clean; vitest run src/features/remote-peer/peerStatus.test.ts → 19 passed
  • tsc --noEmit (mobile, Node 22) → clean; eslint on the 15 touched mobile files → clean; jest --runInBand on deviceName.test.ts, desktopStatus.test.ts, StandbyNotice.test.ts → 3 suites, 30 tests passed

Each new assertion was checked to fail with its guard reverted.

User-visible changes

  • Device names: a peer name containing U+FFFD or control characters is no longer rendered; the surface falls back to its own "another device" wording (desktop) or to the machine id in the paired-machines list (mobile). Before: a mangled name appeared verbatim, as replacement boxes. After: neutral wording that names no device. Roll back with aafc7953d.

Notes

none

The standby line in a phone conversation read, verbatim:

    已被 FutureOS Desktop (␦␦␦␦␦␦ļ␦) 接管,现在发不出去。

That is a Chinese computer name a launcher had decoded with a local code
page, arriving as one U+FFFD per lost byte. 87b60f7 fixed where the name
is *produced* (ask the OS, not the environment copy) and where it *enters*
the relay (`declared_name` drops it), but the rule never reached a screen:
every client that renders a peer's name printed whatever it was handed, so a
desktop still running a build that sends the leftovers puts replacement boxes
on the one notice that explains why nothing sends.

Both clients now apply the same rule the host and the relay already do, at
their own rendering junctions:

- Mobile: `readableDeviceName` in `remote/deviceName.ts`, used by the
  composer's standby notice, the connection popover, the standby page, the
  settings page, the paired-machines list, and the two toast paths that name
  the holder when a send is refused. A machine's stored pairing name goes
  through it too, falling back to the machine id — the phone keeps that
  string forever, so a name learned before the fix would otherwise stay on
  the list for good.
- Desktop: `peerHolderName`, which already turned "no name" into null, now
  also refuses names carrying replacements or control characters.

A name in Chinese is still a name; the test is replacements, not non-ASCII.
Each new assertion was checked to fail when its guard is reverted.
@huichen
huichen enabled auto-merge (squash) November 11, 2026 14:18
@huichen
huichen merged commit 8aaf502 into main Nov 11, 2026
12 checks passed
@huichen
huichen deleted the pr/huichen branch November 11, 2026 14:34
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