fix(mobile): fail an open of an app the device does not have as TEST_SETUP_FAILED
KA
4h ago+93+93+01234567890123456789-14-14-01234567890123456789
What
- Opening an app the device doesn't have now fails with
TEST_SETUP_FAILED(exit 2) when agent-device reportsAPP_NOT_INSTALLED. That covers Android launches, iOS display names, an iOS simulator'sapp.clearState(), and an app-targeteddevice.setPermission(), plusapp.open(),app.restart(),device.openApp()anddevice.openLink()into that app. - The message names the app and the device, and tells you to install it (
device.installApp()for the target's own build) or check the bundle id. - Not fixed here, still
ENGINE_FAILURE: a launch of a missing dotted iOS bundle id (simulator or physical device) and an AndroidopenLinkbound to a missing package. agent-device starts these without an install check. A custom-schemeopenLinkon iOS is handed to the OS rather than launched as the named app; the OS routes the URL to whichever app handles the scheme, so it never reports a missing app.
Why
- A missing app is a setup mistake, not a device fault, and agent-device's advice (
Run install before open) points at its own CLI. - On an iOS simulator, agent-device skips its install check for a dotted bundle id and goes straight to
simctl launch. When that fails it works outAPP_NOT_INSTALLEDbut only setsdetails.hintand rethrowsCOMMAND_FAILED. I dropped the hint text match, since every other classification inerrors.tskeys on a code. The simulator case needs agent-device to throwAPP_NOT_INSTALLED; after a pin bump this PR picks it up unchanged.
How it works
notInstalledCause(packages/mobile/src/errors.ts) acceptsAPP_NOT_INSTALLEDonly.appNotInstalledturns that failure into aConfigurationError('TEST_SETUP_FAILED')and keeps the agent-device error ascause.- The surface's
open(),openLink()into a named app,setPermissionandclearStatepass their failures through it.open_appstill readsisAppNotInstalled, so a wrongappreturnsINVALID_ARGUMENTto the model.
Issue
Refs #2281
Verified
pnpm --filter @e2e-dev/mobiletypecheck and the engine, tools and errors unit tests pass at 0a6684de8.docs:check-errorspasses.- Each of the four wraps (open, openLink, setPermission, clearState) has a unit test from
APP_NOT_INSTALLED; reverting one fails it. - Not run: a live iOS simulator or Android emulator on this head. An earlier run of the first version of this change on an iPhone 17 Pro simulator showed the iOS
opengoing toTEST_SETUP_FAILEDthrough the hint match, which is gone now. TheAPP_NOT_INSTALLEDpath comes from unit tests and agent-device's source.
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/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.
Summary by CodeRabbit
-
Bug Fixes
- App operations now report
TEST_SETUP_FAILEDwith the app name and installation guidance when the target app isn’t installed. This applies to opening apps, changing app permissions, opening links for a known app, and clearing app state. - Missing iOS bundle IDs and Android packages that fail without an installation check continue to report
ENGINE_FAILURE.
- App operations now report
-
Documentation
- Expanded mobile troubleshooting and reference guidance to explain these errors and how to resolve installation issues.