fix(ios): corroborate recorded tap outcomes

Merged
TH
3mo ago
+1130-27

Summary

Partially addresses #1599 by corroborating an iOS XCTEST_RECORDED_FAILURE with one same-presentation post-action accessibility capture. A recent, comparable changed digest returns success with a warning; stale, keyless, unknown, unchanged, sparse, cross-backend, capture-failed, or presentation-mismatched evidence remains failure.

The comparison baseline is limited to five seconds and must declare the same presentation and snapshot backend, preventing unrelated screen drift or incompatible tree shapes from becoming a successful tap. Corroborated successes preserve target-v1 recording evidence and suppress the ordinary no-change retry so a later observation cannot dispatch the tap twice.

The change also resets process-bound snapshot penalty and private-AX state after external relaunch and makes the runner recovery hint honest. It removes the retry-spiral harm described in #1599, but does not claim to root-cause the underlying XCTest recorded-failure storm on the affected profile family.

Validation

  • Red-before proof: bypassing the freshness and key-presence guards made the stale-baseline test return success and made the keyless-baseline path perform a capture.
  • Focused corroboration suite: 11/11 tests passed, including stale/keyless/comparability fail-closed boundaries and the save-to-replay evidence chain.
  • pnpm check:affected --run: 126 files, 1,049 tests passed at 961c9f8fd.
  • iOS and macOS XCTest build-for-testing passed locally; exact-head native execution remains GitHub-authoritative.

Division of labor (#1599)

#1587 addresses the likely root cause: the tap false-failures were a downstream symptom of XCTest-channel saturation (grinding captures leaving abandoned work in testmanagerd), which the penalty/viewport/depth fixes removed — two live bsky-24 attempts and a 5-attempt relaunch/full-snapshot race on this head could not produce a single natural XCTEST_RECORDED_FAILURE. This PR is defense-in-depth for the residual: when the ambiguous failure does occur, one corroborating capture converts a landed tap to success-with-warning instead of a retry spiral. What remains open on #1599 narrows to confirming the saturation theory against the archived transcripts or a pre-#1587 build.