refactor(ios): keep the modal-scope capture out of the packaged runner

TH
7h ago
+11-4

Summary

#4124 shipped the modal-scope capture in the packaged runner source, but its only caller is the dev capture test testCaptureAlertSurfaceTree (pnpm capture:alert-surface). This PR moves it under UnitTests/, which the packager drops:

  • RunnerAXModalScopeCapture.{h,m}, RunnerModalScopeAcquisition.swift, and RunnerAXSnapshotBridge+Internal.h move to UnitTests/. The .m and Swift compile only under AGENT_DEVICE_RUNNER_UNIT_TESTS, which matches AgentDeviceRunnerAppFixtures.m and the other UnitTests/ sources.
  • The bridging header imports the capture header behind __has_include. OTHER_CFLAGS defines do not reach Swift's clang importer, so a #if defined(...) gate hid the types from the unit build.
  • RunnerAXSnapshotBridge.m imports its public header again. Production code still uses the split helpers. ModalScopePair.swift and ModalSurface.swift stay in the host package.

6 files, renames plus guards. No behavior change.

Size: āˆ’19.9 kB unpacked (CI Size Report)

Validation

At e5fb487ca5:

  • pnpm check:affected --run --head HEAD: passed. pnpm check:package: passed, with no test code in the 751 packed files.
  • Runner build-for-testing passed on iOS sim and macOS, for both normal and unit (AGENT_DEVICE_XCUITEST_INCLUDE_UNIT_TESTS=1) builds. The packaged dist/apple/runner project also built on iOS and macOS. The packaged source has no ModalScopeCapture file.
  • pnpm capture:alert-surface against com.apple.Preferences on an iPhone Duo sim: 1 test passed, 141/141 nodes. I deleted the throwaway fixture, and the corpus is unchanged.
  • Both testAModalScopeTree* methods passed on the iOS sim and on macOS (2 executed, 0 failures each).

CI: Apple Smoke Tests own the swift-runner lanes.

šŸ¤– Generated with Claude Code