refactor(ios): one simctl --set builder and one simulator state parser - #2824
Conversation
… the state parsers Every simctl call site now scopes its argv through core/simctl.ts (scopeSimctlArgs/scopeSimctlArgsForDevice for the host tool seam, buildSimctlArgs/buildSimctlArgsForDevice for xcrun), and every direct run goes through runSimctlForDevice. The runSimctl/simctlArgs alias in apps-simctl.ts, the simulator-state.ts builder, and the screenshot shims are gone. The two `simctl list devices -j` state parsers collapse into readSimctlDeviceState; the snapshot target's runtime projection shares its raw reader. Inventory keeps its strict projection. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
apps-simctl.ts held nothing simctl-related once its runner alias was gone; the devicectl uninstall path is its only consumer. Also states the device-list reader's real throw contract. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
|
|
Reviewed at 47edaa9. The consolidation reads well: every That same move would fix the Coverage failure, which this diff causes. The eager-closure budget test names the new edge core/simulator.ts -> core/simctl-device-list.ts, added at https://github.com/callstack/agent-device/blob/47edaa9/packages/platform-apple/src/core/simulator.ts#L16. It grows the closure of simulator-facade.ts from 24 to 25 modules. core/simulator.ts, simulator-state.ts and snapshot-target.ts already import core/simctl.ts, so moving the readers there adds no new edge. A small note: simulator-state.ts now reaches Smoke Tests and both CodeQL jobs were still running when I looked. Smoke Tests exercises the simctl routes this PR rewrites, so please check its result when it finishes. |
…ctl module Extracting the shared simctl-list-devices parser into its own module added a new static edge to platform-apple/src/core/simulator.ts, tripping the simulator-facade eager-closure budget (24 -> 25). Fold the parser into core/simctl.ts, which simulator.ts already evaluates, instead of giving it a new file.
|
Reviewed at c8cb34e. The code looks right, with no findings in the diff. The evidence question from the earlier review is still open. Smoke Tests at this commit fails in The next step is a green iOS Smoke run at c8cb34e, or a re-run that gets past step 7. |
|
Summary
Stacked on #2818.
Closes #2794.
core/simctl.tsnow builds every simctl--setprefix:scopeSimctlArgs*for theappleToolshost seam andbuildSimctlArgs*for xcrun. Every direct run goes throughrunSimctlForDevice.Removed:
runSimctl/simctlArgsalias.apps-simctl.tsis deleted and its one helper moved into its only caller.simulator-state.ts's builder.The two state parsers now share
readSimctlDeviceStateincore/simctl-device-list.ts, and the snapshot target's runtime reads through the same raw reader. Inventory keeps its own strict projection.No argv changes: existing argv tests are unchanged apart from two
vi.mockpaths. One discrepancy: formersimulator-state.tscall sites now trim the set path and skip non-simulators, but they run on simulators only. ADR 0023's dated hop trace was left as is. 25 files touched.Validation
Tested SHA
47edaa927e46de4353be426dd5e2c962260c6ddd. Passed:pnpm check:affected --run: 13 checks; 3133 related testspnpm check:fallowpnpm check:production-exportspnpm check:layeringgit grep "'--set'": onlycore/simctl.tsamong production filesNo live device: argv is unchanged, so the Apple CI lanes cover this.
Review (8 findings): fixed 2, the misnamed
apps-simctl.tsand a wrong throw doc. Rejected 6, which were pre-existing behaviour, an intentional strict inventory, differing transports, or an argv-test constraint.Risk: host-seam modules (
inventory,shutdown,logs) now statically reachtool-providerthroughcore/simctl.ts. That is about 12 more modules, all already resident in the daemon.🤖 Generated with Claude Code