fix(mobile): check iOS simulator build and bundleId in doctor

MA
10h ago
+811-8

What

e2e doctor reads the Info.plist of an iOS app.appPath .app bundle, and app-path fails when:

  • the bundle is a device build (iPhoneOS, AppleTVOS, XROS) for a target that drives simulators. Any *Simulator platform counts as a simulator build, tvOS and visionOS included, and the message names the SDK to build with (-sdk iphonesimulator, appletvsimulator, or xrsimulator).
  • CFBundleIdentifier, CFBundleDisplayName, and CFBundleName all differ from app.bundleId, when both sides are present.

Why

Pointing app.appPath at a device build or a bundle with another identifier passed app-path as long as the directory existed, and the run failed later with a confusing install or launch error.

How it works

  1. packages/mobile/src/plist.ts adds a small XML and binary (bplist00) property-list parser (parsePlistDict), with no dependency and no plutil subprocess, so doctor works off macOS too.
  2. buildCheck reads Info.plist for an iOS .app and fails a bundle whose CFBundleSupportedPlatforms names no *Simulator platform, using the device platform it names to pick the SDK in the message (packages/mobile/src/doctor.ts:116, :156).
  3. Before failing, classifyIosTarget asks agent-device's inventory (devices.list) whether the target drives simulators. The inventory's kind is the only source: configured devices must all be listed, and with none configured the booted ones decide, or a simulator is booted. One simulator in the pool makes it a simulator target, since the build has to install there too. A device the inventory does not list, or an inventory that cannot be read, leaves the build trusted. An abort while reading it stops doctor (doctor.ts:80).
  4. The identifier check compares app.bundleId with the bundle id, display name, and bundle name. A missing, unreadable, or malformed Info.plist passes, including one nested past the parser's stack, so doctor never fails on a bundle it cannot read.
  5. docs/reference/cli.mdx describes the check.

Issue

Fixes #2016

Verified

Ran it locally: yes - unit level, with a scripted agent-device client; no simulator run.

  • pnpm --filter @e2e-dev/mobile test: 721 of 721 pass. 21 are in packages/mobile/tests/unit/doctor.test.ts, covering XML and binary plists, the iPhoneOS and AppleTVOS device builds, a tvOS simulator build, a mismatched identifier, physical device targets, a pool mixing a simulator and a device, an unlisted device, a cancelled doctor (the cancel must come from the inventory read), and missing, malformed, or too deeply nested plists.
  • The binary-format test reads tests/fixtures/plist/tvos-simulator-utf16.plist, written by plutil -convert binary1 (UTF-16 strings, nested arrays and dicts), not by the test's own encoder. plutil -convert json of the fixture:
{"MinimumOSVersion":"26.0","CFBundleIdentifier":"dev.e2e.café","CFBundleName":"Cafe","CFBundleDisplayName":"Café ✓ Résumé","UIDeviceFamily":[3],"CFBundleSupportedPlatforms":["AppleTVSimulator"],"CFBundleIcons":{"CFBundlePrimaryIcon":{"CFBundleIconFiles":["AppIcon60x60",["nested"]]}}}
  • Typecheck, lint, and pnpm docs:check are clean.

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.

Summary by CodeRabbit

  • New Features
    • The iOS simulator app-bundle check now verifies that the bundle identifier, display name, or bundle name matches the configured app identifier.
    • The check reports when a device-built app bundle is used for a simulator target and provides guidance specific to the simulator SDK. tvOS and visionOS simulator builds are also recognized.
    • Missing or unreadable app metadata does not cause the check to fail.
  • Documentation
    • Updated the e2e doctor reference to describe the iOS app-bundle checks and simulator-target behavior.