Skip to content

test(interaction-harness): a WebKit touch driver keeps each scripted gap after a stall - #9887

Closed
vjeux wants to merge 1 commit into
meta:mainfrom
vjeux:uikit/f2-touch-pacing
Closed

vjeux wants to merge 1 commit into
meta:mainfrom
vjeux:uikit/f2-touch-pacing

Conversation

@vjeux

@vjeux vjeux commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

The pager's slow-drag proof fails in WebKit on a loaded runner, with nothing wrong in the pager. It is "a slow drag past half a page, well under the 225 px/s floor, settles…". Under load it failed 67 of 110 runs, with maxError 6 to 72 px against a bound under 1.

Intended invariant

A touch script's velocity reaches the page as written. WebKit takes no timestamp: it stamps each touch with its dispatch time, no later than it answers the dispatch. The harness keeps velocities true by pacing the sends on the wall clock.

Change

  • Every failure's load report names a burst: touch moves 0 to 1 ms apart. After a stall in the harness or the page, playSteps sent the steps behind it back to back. The release filter reads the last three samples, so it read a fast finger, and the settle did not start from rest.
  • A WebKit step now leaves at its scripted time at the earliest. It also waits for the script's gap, less 2 ms, after WebKit answered the step before (leaveAt in touch.ts). A stall then stretches the drag, and no gap reaches the page more than 2 ms short.
  • A caller that watches each step (onEvent) keeps the old pacing, as does Chromium, whose events carry scripted timestamps.
  • The touch.ts header, the README's engine table and a self-test comment say so.
  • No timeout, retry or tolerance changes, and no product file changes.

Evidence

  • Failure before the change: main failed 67 of 110 runs. Each ran in WebKit at CI's profile (podman --cpus=4, CI=1, LP_NUM_THREADS=4), 3 workers, ten runs. A full node test run with 16 workers and other WebKit runs shared the machine.
  • Success after the change: on the same machine at the same moment, order-balanced: main failed 20 of 30 and the change passed 30 of 30. In two lighter rounds, main failed 5 of 20 and the change passed 20 of 20.
  • What reaches the page: a local probe, not part of the diff, recorded the gaps of a 2.4 s drag. Main's went as low as 0 ms, with up to 32 under 4 ms in one drag. With the change none went under 15 ms. Calm runs kept the scripted 2,383 ms, and stalled runs stretched it by up to 21%.
  • Product/runtime behavior verified unchanged: test-harness-only change.
  • CI impact: none.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

Local gates at 1d403e2, one commit on main 16a5397:

  • touch.pacing.test.ts: 3 cases, which fail on main (no leaveAt) and pass here. A 3 ms slack fails two of them. With the harness's other node units: 35 passed.
  • tsc on the harness, strict ESLint, pnpm lint and Prettier on the changed files, and pnpm review:pre (no findings): clean.
  • Every interaction spec that drives touch (10 files), in WebKit at CI's profile, ten runs: 2,349 passed and 380 skipped. One harness frame-evidence case failed once; it takes no touch input, and it passed 10 of 10 on main and here, run together. In Chromium: 268 passed, 5 skipped.

…gap after a stall

WebKit stamps each touch with its dispatch time, at the latest when it
answers the dispatch. When a loaded runner held the driver or the page,
the driver sent the steps behind the stall back to back. The page then
read moves 0 to 1 ms apart, and the release filter read a fast finger.
So the pager's slow-drag proof saw a settle that did not start from
rest: maxError 6 to 72 px against under 1, in 67 of 110 runs under load.

A step now leaves at its scripted time at the earliest, and no sooner
than the script's gap, less 2 ms, after WebKit answered the step before.
A stall stretches the drag instead, and no gap reaches the page more than
2 ms shorter than the script's. Under the same load the proof passed 50
of 50. A caller that watches each step (onEvent) keeps the old pacing,
and Chromium keeps it too: its events carry scripted timestamps.
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 4, 2026 6:21am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 4, 2026
@astracat-bot

astracat-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 4, 2026, 6:30 AM UTC

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. The pull request is a draft and its branch is in a fork, so once it is marked ready for review a maintainer adds the ci:run label so CI runs.

The new leaveAt rule keeps every WebKit gap no more than 2 ms short of the script after a stall, and its unit cases fail on main and with a different slack. Two optional suggestions:

  • The WebKit pacing self-test passes onEvent, so it now runs the old rule; a take without onEvent, on a page whose touchmove listener blocks once, would pin the new wiring in the WebKit driver.
  • The README engine-limits row and the touch.ts header could say that a caller passing onEvent keeps the scripted-time pacing.

[Automated review]

| ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| Trusted touch + pointer events, multi-touch | yes | yes (a `touchstart` lists only the fingers that landed in it; pointer events exact) |
| Page sees the scripted timestamps | yes, exactly | no: real dispatch time; pacing keeps velocities within ~1 ms on an idle runner, but a CPU-starved one sends some steps late, then back to back |
| Page sees the scripted timestamps | yes, exactly | no: real dispatch time; ~1 ms pacing on an idle runner; after a stall each step keeps its gap, less 2 ms, so the drag stretches |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: a WebKit caller that passes onEvent (this harness's own pacing self-test, AlertDialog's highlight test) still sends late steps back to back. Consider adding "unless the caller passes onEvent" here and in the touch.ts header, which the SYNC note keeps equal to this row.

