Tracked by #713.
Background
Parallel simulator automation is a core OpenSafari value. Repeated full simctl list devices -j polling during boot/shutdown can become expensive on machines with many runtimes or devices.
Objective
Make simulator lifecycle waits cheaper and more deterministic for parallel device workflows.
Scope
- Use narrower simulator status commands where available.
- Add short-lived device state caching during polling loops.
- Share state lookups between manager and pool code.
- Keep behavior compatible with supported Xcode versions.
Target files and paths
src/simulator/manager.ts
src/simulator/sim-pool.ts
src/simulator/pool.ts
src/simulator/simctl.ts
tests/unit/*simulator*.test.ts
Implementation steps
- Audit current boot/shutdown polling callers.
- Introduce a simulator state reader with a short TTL for repeated polling.
- Use
simctl bootstatus <udid> -b for boot readiness when it is available.
- Keep fallback to current polling for unsupported environments.
- Add tests for cache hit, cache invalidation, and fallback paths.
Acceptance criteria
Verification
npm run lint -- --quiet
- Targeted simulator manager/pool unit tests
- Manual macOS smoke: boot and shutdown one simulator, then two simulators in parallel.
Dependencies / recommended order
Run after the proxy/WebKit speed issues or in parallel by a separate PR because it touches simulator lifecycle only.
Risks and cautions
- Do not assume all Xcode versions support the same
simctl commands.
- Do not cache state across lifecycle mutations without invalidation.
- Do not hide timeout errors.
Non-goals
- Do not redesign device preset selection.
- Do not change public tool names or parameters.
- Do not optimize native input routing in this issue.
Ambiguity reducers
- “Short TTL” means cache lifespan measured in a single polling interval, not long-term device inventory caching.
- Fallback must be explicit and tested.
- Lifecycle actions invalidate relevant cache entries.
Validity review
Proceed. This directly supports parallel multi-device automation and CI speed.
Implementation detail refinements
- Wrap
bootstatus use in a capability-detected helper.
- Record the command path in debug logs without excessive noise.
- Prefer dependency injection for
Simctl in tests.
Verification checklist reinforcement
Tracked by #713.
Background
Parallel simulator automation is a core OpenSafari value. Repeated full
simctl list devices -jpolling during boot/shutdown can become expensive on machines with many runtimes or devices.Objective
Make simulator lifecycle waits cheaper and more deterministic for parallel device workflows.
Scope
Target files and paths
src/simulator/manager.tssrc/simulator/sim-pool.tssrc/simulator/pool.tssrc/simulator/simctl.tstests/unit/*simulator*.test.tsImplementation steps
simctl bootstatus <udid> -bfor boot readiness when it is available.Acceptance criteria
bootstatusis unavailable.Verification
npm run lint -- --quietDependencies / recommended order
Run after the proxy/WebKit speed issues or in parallel by a separate PR because it touches simulator lifecycle only.
Risks and cautions
simctlcommands.Non-goals
Ambiguity reducers
Validity review
Proceed. This directly supports parallel multi-device automation and CI speed.
Implementation detail refinements
bootstatususe in a capability-detected helper.Simctlin tests.Verification checklist reinforcement
bootstatusor documented fallback.