Repository navigation
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 - #9956
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested: the pacing fix looks right, and the new unit cases fail on the old rule and pass here, but the pull request's stated claim is broader than what the change does.
- The title and the Intended invariant say every WebKit touch play waits for each answer so no gap reaches the page short, but a play that passes
onEventkeeps its scripted times (keepsGapsintouch.ts) and the bound is 2 ms (ANSWER_SLACK_MS), so please retitle along the lines of "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" and add theonEventexception to the invariant, the README engine-limits row and thetouch.tsheader.
Separately, and not blocking: the PlayOptions.pacing doc still gives a burst after a stall as the reason to choose 'spacing', which on WebKit now only happens to plays that watch each step.
[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; `pacing: 'spacing'` keeps the script's spacing after a stall instead, and fails a play whose page read a resting finger where the script moves, a throw where the script rests, or fewer than two moves, or, given `releaseTolerance`, a release that strays further than that from the script's (each read as Core's velocity tracker reads it): `TouchPageStallError` when the page's own touch or pointer listeners held an event back, `TouchPacingError` otherwise; the lift's `release` names what the page read | | ||
| | Page sees the scripted timestamps | yes, exactly | no: real dispatch time; pacing keeps velocities within ~1 ms on an idle runner, after a stall each step waits for its gap, less 2 ms, from WebKit's answer to the step before, so it stretches; `pacing: 'spacing'`, too, fails a play whose page read a resting finger where the script moves, a throw where the script rests, or fewer than two moves, or, given `releaseTolerance`, a release that strays further than that from the script's (each read as Core's velocity tracker reads it): `TouchPageStallError` when the page's own touch or pointer listeners held an event back, `TouchPacingError` otherwise; the lift's `release` names what the page read | |
There was a problem hiding this comment.
This row reads as if every WebKit play now waits for WebKit's answer after a stall, but a play that passes onEvent keeps its scripted times (keepsGaps in touch.ts), so it can still bunch behind a stall. Suggest adding "unless the play watches each step (onEvent)" here and in the matching touch.ts header line.
There was a problem hiding this comment.
Done in 72503cb: the row now says each step waits for its gap, less 2 ms, after WebKit's answer "unless a 'schedule' play has onEvent". A 'spacing' play waits even when it watches each step.
| * ~1 ms on an idle runner; after a slow dispatch each step waits for its | ||
| * gap, less 2 ms, after WebKit answered the step before, so a stall | ||
| * stretches the gesture instead of bunching it); |
There was a problem hiding this comment.
Same gap as the README row: keepsGaps is false for a play with onEvent (line 558), so such a play does not wait for the answer and a stall can still bunch it. The TouchPacing doc below states the exception; this header (kept in sync with the README) should too.
There was a problem hiding this comment.
Done in 72503cb: the header names the same exception ("unless a 'schedule' play watches each step, onEvent").
…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.
2c623ed to
72503cb
Compare
|
Retitled, and the invariant now names the exception: a |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The new pacing rule bounds each page gap as the retitled description and invariant now say, and the seven new unit cases fail on the old rule and pass here. CI starts once the pull request is marked ready for review and, since the branch lives in a fork, a maintainer adds the ci:run label.
[Automated review]
Maintainer impact
WebKit stamps an injected touch when it arrives, no later than it answers the dispatch. The paced play sent each touch its interval after the one before left, so a touch the page took late reached it 1 to 3 ms before the next. The page then read a bunched, far faster release. In 100 loaded runs of the Slider's busy proof, one read 6,493 px/s against the script's 910; its coast hit the track's end within 58 ms (
BusyWindowTooLateError). #9887 fixed the same burst on WebKit's default play before the paced play existed; this carries its rule onto today's code.Evidence
ANSWER_SLACK_MS: on a 2-thread pin (one physical core), an idle WebKit answered 253 of 260 dispatches within 2 ms; the longest took 8.touch.pacing.test.tscases fail on main's pacing and pass here, including a bound: with answers of 1 to 30 ms, no two stamps come more than 2 ms closer than the script.Intended invariant
Unless it is a
'schedule'play that watches each step (onEvent), a WebKit touch play reaches the page with no gap more than 2 ms shorter than the script's: a stall stretches it instead.Change
pacedDeadline: under'spacing', a touch also waits its interval, lessANSWER_SLACK_MS(2 ms), after the answer to the touch before.'schedule'play waits the same way unless it watches each step (onEvent); Chromium's'schedule'plays keep their scripted times.TouchPacing, the README's engine table and a self-test comment.Scope
Testing
Local gates at 72503cb (browser runs and typecheck at 2c623ed, which differs only in comments and the README), on
mainf59ffe1: typecheck (after a fresh build),CI=true pnpm lint(no errors, and no warnings in changed files), Prettier,check:knowledge, changeset coverage (nothing ships), the harness's and Core's gesture unit tests (934),pnpm review:pre(no findings) and the full unit suites (test:ui19,955 passed;test:node16,448 passed). Browser runs at c4897ce, which differs from this head only in comments and the README, in WebKit in the CI job's container profile (4 CPUs, one worker): the new self-test ×10 (10 passed; main's pacing failed 10 of 10 under each pacing), and the Slider's busy proof ×20 with #9694's commit on top (20 passed). Every interaction spec that drives touch (11 files), at 2c623ed on a fresh Storybook build: 244 passed and 39 skipped in WebKit in that profile, and 275 passed and 8 skipped in Chromium.