fix(apple-runner): a penalized snapshot plan falls back to the bounded XCTest probe

Merged
OK
2mo ago
+186-9

Summary

Once the XCTest channel is penalized for a bundle, the regular snapshot plan on a simulator is private AX alone. When private AX cannot match the app, nothing else runs, and the capture comes back as the sparse fallback with a zero root. Presentation then refuses it: regular iOS snapshot presentation requires a valid viewport. Private AX fails to match the app with Could not match active AX application for XCTest application, which is what happens while the out-of-process "Save Password?" sheet is over it. That repeats on every capture for the whole 120 s penalty.

This was the top flake in the e2e mobile benchmark. Login Form failed on its first pass in about 20 of 45 CI runs: every snapshot after submit failed, the agent could not see the sheet's Not Now, and it gave up. Runner log:

SNAPSHOT_XCTEST_CHANNEL_PENALIZED bundle=dev.e2e.benchmark reason=queries_backend_timeout
SNAPSHOT_XCTEST_CHANNEL_DEFERRED bundle=dev.e2e.benchmark
PRIVATE_AX_SNAPSHOT_FAILED=Could not match active AX application for XCTest application

The penalized plan now keeps the tree, on the bounded probe's 1 s slice that physical devices already use, behind the independent backend: [privateAX, recursiveTree]. The query sweep stays off, since its grind is what penalizes the channel. A private-AX capture that succeeds returns first, so nothing changes on screens where it works. A capture the bounded tree recovered reports budget instead of the seeded deferred.

Touched: 1 runner source file, 1 unit test file.

Release note

While the XCTest channel is penalized, a capture the bounded tree recovered carries reasonCode: "budget", not deferred, and shows the recovered warning on each such capture, as physical devices already do. So does a deferred plan that ends sparse after the tree ran.

Validation

Tested commit 82a354807 (live run, check:affected, xctest selection reaches all 344 methods); 4b3971da7 after it only lets the tree-recovery test skip when the bounded tree misses its slice.

  • Live, iOS 26.5 simulator, loaded host: the mobile benchmark's model-driven Login Form reached the Save Password sheet on a penalized bundle. The runner log shows CHANNEL_PENALIZED, then CHANNEL_DEFERRED, then PRIVATE_AX_SNAPSHOT_FAILED (Could not match active AX application), then SNAPSHOT_RECOVERED backend=tree. The snapshot came back as recovered / tree / budget with the sheet in the tree, and there was no viewport refusal. Details in the thread.
  • Before, without this change: 1 of 3 loaded Login Form runs failed with the persistent viewport refusal. After, on c6c67d5ed: 18 of 18 passed unthrottled.
  • New simulator-lane tests use a unit-test-only private AX override: recovered/tree/budget, and sparse/budget when the tree tier blocks. Both fail with the stamping reverted.
  • RunnerTests+SnapshotCapturePlanTests pins the penalized plan as [.privateAX, .recursiveTree] and the verdict-reason rule.