feat(ios): add observe-only snapshots without foreground repair
What changed
Adds snapshot --observe-only for an existing local iOS app session. Unlike ordinary snapshots, this mode refuses rather than activating the app or repairing foreground state. Default snapshot repair and targetActivation disclosure are unchanged.
The runner must already be ready. A non-activating capability probe pins the subsequent capture to that exact runner session; missing support, a replaced session or missing/contradictory observation metadata fails closed. There is no runner startup/recycle, activating fallback or system-surface substitution in this mode. Other platforms, provider-owned sessions and diff are rejected.
Successful data.observation is exactly:
{
"mode": "observe-only",
"activationPerformed": false,
"appState": "runningForeground",
"appStateSource": "xcuiapplication-state"
}
This is sourced XCTest state, not verified foreground or screen ownership. The native path requires the foreground state report before/after capture and an unchanged process identity. Observe-only never emits targetActivation. Native unavailability is OBSERVATION_UNAVAILABLE; host/capability refusals use COMMAND_FAILED with details.reason: "observation-unavailable".
Review notes
This is the opt-in prevent complement to #2682's disclose behavior. It does not fix #2694's ordinary interaction disclosure gap or infer ownership from AX PID ordering. #2696 remains the reason not to treat XCTest state as a screen-ownership guarantee. Stronger ownership, observe-only settle, early response history, inline screenshot reuse, private Android comparison and prerelease version codes remain separate follow-ups.
Validation
Original feature validation on 40d0b191c01c8b458f41817552cc9a22d2ebd5c2:
corepack pnpm checkpassed: 1,457 Vitest files / 11,973 tests passed, one existing skip, plus the tooling/fallow checks.corepack pnpm check:affected --runpassed its local selected set. Selection included Apple/XCTest source checks; GitHub-authoritative and parked device lanes were explicitly skipped by the selector, not counted as local passes.corepack pnpm build:xcuitest:iosandcorepack pnpm build:xcuitest:macospassed, using isolated derived-data paths. The iOS unit-test-enabled build also passed.- Four selected native iOS tests passed: background refusal without activation/disclosure, sourced foreground metadata without target binding/activation, unchanged ordinary repair/disclosure, and capability reporting. Recorded in an
.xcresultbundle. - Capability/identity regressions failed before the continuity fix and passed afterward: absent capability identity is refused before snapshot dispatch, replacement runners cannot replace the pinned identity, and unavailable ready registrations cannot create a runner session.
- Live iPhone 17 Pro / iOS 26.5 simulator, with freshly built CLI and runner: Settings observe-only capture → Home → typed observe-only refusal → ordinary raw snapshot's repair/disclosure → successful observe-only capture. A brief foreground state report after Home was retained as sourced state, not promoted to ownership evidence. The repeatable CLI check and compact JSON artifact passed; session, daemon and disposable simulator were cleaned up.
Protocol fixture follow-up and final CI
The initial macOS host gate found that Command.observeOnly had no production request in the protocol fixture. Added real interactor producer sites for both the non-activating uptime probe and observe-only snapshot. Fixture rows come from the producer helper's captured-request diff; there is no separate generator. The drive also asserts the host-only expectedRunnerSessionId, which is not sent as a Swift request field. The other new Swift fields are responses/context, not missing request vocabulary.
Fix commit: f14ab3589. Final pushed head: d8484932c75a460a5c5a2798b980b86aacb71e15; the latter is a CI-only empty retry with the identical source tree.
- Focused producer tests: 5 passed across 3 files.
- Exact macOS workflow XCTest invocation (
platform=macOS,arch=arm64, skipping onlyRunnerTests/testCommand): 279 passed locally; the source-derived execution-count reporter also passed. Local ad-hoc signing resolved the original unsigned-bootstrap limitation. corepack pnpm check: 11,973 passed, one existing skip.corepack pnpm check:affected --run: local selected gates passed on the final pushed head.- All PR-attached checks finished: 13 passed, 3 intentionally skipped, none pending or failing. This includes all four platform smoke jobs and Coverage.
An untouched iOS synthesized-text pacing assertion failed once. The same implementation/test passed on recent main run 36887001093; the identical-source retry run 36897563973 passed that test and all 79 targeted iOS XCTests. No typing behavior/test changes were made. GitHub required repository admin rights for a job rerun, hence the CI-only empty commit.
Limitation: no physical-device run.
Refs #3106