//
// The pacing is bounded from above too. The harness waits only while it
// is ahead of the script and sends a late step at once, so a move it
// is ahead of the script and, as this take watches every step, sends a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: because this take passes onEvent, it now exercises only the scripted-time rule, and no committed test reaches the gap-keeping path the WebKit driver turns on (touch.ts:272). A second take without onEvent, on a fixture whose touchmove listener blocks once for about 80 ms, could assert that no page timeStamp gap falls below the scripted gap less 2 ms (plus clock rounding).

vjeux added a commit to vjeux/astryx that referenced this pull request Nov 4, 2026
… so no gap reaches the page short

WebKit stamps a touch when it arrives, no later than it answers the
dispatch. A paced play sent the next touch its interval after the one
before left. So a touch the page took late, then answered quickly, could
reach the page 1 to 3 ms before the next one, and the page read a
bunched, far faster release.

Each touch now also waits for its interval, less 2 ms, after WebKit
answered the one before: under `pacing: 'spacing'`, and on a WebKit
`'schedule'` play that does not watch each step. No gap reaches the page
more than 2 ms short of the script's. A stall stretches the gesture, and a
slow runner reads a slower release. This is meta#9887's rule, carried onto the
paced play.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 4, 2026
… so no gap reaches the page short

WebKit stamps a touch when it arrives, no later than it answers the
dispatch. A paced play sent the next touch its interval after the one
before left. So a touch the page took late, then answered quickly, could
reach the page 1 to 3 ms before the next one, and the page read a
bunched, far faster release.

Each touch now also waits for its interval, less 2 ms, after WebKit
answered the one before: under `pacing: 'spacing'`, and on a WebKit
`'schedule'` play that does not watch each step. No gap reaches the page
more than 2 ms short of the script's. A stall stretches the gesture, and a
slow runner reads a slower release. This is meta#9887's rule, carried onto the
paced play.
@vjeux

vjeux commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #9956.

@vjeux vjeux closed this Nov 4, 2026
@vjeux
vjeux deleted the uikit/f2-touch-pacing branch November 4, 2026 14:10
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 4, 2026
…ch step waits for each answer, so no gap reaches the page more than 2 ms short

WebKit stamps a touch when it arrives, no later than it answers the
dispatch. A paced play sent the next touch its interval after the one
before left. So a touch the page took late, then answered quickly, could
reach the page 1 to 3 ms before the next one, and the page read a
bunched, far faster release.

Each touch now also waits for its interval, less 2 ms, after WebKit
answered the one before: under `pacing: 'spacing'`, and on a WebKit
`'schedule'` play that does not watch each step (`onEvent`), which keeps
its scripted times. No other gap reaches the page more than 2 ms short of
the script's. A stall stretches the gesture, and a
slow runner reads a slower release. This is meta#9887's rule, carried onto the
paced play.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 4, 2026
…ch step waits for each answer, so no gap reaches the page more than 2 ms short

WebKit stamps a touch when it arrives, no later than it answers the
dispatch. A paced play sent the next touch its interval after the one
before left. So a touch the page took late, then answered quickly, could
reach the page 1 to 3 ms before the next one, and the page read a
bunched, far faster release.

Each touch now also waits for its interval, less 2 ms, after WebKit
answered the one before: under `pacing: 'spacing'`, and on a WebKit
`'schedule'` play that does not watch each step (`onEvent`), which keeps
its scripted times. No other gap reaches the page more than 2 ms short of
the script's. A stall stretches the gesture, and a
slow runner reads a slower release. This is meta#9887's rule, carried onto the
paced play.
cixzhang pushed a commit that referenced this pull request Nov 4, 2026
…ch step waits for each answer, so no gap reaches the page more than 2 ms short (#9956)

test(interaction-harness): a WebKit touch play that does not watch each step waits for each answer, so no gap reaches the page more than 2 ms short

WebKit stamps a touch when it arrives, no later than it answers the
dispatch. A paced play sent the next touch its interval after the one
before left. So a touch the page took late, then answered quickly, could
reach the page 1 to 3 ms before the next one, and the page read a
bunched, far faster release.

Each touch now also waits for its interval, less 2 ms, after WebKit
answered the one before: under `pacing: 'spacing'`, and on a WebKit
`'schedule'` play that does not watch each step (`onEvent`), which keeps
its scripted times. No other gap reaches the page more than 2 ms short of
the script's. A stall stretches the gesture, and a
slow runner reads a slower release. This is #9887's rule, carried onto the
paced play.
@vjeux
vjeux restored the uikit/f2-touch-pacing branch November 6, 2026 10:46

This branch was successfully deployed

1 active deployment
Preview — 1d403e22 Deployed Nov 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant