fix(ios-runner): enter tree capture before reading snapshot viewport - #2938
Conversation
Size Report
Startup median (7 runs, lower is better):
|
|
Exact-head live validation is green on The iOS job queued about 7m31s and ran 28m00s. A separate Settings replay first attempt spent 165.128 s in |
|
Reviewed at 8310fda. The code is ready for human review: moving tree capture before the viewport read closes the ordering gap, extending the same "read geometry after the tree" invariant already used for keyboardBand. All 18 checks are green at head 8310fda, including the Smoke Tests job that ran the targeted iOS runner XCTest suite for this diff (64 tests, 0 failures, testAbandonedTreeCaptureSkipsQuerySweepAndHonorsWarmupExemption passed in 28.826s), confirmed against this exact SHA. I could not reproduce the author's planted-red local repro (the temporary 2s viewport delay) since that code was removed before this commit, so I'm relying on the PR body's description of that methodology; I also didn't read the query-sweep tier and private-AX fallback call sites end to end, though grepping the safeSnapshotViewport/makeSnapshotTraversalContext/captureSnapshotRootBounded sites suggests neither races a competing tree XPC call on the same hop, so the fix shouldn't need to apply there — can you confirm that's the case? Not blocking: box.blockingTreeEntered in RunnerTests+SnapshotCapturePlanOccupancyTests.swift:138 (https://github.com/callstack/agent-device/blob/8310fda/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+SnapshotCapturePlanOccupancyTests.swift#L138) would likely pass under the pre-fix ordering too outside the rare cold-cache/contention window the bug depends on, so it's a known limit of timing-based regression tests rather than something to fix now — take it or leave it. |
|
Confirmed at Agreed on the test limit: |
|
Summary
Start the required XCTest root capture before reading viewport geometry. A cold viewport hop previously consumed its 1 s cap before the blocking tree stub was entered, so the occupancy test failed for the wrong operation. The viewport timeout now names the viewport read. The test asserts the tree stub entered and no longer warms geometry uncapped.
Touches 2 Swift runner files.
Validation
Head
8310fda391:pnpm install --frozen-lockfile,pnpm build,pnpm format,pnpm check:xctest-selection, andpnpm check:affected --runpassed. iOS 26.2 focused XCTest passed withtree_captureabandoned and private-AX recovery.Planted red: a temporary 2 s delay in the original viewport hop reproduced the CI failure: the viewport timed out and the tree-stub entry assertion failed. With tree-first ordering, the same planted delay passed; it was removed before this commit.
GitHub iOS/macOS jobs are pending. Physical-device replay remains manual-only.