fix(ios): refuse observe-only snapshots that find a system alert

Merged
AI
23d ago
+85-19

Summary

snapshot --observe-only could answer with the SpringBoard alert tree while still stamping observation, which asserts the tree came from the session app. It now refuses with OBSERVATION_UNAVAILABLE and a hint naming the alert. The docs already promised no substitution, so this refuses rather than discloses. Regular snapshots are unchanged.

Closes #3348. 7 files. The fast and raw alert tiers fold into one function, so the refusal has one owner.

An alert the runner cannot read still leaves the app tree as the answer, so a success does not prove that no alert is present. The docs now say so.

Validation

pnpm check:affected --run --head de9eaf985: 13 passed, 9 skipped, exactCommit=true. Skipped includes swift-runner-ios, swift-runner-macos and the replay lanes.

Unit, iPhone 17 simulator: testObserveOnlySnapshotRefusesOnlyASubstitutedSystemAlertTree failed before the fix and passes after.

Live, same simulator, real Maps location alert, on the Swift in this PR (run before committing; later commits change only help, docs and a test assertion):

  • snapshot returns the alert tree.
  • snapshot --observe-only and --observe-only --raw exit 1 with OBSERVATION_UNAVAILABLE.
  • After alert dismiss, --observe-only succeeds with observation.

Not done: a typed reason for this refusal. The issue asks for the existing response, and the message still reads "cannot be observed without activation"; only the hint names the alert.

Independent review of 9d34cf9b1 found no correctness defects.

šŸ¤– Generated with Claude Code