Repository navigation
fix(ios): read and press deep trees on physical devices through private AX - #5093
Conversation
…AX tier On a physical iPad, one deep screen failed every snapshot tier with kAXErrorIllegalArgument. The AX server limits the depth of each snapshot request, and XCUIElement.snapshot() and the query sweep both ask for the whole tree in one request. The runner's private-AX tier already works around this limit: it steps down a depth ladder and re-roots requests at the depth-capped frontier nodes. It was compiled for iOS Simulators only. The tier uses only XCTest's own in-process AX client (XCUIDevice.accessibilityInterface, requestSnapshotForElement), which is also present on a device. So the runner now offers it on iOS physical devices too. tvOS, visionOS, watchOS, and macOS still do not get it: a new otherApplePlatform environment keeps them on the XCTest backends, which is what they had when they were mapped to physicalDevice. Consequences on a physical device: a capture that the tree and query tiers cannot serve falls through to private AX, and a penalized XCTest channel defers to private AX instead of a bounded XCTest probe, as on a runner-read Simulator. Only iOS runners penalize the channel, and every iOS runner now has private AX, so no runner reaches the bounded XCTest probe any more. The probe stays as the policy for a plan without an independent backend. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… devices On a physical device AXRuntime reports no app to the runner process (`AXElement.primaryApp` and `systemApplication` answer nil), so the full-screen probe answered Unknown and every private-AX root stayed `derived`. A deep screen then read through private AX, but every ref press refused with `window-origin-unknown`. The e2e mobile engine presses by ref, so its taps on that screen failed. When the probe proves nothing, take the sole XCTest screen in native portrait points as the frame the root must equal. No window smaller than the screen can equal it, so a placed iPad window's local root (callstack#4399) stays `derived`. Windowed or not-primary evidence never falls back, and a landscape or unreadable sole screen answers no frame. The XCTest tree tier shares the frame through `capturedSnapshotViewport`, so on a physical device a full-screen portrait window now comes from the root snapshot instead of a live `app.windows` read, as on a Simulator. The sole-screen gesture route is unchanged: off the phone idiom it still needs AXRuntime's fills-screen proof, so a ref press on a deep screen of a physical iPad is still refused, not mis-pressed. Verified on an iPhone 17 Pro Max (iOS 27.2.1) with a UIKit screen nested 90 and 150 views deep: the private-AX viewport is `reported`, and `press @ref` reaches the button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f frame ADR 0004 still said a private-AX root is `reported` only when AXRuntime reports the app filling the screen, and the next sentence added a case where AXRuntime reports nothing. The runner README had the same shape. State one rule instead: the root must equal the full-screen proof frame at the origin, and the AXRuntime result decides that frame. The acquisition paragraph also said physical devices "keep their existing owners" right before saying that iOS physical devices now use the private AX tier. It now says what stays the same for them: they do not use the host AX bridge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`XCUIScreen` is main-actor isolated, and its reads are synchronous IPC. The private-AX tier runs on the command queue, and its viewport fallback read `XCUIScreen.screens` there whenever the AXRuntime probe proved nothing, which is every capture on a physical device. Snapshot preparation already runs on main and hands the off-main capture the facts it needs in `SnapshotCaptureTarget`. It now also reads the sole screen there (cached per command in `soleDisplayPortraitSize`), and the private-AX viewport proves a full-screen root against that size. `RunnerFullScreenApplicationFrame` takes the size as a block, so the tree tier, which reads its viewport on main, still reads the screen only when the probe proves nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…diff --actions
`diff snapshot --actions` refused a non-Simulator target by saying the
target does not have the private accessibility snapshot backend. A
physical iOS runner now has that backend; custom actions are admitted on
Simulators only. Use the wording `snapshot --actions` already uses
("custom actions are unavailable on this <platform>/<kind> target") and
correct the platform-guard test comment that made the same claim.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Snapshot dispatch skips `executePrepared`, the only place that clears `mainOwned.soleDisplayPortraitSize` at the start of a command. So snapshot preparation reused the size an earlier snapshot read. After a display change, such as a second screen or a Display Zoom change, the private-AX tier could prove a full-screen root against a screen that no longer holds. Snapshot preparation now clears the cache and reads the size again, so it is fresh for each command. The tree tier, which reads its viewport on main, reuses that read instead of a second uncached `XCUIScreen` read with a different shape. A request that names a lit panel skips the read: its plan has no private-AX tier, and on a multi-screen device the read would only log `APP_SCREEN_UNRESOLVED` on every snapshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 21 files
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Re-trigger cubic
The private-AX tier honors an explicit raw depth as asked, with no accepted-depth memory and no frontier extension, so the ADR must not promise continuation for that request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RunnerFullScreenProofFrame answers CGRectNull for an unknown probe when the sole screen cannot be measured or is landscape, so the ADR states that the origin then stays unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The decision history named a physical iPad failure that this change did not reproduce. It now names the deep-screen rejection reproduced on a physical iPhone at the base commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
effectiveSnapshotCapturePlan reorders only the regular visible plan; raw and lit-panel plans keep their order, so the comment no longer says that every penalized plan defers to private AX. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Physical iOS runners now read private AX, so the module comment no longer says only the simulator has that backend. It says that the daemon admits --actions on the simulator only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the work on this, the code at 85bc04b looks good and no blocking problems were found. These threads no longer apply and can be resolved: raw depth (the ADR now says an explicit raw depth gets that depth only, with no continuation), sole screen proof (the ADR now says an unmeasurable or landscape sole screen gives no proof frame), deferral scope (the deferral is now limited to the regular visible plan), test module doc (it now says The live device run is known only from the PR body summary, with no raw debug log or Not verified here: an iPad run, physical or Simulator; a live placed-window run for the #4399 rule that placed windows stay derived, which is covered by construction and a pure unit test; whether AXRuntime on physical hardware always answers All 16 checks pass at this commit. Nothing blocks the merge. As an optional cleanup, the unreachable |
Summary
On a physical iOS device, a screen nested deeper than the AX server's per-request depth limit fails every snapshot tier with
kAXErrorIllegalArgument. #4089 fixed this for the Simulator bridge only.window-origin-unknown. When the probe proves nothing, the sole XCTest screen, read on main once per snapshot, is now the full-screen proof frame. Placed iPad windows stayderived(iOS: deferred private-AX captures lose the origin of placed iPad windows #4399).diff --actionsno longer says devices lack private AX..boundedXCTestProbeis now unreachable. Kept; remove here?Before / after
iPhone 17 Pro Max, iOS 27.2.1, UIKit fixture with a button under 90 nested views:
Validation
pnpm check:affected --run --head 85bc04bab: passed,exactCommit: true. Swift runner lanes are CI-owned.Risks:
runner_busy.AI assistance and human review
AI was used to prepare these changes. Human-reviewed by @kdy1.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.