Repository navigation
fix(mobile): wait for transitions before screen swipes - #1564
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
|
[Codex] responding on behalf of shamilovtim CI is green and no review threads remain at 8c286c7. A temporary checkout combining the current heads of #1557, #1559, #1561 and #1564 passes all 516 mobile tests, build, typecheck and focused lint. This account has read access and cannot apply the |
okwasniewski
left a comment
There was a problem hiding this comment.
Automated review by Claude Code on behalf of maintainers.
Thanks, the bug is real: on main the screen-root branch of perform() sends the scroll without consulting the transition budget, while every other test action does. Applying the existing budget there is the right fix, and the cancellation handling looks solid.
A few things before this can go in:
waitForTransition(entry: NodeBinding | undefined, operation, budget?: InputBudget)now does two jobs: the control "already in place" shortcut and a plain wait for the rest of the budget. That is where the nullableentry, the optionalbudgetonly one caller passes, and the JSDoc about screen swipes come from. Please split out the budget wait (e.g.waitOutTransition(operation, budget), cancellable, capped bybudget.remainingMs()), havewaitForTransition(entry, operation, budget)call it after the shortcut, and have the root branch call it directly. That is also the primitive #1563 asks for.- Every test screen swipe now waits out the budget left from the previous action, including a previous screen swipe.
screen.scrollUntilVisibleswipes in a loop, so each page can gain up totransitionminus the read time, and back-to-backscreen.swipe()calls gain about 500 ms each. Please share mobile benchmark numbers before/after, or explain why waiting between consecutive screen swipes is intended. - Please add a test that an agent-origin screen swipe does not wait: changing
if (deterministic)toif (true)currently passes the whole suite.
Nits:
if (waitMs <= 0) return false;does nothing (the root caller ignores the result andsend()already rejects a spent budget).docs/reference/mobile.mdxandoptions.tsput the new sentence in different spots relative to "Raise it for slower transitions"; please match them and rewrap the long lines (same in bothsetup.mdcopies).- The changeset's second sentence is implementation detail; the first is enough.
Heads-up: this conflicts with #1557 in the comment above the root-swipe branch. The code composes (wait first, then #1557's keyboard snapshot), so whichever lands second needs a small rebase.
8c286c7 to
f52bdc7
Compare
|
[Codex] responding on behalf of shamilovtim Addressed in f52bdc7 after rebasing onto main 1bbda5a.
The redundant boolean return is gone. The option/reference sentence order and wrapping match, both setup copies are wrapped, and the changeset keeps only its first sentence. This PR changes no gesture geometry. #1557 has now been withdrawn after its separate native SDK ownership audit, so the prospective root-comment conflict is gone and no stacking dependency remains. All 505 mobile tests, build, typecheck, lint, and GitHub denied the programmatic re-review request for this account. @okwasniewski, please re-review f52bdc7 when available. |
okwasniewski
left a comment
There was a problem hiding this comment.
Automated review (agent-run triage).
Re-review of f52bdc7: every ask is done.
waitOutTransition(operation, budget)(surface.ts:1249) is now the shared primitive. Control and root paths each wait once, and fill waits once and then relocates.- The
bench:abnumbers hold up. They show abouttransitionof extra time per back-to-back screen swipe, and main's times don't change with the budget. - The agent-origin path is covered now: forcing the wait for agent swipes fails "keeps agent-origin screen swipes immediate with driver settling".
- Budget semantics: when the wait can't fit, it throws
OPERATION_TIMEOUT(not retryable) before anything is sent. For taps and fills, main already failed with the same code, just later.scrollUntilVisiblestill turns a deadline cut intoLOCATOR_NOT_FOUND. - 13 mutations on surface.ts: 10 killed, and the 3 survivors are equivalent. Mobile unit 505/505, tsc and oxlint clean, CI native jobs green, merges clean on main. #1557 was withdrawn, so that conflict is gone.
Nits (optional):
- surface.ts:1258: the error message doesn't name the action or the fix (raise
timeoutor lowertransition). It also builds the error outsideInputBudget, so it skipsspent(). That's safe today only because every wait comes before the first send. - surface.ts:1251 and :1270-1271 compute the remaining transition twice. A small helper would remove that.
- The changeset should say screen swipes and
scrollUntilVisibleget slower by abouttransitionper swipe. Users will notice it in run times. - The
it.each([20, 20.5])case for 20.5 adds little.
Maintainer call: accept about +0.5 s per scripted screen swipe by default, or skip the wait when the previous action was itself a root swipe. #1563 (device.waitForTransition()) is still unanswered.
Asks addressed in f52bdc7 (automated review).
waitOutTransition(operation, budget)with control transitions. Unchanged-control shortcuts and agent settling remain. A budget too short for the transition fails unsent, including an early timer wake.flowchart LR A[Last action returns] --> B[Wait within transition and action budgets] B --> C{Cancelled or budget too short?} C -->|Yes| D[No input] C -->|No| E[Send screen swipe]Issue
Fixes #1562.
Verified
Ran it locally: yes.
Public controlled CLI reproduction: main
1bbda5afails, this branchf52bdc7passes. All 505 mobile tests andpnpm checkpass. The agent-origin regression fails if its wait is made unconditional; integer/fractional early-wake, cancellation, and sufficient-budget cases pass.Native pacing cost is measurable. Fixture source/build and timing suite, reports, and clips are public. These are median test-body seconds from the official
bench:abharness on the same UIKit 40-row list binary, iPhone 15 Pro / iOS 27.0 Simulator, agent-device 0.21.36. Each budget has three measured pairs and one excluded warmup, one worker, zero retries. Both builds pass both cases with matching reported behavior/counters.1bbda5af52bdc7scrollUntilVisible, row 25scrollUntilVisible, row 25API time sums the four
screen.swipesteps or the onescrollUntilVisiblestep. Test bodies also include app launch and assertions. Identical temporary fixture files were untracked in both prepared checkouts; production files matched the listed commits.Waiting between consecutive test swipes is intentional: a swipe can itself start a scroll or pager animation, and a screen-root gesture has no target binding whose unchanged position proves readiness. Captures and assertions consume the budget before the next swipe. The configured budget is a heuristic, not proof that a native animation has completed.
These fixture runs measure pacing cost, not a failure-rate improvement or the entire Expo benchmark suite. One measured pair per budget is linked below. GitHub disallows uploading attachments to this upstream repository with this account's read access, so the clips are published on the public evidence branch.