Repository navigation
fix(apple): refuse clear-app-state for apps with no data container - #3332
Conversation
simctl get_app_container answers an installed app that owns no data container (system apps shipped in the simulator runtime, such as com.apple.Preferences) by exiting 0 and printing the literal (null). clearIosSimulatorAppState only rejected an empty stdout, so the sentinel reached readHostDirectory and the command failed with ENOENT: no such file or directory, scandir '(null)' instead of a refusal. Route every get_app_container stdout through one classifier, readSimctlContainerPath, which treats the (null) sentinel and empty output as the tool's no-container answer. clear-app-state now refuses it with UNSUPPORTED_OPERATION keyed on the typed reason app-no-data-container, naming the app; the runner-screenshot container loop already skips that answer instead of probing a (null) path. Closes #3305
|
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
The hint and the command doc told the caller to uninstall and reinstall the refused app, but the motivating class ships inside the simulator runtime and cannot be uninstalled, so the advertised recovery was unavailable for precisely the app that triggers the refusal. Point at what a caller can actually do: erase or recreate the simulator device, or uninstall an app they installed themselves. Typed reason and details are unchanged.
|
Fixed the unavailable-recovery claim at the owning string in faba0da: the hint constant in |
|
The PR is ready for human review at faba0da, and I found no problems in the code. All 21 checks pass, and none are failing. There are no conflicts. Not blocking: in clearIosSimulatorAppState, The two review threads on the hint wording (app-settings.ts) and the docs text (commands.md) are fixed at this commit, so they no longer apply and can be resolved. On evidence, I did not run the tests locally. The claim that the new tests fail without the fix rests on my reading of the old code path. The live iOS 27.0 simulator run and the Node client and MCP checks are the author's reports, and I did not rerun them. I also could not confirm that the |
Summary
settings clear-app-stateon an iOS simulator system app (e.g.com.apple.Preferences) crashed withENOENT … scandir '(null)':simctl get_app_container … dataexits 0 and prints the literal(null)for an app with no data container, and the old guard rejected only empty stdout before handing the sentinel toreadHostDirectory. Everyget_app_containerstdout now goes through one classifier,readSimctlContainerPath(simctl.ts), which treats(null)and empty output as the tool's no-container answer.clear-app-staterefuses it withUNSUPPORTED_OPERATIONkeyed on typeddetails.reason: app-no-data-container(names the app; hint/details survivenormalizeError). The runner-screenshot container loop — the sibling reading the samedatadomain — shares the fix through the same classifier and no longer probes a(null)path. Theapp-domain readers (launch-diagnostics,perf-target,logs/start) were probed live and are unaffected: system apps answer theappdomain with a real runtime-root path, missing apps exit non-zero. CLI, Node client, and MCP surfaces verified live; docs and--helpdetail updated. The refusal's recovery guidance points at what a caller can actually do (erase/recreate the simulator; uninstall an app they installed), since runtime-shipped apps cannot be uninstalled. 8 files.Closes #3305
Validation
Tested commits
701977ff3+faba0da3e(guidance-text fix).pnpm check:affected --runexit 0 onfaba0da3e, includingcommand-docs(commands.md asserted against the CLI in both directions). Earlier run on701977ff3: 3 unrelated load flakes (runner-cache-retention, providerios/android-lifecycle,snapshot-source/preparationENOTEMPTY) — each passed in isolation and on rerun of the same head.app-settings/screenshot/simctlsuites pass; regression tests observed failing without the fix (old code reachesreadHostDirectory('(null)')).node bin/agent-device.mjs settings clear-app-state clear --app com.apple.Preferences --platform ios --udid <udid>→Error (UNSUPPORTED_OPERATION): com.apple.Preferences has no data container to clear…exit 1, hint offering simulator-erase/self-installed-app recovery;--jsoncarriesdetails.reason: app-no-data-container+ hint + diagnosticId + logPath.com.example.miniappclear still succeeds (exit 0, fresh-install layout). Node client and MCP stdiotools/callsurface the typed refusal un-degraded.Unresolved risks: none beyond CI arbitration of provider-integration/coverage jobs.