feat(mobile): select a physical iPhone or Android phone by its UDID or adb serial

MI
5d ago
+197-69

What and why

  • A configured device (or e2e run --device) can now name a connected phone by its id: an iPhone or iPad by its UDID, an Android phone by its adb serial. Before, only a simulator UDID (8-4-4-4-12) or an emulator-<port> serial was read as an id. Any other string went to agent-device as a name, matched nothing, and two phones of the same model had no way to be told apart.
  • iOS: the UDID pattern in packages/mobile/src/pool.ts now also takes a physical device's hardware UDID (00008030-001A2B3C0E12802E) and the 40-hex-digit form from before 2018.
  • Android: a physical serial has no fixed shape, so a configured pool or --device that isn't all emulator serials lists the devices once in prepare and binds an entry that equals a listed id as that serial. Every other entry stays a name. A failed listing is logged and keeps the old name behavior. A cancelled one ends prepare.
mobile({ platform: 'ios', device: '00008030-001A2B3C0E12802E' });
mobile({ platform: 'android', device: ['R5CT1234ABC', 'emulator-5554'] });

Issue

None.

Verified

Ran it locally: yes

  • iOS, paired iPhone: agent-device devices --platform ios lists it as kind:"device" with id 00008150-0015XXXXXXXXC01C (masked), and the new pattern matches that id. I didn't run a test on the phone. The runner signing it needs is unchanged here.
  • Android: I connected a running emulator over TCP (adb connect 127.0.0.1:5555). agent-device lists it as kind:"device" with id 127.0.0.1:5555, the same shape as a phone on wireless debugging. A scratch project with device: '127.0.0.1:5555' opened Settings and checked device.unstable_raw.deviceId. --device 127.0.0.1:5555 bound the same serial.
mainthis branch
ENGINE_FAILURE (launch): No device named 127.0.0.1:5555 Hint: 127.0.0.1:5555 is the id of "sdk google atv64 arm64", not its name.✓ passed, selection: {"platform":"android","serial":"127.0.0.1:5555"}

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change: title carries !, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).
  • Docs updated in the same PR: the docs/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.