Skip to content

fix(ios): read a full-screen app's snapshot viewport from its root snapshot - #4650

Open
gronxb wants to merge 5 commits into
callstack:mainfrom
gronxb:fix/ios-snapshot-viewport-from-root-snapshot
Open

gronxb wants to merge 5 commits into
callstack:mainfrom
gronxb:fix/ios-snapshot-viewport-from-root-snapshot

Conversation

@gronxb

@gronxb gronxb commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On a full-screen iOS app with a heavy screen, a tap right after a snapshot fails with RUNNER_BUSY. The tree tier read the viewport through a live app.windows resolution. Each of its reads snapshots the whole app again. On a 3,000-link WKWebView they took 7.4 s. That overran the 1 s slice, discarded the finished tree, and left main-thread work that refused the next tap.

A full-screen window at the origin (the #4573 rule, now one predicate) now takes its viewport from the root snapshot. Snapshot frames are in window content space. So placed iPad windows, offset windows, landscape, lit panels, and non-iOS keep the live read.

5 files: runner Swift, two runner tests, runner README.

Validation

Head 4836a661b on main 945b1f0d0. iPhone 17 Pro simulator, iOS 26.5, gronxb/e2e-repro ./repro.sh:

main head
passes 1/4 4/4
snapshot_viewport abandoned 4 0
RUNNER_BUSY taps 3 0
  • The new runner test fails on main (1 live window read) and passes on head.
  • Full iOS runner suite at eddad1abc: 748 tests run. The 5 failing landscape tests fail identically on main (the host app does not rotate).
  • iOS, macOS, and tvOS builds pass. check:xctest-selection passes.
  • check:affected --run --head 4836a661b: only unit fails, on eager-closure-budgets (Android). It fails on main too.
  • Not run live: iPad placed window and landscape. A pure test covers both.

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

View guided diff

…apshot

The tree tier read the viewport after the root snapshot through a live
app.windows resolution. Each of its reads (the window list, exists, frame)
snapshots the whole app again: on a heavy web view they took 7.4 s, ran past
the viewport's 1 s slice, discarded the completed tree capture, and left
main-thread work that refused the next tap with RUNNER_BUSY.

When AXRuntime reports the target as the primary app filling the screen and
the snapshot's first usable window is exactly that screen at the origin, the
viewport is that window's frame. A placed iPad window, an offset window, and a
landscape window keep the live read, since a snapshot frame is in window
content space.
@thymikee

Copy link
Copy Markdown
Member

Thanks, this is ready at 4836a66. The change reads correctly, and all 14 checks pass at this head. There are no conflicts. Nothing else must happen before merge.

Not blocking, and you can take or leave these: the comment above the snapshot_viewport hop in RunnerTests+SnapshotAcquisition.swift still says the viewport and the orientation are read in one hop, but on the full-screen path the box now comes from the root snapshot and only the orientation is read live; fullScreenFrame(of:) at line 146 runs its AXRuntime probe even when the snapshot has no usable window, so it could run only after a usable window is picked; and the new regression test in RunnerTests+InteractionTests.swift skips when the predicate under test returns nil, so it cannot fail in that case.

The 7.4 s measurement and the 1/4 vs 4/4 repro table are author-reported, with no attached logs. No live run covers an iPad full-screen app, which now takes the snapshot path. The exact-equality guard keeps that safe, because any frame mismatch falls back to the live read.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 17, 2026
Address review: the AXRuntime probe now runs only once a usable window is found, the viewport hop comment names the snapshot box, and the regression test fails instead of skipping on an iPhone.
@gronxb

gronxb commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. All three are in 69f7fe4:

  • The comment above the snapshot_viewport hop now says a full-screen app's box comes from the root snapshot and only its orientation is read live.
  • fullScreenWindowFrame takes the full-screen frame as an autoclosure, so the AXRuntime probe runs only after a usable window is found.
  • The regression test skips only on an iPad, where the fixture window can be placed. On an iPhone a nil predicate now fails the test.

The three affected tests pass on an iPhone 17 Pro simulator (iOS 26.5). The iOS, macOS, and tvOS runners build, and check:xctest-selection passes.

@thymikee thymikee removed the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 18, 2026
@thymikee

Copy link
Copy Markdown
Member

This PR is ready from my review at 69f7fe4. The three notes from the earlier review (4836a66) are fixed: the stale one-hop comment, the probe running without a usable window, and the test that skipped when the predicate was nil. I found no new problems in the delta. Not blocking: testSnapshotViewportUsesOnlyAFullScreenWindowAtTheOrigin in RunnerTests+SnapshotAcquisitionTests.swift passes the full-screen frame as a plain value, so it never proves the probe stays unevaluated when there is no usable window. Reverting the autoclosure to an eager CGRect keeps every assertion green. One extra case with windowFrames: [.zero] and a probe that calls XCTFail would cover it. You can take or leave this.

The earlier review comment above still applies: all three of its notes are fixed at this head, so that thread can be resolved.

The simulator results in your comment, the 7.4 s measurement and the repro table are author-reported, and no live iPad or landscape run covers the placed-window and landscape fallbacks. The pure predicate test covers both.

CI is green apart from one job still running, and the earlier head passed all 14 checks. There are no conflicts, and nothing else blocks merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants