Skip to content

Commit c3deb5d

Browse files
thymikeeclaude
andcommitted
fix(ios): log every failed system-app screen read and keep the hint key-free
The system-app size read now logs an unavailable AXRuntime class too, the refusal hint points at the runner log without quoting its key, the rotation frame doc says an unknown orientation keeps the window box (no turn reads it), and the display test clears its cached target. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0fcd727 commit c3deb5d

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedInteraction.swift‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,8 @@ extension RunnerTests {
523523
/// The box a synthesized turn swaps side lengths about. The digitizer turns about its display, so a
524524
/// placed iPad window's smaller box is not the basis (#3899); a multi-screen host keeps the
525525
/// resolved window, which names its panel (ADR 0025). Nil when the device's only screen would not
526-
/// report its size: no box there is a known basis, so the gesture refuses before it dispatches.
526+
/// report its size: no box there is a known basis, so the gesture refuses before it dispatches. An
527+
/// unknown orientation keeps `fallback`, which a turn that does not rotate never reads.
527528
func synthesizedRotationFrame(fallback: CGRect, interfaceOrientation: Int) -> CGRect? {
528529
guard XCUIScreen.screens.count == 1 else { return fallback }
529530
guard let portraitSize = soleDisplayPortraitSize() else { return nil }
@@ -541,7 +542,7 @@ extension RunnerTests {
541542
static func unmeasuredSoleDisplayOutcome(gesture: String) -> RunnerInteractionOutcome {
542543
.unsupported(
543544
message: "synthesized \(gesture) could not read the size of the device's only screen, so its coordinates cannot be rotated",
544-
hint: "Retry after the app is foregrounded; the runner log names the failed read as AGENT_DEVICE_RUNNER_APP_SCREEN_UNRESOLVED stage=system-app."
545+
hint: "Retry after the app is foregrounded; the runner log records why the screen size could not be read."
545546
)
546547
}
547548
#endif

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.m‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,17 @@ RunnerFullScreenEvidence RunnerFullScreenEvidenceFromForeground(
253253

254254
CGSize RunnerSystemApplicationScreenSize(void) {
255255
Class<AgentDeviceForegroundElement> element = RunnerForegroundElementClass();
256-
if (element == Nil || ![element respondsToSelector:@selector(systemApplication)]) {
257-
return CGSizeZero;
258-
}
256+
BOOL available = element != Nil && [element respondsToSelector:@selector(systemApplication)];
259257
__block CGRect screen = CGRectNull;
260-
NSString *exception = [RunnerObjCExceptionCatcher catchException:^{
258+
NSString *exception = available ? [RunnerObjCExceptionCatcher catchException:^{
261259
id<AgentDeviceForegroundElement> systemApp = [element systemApplication];
262260
if (systemApp == nil || ![systemApp respondsToSelector:@selector(frame)]) return;
263261
screen = [systemApp frame];
264-
}];
265-
if (exception != nil || !AgentDeviceForegroundFrameIsMeasurable(screen)) {
262+
}] : nil;
263+
if (!available || exception != nil || !AgentDeviceForegroundFrameIsMeasurable(screen)) {
266264
NSLog(
267-
@"AGENT_DEVICE_RUNNER_APP_SCREEN_UNRESOLVED stage=system-app frame=(%g,%g %gx%g) raised=%@",
265+
@"AGENT_DEVICE_RUNNER_APP_SCREEN_UNRESOLVED stage=system-app available=%@ frame=(%g,%g %gx%g) raised=%@",
266+
available ? @"yes" : @"no",
268267
screen.origin.x,
269268
screen.origin.y,
270269
screen.size.width,

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+SynthesizedInteractionTests.swift‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ extension RunnerTests {
235235
func testSynthesizedRotationFrameIsTheDisplayNotAPlacedWindow() throws {
236236
try XCTSkipUnless(XCUIScreen.screens.count == 1, "a multi-screen host keeps its panel's window box")
237237
app.launch()
238-
defer { app.terminate() }
238+
defer {
239+
invalidateCachedTarget(reason: "unit_test_cleanup")
240+
app.terminate()
241+
}
239242
try XCTSkipUnless(soleScreenRouteIsOpen(for: app), "the host app's frame is the display only while it fills it")
240243
let appFrame = app.frame
241244
let restoreUIKit = try simulateCompatibilityModeScreen()

0 commit comments

Comments
 (0)