fix(ios): preserve simulator app accessibility after runner teardown

Merged
TH
6d ago
+757-28

Summary

When an XCTest session ends on an iOS simulator (graceful disposal or daemon stop --clean), the simulator is left with ApplicationAccessibilityEnabled=0. Every app launched afterwards then shows an empty accessibility tree to other tools (AXe: one Application node, 0×0) until reboot, and agent-device's own first snapshot after open --relaunch can be sparse. An external benchmark hit this and had to reboot between runs.

  • Runner teardown (both paths) writes ApplicationAccessibilityEnabled=YES after confirmed termination; lease cleanup reads a new typed simulatorTarget lease field, and older leases skip the repair.
  • open writes it before an app or URL launch on an iOS/iPadOS simulator. Failures are diagnostics and do not block launch.
  • Only that key, only iOS/iPadOS simulators; custom sets stay scoped; physical devices and macOS are excluded.
  • Owner cleanup holds the lease lock through termination, repair, and release.

Validation

Tested f870c81fb54930a478a49ee2877590a11f60bb86.

  • pnpm check:affected --run --head f870c81fb5: passed (exactCommit). Regression suites: base 10 failed / 19 passed, head 29 passed.
  • Live, fresh iPhone 17 simulator (iOS 26.2), this build with isolated state and lease dirs, AXe 1.8.0, app relaunched with simctl terminate/launch:
Casemainthis PR
runner session, daemon stop --clean, relaunch1 node, 0×0155 nodes
same with AGENT_DEVICE_IOS_RUNNER_DETACH=0 + daemon stop1 node, 0×0155 nodes
key forced to NO, open --relaunch, first snapshot -i1 node30 nodes

The key stayed 1 when read again 15 s after teardown. The simulator was deleted afterwards.