fix(replay): verify recorded targets through the request's own capture

Merged
TH
10d ago
+734-146

Summary

Replay now verifies recorded target evidence through the runtime capture route used by the commands it dispatches. This avoids ancestry mismatches caused by different iOS Simulator snapshot projections.

An unchanged session reuses its admitted capture. Close and reopen on the same device or open with a refreshed device re-admits and binds again. The observation owner answers with one of three mutually exclusive kinds — a bound capture, a stable refusal, or a retryable failure of its own probe or bind — and discloses each at its own seam; replay only acts on retry eligibility. Every observation still verifies the target.

Part of #4622. Twelve files, including the observation-capture owner, the request binding seam, and routed tests. Legacy recordings still lack producer identity.

Validation

  • Head 506b50794c10a4d40a96341c9155f8cc14caddbf on origin/main. Format, lint, typecheck and the routed suites (observation-capture, replay capture, replay target/runtime, execution: 1,772 tests) pass locally; CI owns the full lanes.
  • Live evidence at this head, one booted iPhone 17 Pro Max simulator (iOS 27.0, Agent Device Tester), replay command, annotated script, and the replay request's raw --debug ndjson record attached at https://gist.github.com/thymikee/3d1d74c8224551fc70b6f0d338926525 (plus an extract). The trace shows: Replayed 5 steps in 2.7s with both annotated clicks verified; two distinct observation_capture_admitted + observation_capture_bound pairs (17:54:45.794 before the first click, 17:54:47.045 after the close/reopen, both plan=selector-active-app on the same device — the re-admission route); eight capture acquisitions served by producer: simulator-ax-bridge, four per cell; zero runner snapshot sends (only uptime/appState readiness probes and the two taps); zero observation_capture_unavailable warnings.
  • The bind count is now observable on the live request record itself: the observation owner emits observation_capture_admitted and observation_capture_bound with command, plan, and device (506b507). Bypass-vs-cached binding coexistence and single disposal per binding remain pinned by the routed test over the real request runtime bindings; refusal-cell retention (two clicks, one facts probe, one warning) by another.
  • Predecessor live evidence at 9f13cf4455: the recorded wait and press replayed on the same simulator; six bridge acquisitions and zero runner snapshots.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.