refactor(ios-runner): key runner retry decisions on typed failures, not message text

Merged
TH
2mo ago
+94-20

Summary

Stacked on https://github.com/callstack/agent-device/pull/2828.

The runner's retry decisions no longer read message text (Swift only, 6 files):

  • shouldRetryResponse reads the runner-internal ErrorPayload.retryableFailure, which ErrorPayload.targetAppUnavailable sets. It is not encoded, so the wire JSON and TS decoding do not change. Only read-only commands reached these responses, so retry behavior is the same.
  • Deleted the "main thread execution timed out" branch: that text is only ever a Swift NSError.
  • Deleted the "timed out" + .snapshot branch: snapshot takes executeSnapshotDispatched and never reaches executeOnMainSafely.

Differences from the issue: the kAXErrorServerNotFound match stays because it is XCTest's own exception reason, which has no typed handle. The completion grep still finds that one commented line.

Closes #2786

Validation

Rebased onto main at a913cb222. Signed macOS host lane: 241/241 at 2d7ec919a. check:affected --run is green at the stack head 60e533284. The evidence below is from before the rebase.

Tested SHA 2700f2f3e.

  • pnpm check:affected --run: green.
  • Signed macOS host lane: 239/239 tests executed, which matches the source count. check:xctest-selection passes. The iOS simulator build succeeded.
  • Regression evidence: with the old Lifecycle.swift restored, the new retry tests fail.
  • Live check on the iPhone 17 Pro simulator: open, snapshot -i, screenshot, find get text, and close all passed. The unavailable-target retry was not reproduced live; unit tests cover it.
  • Review (/code-review high): fixed the Models test placement, added a field-drift check, and switched to the shared fixture. Rejected adding a wire code (it changes the AppError code), restructuring the catcher (out of scope), and logging the retry reason (single case).

šŸ¤– Generated with Claude Code