perf(mobile): skip the post-gesture stabilization wait for a test's swipe and scroll
Merged
KD
7d ago+215+215+012345678901234567890123456789-8-8-0123456789
- A test's swipe and scroll now send
postGestureStabilization: false, so agent-device stops holding the next read for up to 3.5 s (1.5 s poll budget plus a 2 s distrust extension) after a gesture the test checks withexpect. The agent's gestures keep the wait. - Skipping the wait alone breaks taps:
scrollUntilVisiblefinds the control while the list still coasts, and the tap lands on a moving list, which swallows it to stop the scroll. The step passes and nothing navigates. So the first action on a control within 2 s of a skipped wait re-reads the control every 100 ms until two reads agree on its bounds (steadiedinpackages/mobile/src/surface.ts). A list that already rests costs one extra snapshot. fillandclearkeeprelocated's input checks on every re-read, and the poll stops withOPERATION_TIMEOUTwhen the action budget cannot fit another poll. Both came from the fresh-context review.- agent-device 0.21.36 ignores the option, so nothing speeds up until the dependency moves to a release that has it. The nightly
0.21.37-nightly.20261109.153accepts it.
Verified
Ran it locally: yes
- Surface: the built CLI on callstack/react-native-pager-view (40 tests in 16 files) on an iOS simulator (iPhone 17), cold boot per run, one build at a time, load below 2 before each run. Command:
node node_modules/e2e/dist/cli/bin.js run --target ios, withnode_modules/e2eand@e2e-dev/mobilepointing at the built worktrees. - Time is the sum of attempt durations over the 38 tests that passed in every run below. Run-to-run noise on this suite is 1 to 2%.
| main | this branch, nightly agent-device | this branch, agent-device 0.21.36 | |
|---|---|---|---|
| Passed | 38/40, 39/40 (two runs) | 39/40 | 39/40 |
| 38 common tests | 427.1 s, 433.0 s | 409.0 s (-4.7%) | 438.1 s (+1.9%, inside noise) |
locator.tap median | 573 ms, 556 ms | 767 ms | 613 ms |
- The one failure in every run,
issue-1096-keyboard-shrink, fails on main too (ENGINE_FAILURE, "behind the visible keyboard"). It is not this change. - Without the steady read, the same flag failed
issue-1154-page-change-focusin 3 of 3 runs andissue-1050-back-gesturein 3 of 3 (1 of 4 on main). The first tap after a scroll got slower in exchange (714 to 767 ms against 556 to 573 ms), since the wait moved from the scroll to that tap. Loweringtransitionto 200 ms cut that cost but added 3 more failures, so it is not in this change. - The main rows ran at
f4bf5299; this branch is one27f492c, which has unrelated commits in between. - Tests:
packages/mobile/tests/unit/engine.test.tscovers the flag per origin, the re-read until bounds agree, no re-read for the agent, a field that turns disabled after a gesture, and the budget stop.
Review
A fresh-context review (gpt-6.1-sol) found two issues, both fixed and covered by tests: the re-read dropped fill's input checks, and its 100 ms sleep ignored the operation's remaining budget.
š¤ Generated with Claude Code