Skip to content

test(interaction-harness): wheel and pen input drivers for every-pointer proofs - #8666

Merged
cixzhang merged 4 commits into
meta:mainfrom
vjeux:harness/web-input-drivers
Oct 30, 2026
Merged

cixzhang merged 4 commits into
meta:mainfrom
vjeux:harness/web-input-drivers

Conversation

@vjeux

@vjeux vjeux commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Why

Gesture proofs could drive only a finger. The every-pointer requirement (spec:AST-100 FR4: the same motion from touch, pen and mouse) and #8646, which has gestures attach for every pointer, need a pen stroke and a wheel step as real browser input. A hand-made wheel step was also wrong on phones: Chromium divides it by the device-pixel ratio, so a 120 px step reached a phone page as 40.

What led to it

We are bringing Astryx's touch components to the behavior of native controls, and their proofs drive real browser input through the interaction harness. With gestures now accepting every pointer, the harness had to drive a pen and a wheel the same way it drives a finger.

Options and tradeoffs

  • Synthetic DOM events (new WheelEvent, new PointerEvent): untrusted, and a component can tell (isTrusted), so they prove nothing about real input.
  • Playwright's own wheel as is: a third of the delta in a phone context, and no pen at all.
  • The browser's own input commands (this pull request): in Chromium, its DevTools input, with the wheel delta scaled back and pen strokes carrying pressure, tilt and their scripted times; in WebKit, its own wheel in a desktop context. WebKit's phone emulation has no wheel and Playwright has no WebKit pen, so the driver says so with flags and proofs skip with a stated reason.

Why this choice

It is the only option whose events are trusted and go through the browser's own input pipeline, and it states each engine's limits instead of hiding them.

A run of wheel steps, as a trackpad page swipe sends, goes through wheelBurst({x, y, steps, everyMs, maxGapMs}): it sends every step on its schedule without waiting for the one before, resolves once the page has the run's whole delta, and, past maxGapMs, throws WheelPageStallError when the page's own wheel listeners held the main thread on the step before (WebKit dispatches the next step only once the page is free), and WheelPacingError, naming the gaps, when the dispatch stalled before the page. retakeOnWheelPacing re-takes a proof once, only on WheelPacingError, and lists the re-take; a stall the page caused fails the proof.

How to check it

  1. pnpm exec playwright test --config playwright.interaction.config.ts internal/interaction-harness/src/harness.interaction.browser.spec.ts --project chromium -g "wheel and pen input".
  2. Expected: a wheel step is on the page by the time wheel() resolves, as exactly its deltas, trusted, with Control when held, whether the page's wheel listeners are passive or not; a pen stroke arrives as trusted pen pointer events with its pressure and its scripted 100 ms between the first and last points.
  3. With --project webkit, the desktop wheel cases pass and the phone wheel and pen cases skip, each naming why.
  4. pnpm exec vitest run internal/interaction-harness/src/webInput.pacing.test.ts: the re-take stays red when both attempts are off pace, never re-takes a product failure, and passes and is listed when an off-pace attempt is followed by a good one.
  5. -g "burst": a burst paced at 180 ms against a 100 ms bound throws WheelPacingError in both engines, as does one paced at 125 ms over a page whose listener takes 30 ms (the page is free before each step arrives); a page that blocks 150 ms on each step is never re-taken (WheelPageStallError in WebKit, where a gap is the page's only when the step reached it within a frame of its listeners finishing the one before; in Chromium every gap is the dispatch's).
  6. Two earlier mistakes now have their own cases: reading the page right after wheel() missed the step when every listener was passive, and a stroke sent right after a navigation pressed at 41 px for 100.

Evidence

@vercel

vercel Bot commented Oct 27, 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 Oct 30, 2026 9:20pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 30, 2026, 9:40 PM UTC

@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.

Changes requested: the new wheel and pen drivers deliver what they promise (exact CSS-px wheel deltas on the 3× phone project, trusted pen pointers with pressure and scripted times), but in Chromium wheel() resolves before the page has received the step whenever the page's wheel listeners are all passive. With the self-test's first wheel case minus takePinches, the ctrl step is missing when the log is read right after the call and present 300 ms later, and nothing zooms, so the README's engine-limit row and the webInput.ts header misdescribe this as a ctrl-only rule. Please make the Chromium step wait until the page has it (or document that it resolves at dispatch), correct those notes and the test comment, and add a self-test that reads the log right after a step on a page with only passive wheel listeners. Separately, spec:AST-094 FR43 is not on main yet (#8646 is still open), so cite spec:AST-100 FR4 or land this after #8646.

[Automated review]

Comment on lines +94 to +101
await cdp.send('Input.dispatchMouseEvent', {
type: 'mouseWheel',
x,
y,
deltaX: dx * scale,
deltaY: dy * scale,
modifiers: ctrl ? 2 : 0,
});

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.

In Chromium this send resolves before the page has received the step whenever the page's wheel listeners are all passive, and every page with the input log has one. With the self-test's first wheel case minus takePinches, the ctrl step is missing when the log is read right after wheel() and present 300 ms later. Could wheel wait until the page has the step, for example by arming a one-shot capture-phase wheel listener with page.evaluateHandle before cdp.send and awaiting it with a timeout?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in ad9e942: wheel arms a one-shot passive capture listener before the dispatch and waits until the page has the step (a 2 s limit, then it throws), in WebKit too. A new self-test reads the log right after each step on the input log's all-passive page: on 9e328e7 it fails (length 0), now it passes.

Comment thread internal/interaction-harness/README.md Outdated
| Lifting one finger while others stay down | yes | pointer events right, but that `touchend` lists no remaining `touches`: skip with `PARTIAL_LIFT_SKIP` |
| Click synthesised from a touch | yes | only from `driver.tap` (WebKit's tap gesture), not from a raw touch sequence |
| Curve sampling, storyboards, input log | yes | yes |
| Wheel steps, exact CSS px deltas (`webInput.ts`) | yes (a ctrl step reaches only a page with a non-passive wheel listener) | desktop context only (`isMobile: false`): skip with `WHEEL_SKIP` |

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.

With this config (Playwright 1.61.1, Chromium 149, phone and desktop contexts), a ctrl step on a page with only passive wheel listeners does reach the page (ctrlKey: true) and nothing zooms: the visual viewport scale and devicePixelRatio are unchanged. It just arrives after wheel() resolves, like any step on such a page; a non-passive listener only makes Chromium dispatch it before wheel() returns. The same wording is in webInput.ts lines 19-22 and in the self-test comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in ad9e942: right, it was delivery timing, not Control; a ctrl step reaches an all-passive page too and nothing zooms. The README row, the webInput.ts header and the self-test comment now say that wheel waits for the page there; the ctrl-only note is gone.

Comment thread internal/interaction-harness/README.md Outdated
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `scripts.ts` | Touch scripts as data: `tap`, `drag` (hold, rest), `flick` (exact final-move speed, velocity profiles), `holdThenDrag`, `pinch`, `rotate`, `path`, `merge` (a second finger mid-gesture), `releaseVelocity`, `toTouchEvents`. |
| `touch.ts` | `touchDriver(page).play(script)`: the script as real engine input. `installInputLog` / `readInputLog`: what the page received. |
| `webInput.ts` | `webInputDriver(page)`: `wheel({x, y, dx, dy, ctrl})` and `pen(points)` as real engine input, for every-pointer proofs (`spec:AST-094` FR43); read back through the input log. |

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.

spec:AST-094 FR43 is not on main yet (it is proposed in #8646, which is still open), so this citation points at nothing for now. spec:AST-100 FR4 already asks for touch, pen and mouse streams; alternatively, land this after #8646.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in ad9e942: the README and webInput.ts cite spec:AST-100 FR4 now.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026

@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.

Changes requested: wheel() now resolves once the page has the step and its deltas arrive exact, but in Chromium pen() sends its press with no page round trip, so a stroke that starts right after a navigation can press at 0.41× its coordinates (the page gets pointerdown at 41.02, 41.02 for a press at 100, 100: 402/980, the page scale of the about:blank page each test starts on in the phone project). The new pen self-test hits this intermittently on its first assertion (harness.interaction.browser.spec.ts:332), which would make the Chromium interaction lane flaky. Please have pen() wait for the page to present a frame before the press (two requestAnimationFrames through page.evaluate, as openStory does); with that wait in place every press landed where scripted. Optionally, note in the engine-limits table that WebKit's wheel step also moves the mouse (a pointermove) and presses Control as a key, which Chromium's step does not.

[Automated review]

Comment on lines +159 to +164
for (const {type, point} of events) {
const wait = startWall + point.t - Date.now();
if (wait > 0) {
await sleep(wait);
}
await cdp.send('Input.dispatchMouseEvent', {

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.

In Chromium the press goes out with no page round trip before it (at t = 0 there is no wait), so a stroke that starts right after a navigation can be placed with the previous document's page scale. With the driver created before goto and the stroke sent right after it, 28 of 30 strokes pressed at (41.02, 41.02) instead of (100, 100), which is 402/980, the scale of about:blank in the phone project; the later moves landed where scripted. The self-test's pen case failed 3 of 88 runs the same way on its first assertion (harness.interaction.browser.spec.ts:332). Could pen wait for the page to present a frame before the press, for example:

await page.evaluate(
  () =>
    new Promise<void>(resolve =>
      requestAnimationFrame(() => requestAnimationFrame(() => resolve())),
    ),
);

With one page round trip or two frames before the stroke, 30 of 30 presses landed at (100, 100).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in b246458: pen now waits for the page to present two frames before the press (the harness's own frames, past a frozen timer gate). A new self-test creates the driver before the navigation and strokes right after it: on ad9e942 it pressed at (41.02, 41.02) 9 of 10 times, now 20/20 at (100, 100). The README's WebKit wheel row also says the step moves the mouse there (a pointermove) and holds Control as a key.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 27, 2026

@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.

Recommending approval: wheel() now resolves with exact CSS-px deltas once the page has the step, and pen() presses where it is scripted even right after a navigation, with self-tests that fail if either wait is removed. One optional follow-up: Chromium's pen goes through the mouse pipeline, so a stroke over a native scroller pans nothing, raises no pointercancel and ends in a click; a row in the README's engine-limits table would keep pen proofs from relying on stylus-like panning.

[Automated review]

Comment thread internal/interaction-harness/README.md Outdated
| Click synthesised from a touch | yes | only from `driver.tap` (WebKit's tap gesture), not from a raw touch sequence |
| Curve sampling, storyboards, input log | yes | yes |
| Wheel steps, exact CSS px deltas (`webInput.ts`) | yes | desktop context only (`isMobile: false`): skip with `WHEEL_SKIP`; the step also moves the mouse there (a `pointermove`) and holds Control as a key |
| Pen strokes, pressure, scripted timestamps | yes | no: skip with `PEN_SKIP` |

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: Chromium's pen goes through the mouse pipeline, so it differs from a stylus on a phone or tablet in ways this table could state. A stroke over a native overflow: auto scroller pans nothing (scrollTop stays 0, against 457 px for the same motion as a touch drag), raises no pointercancel, selects the text it crosses and ends in a click. For example:

| Pen panning, `touch-action`, `pointercancel` | no: mouse pipeline (a drag over text selects it and ends in a click) | no: skip with `PEN_SKIP` |

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: The accessibility audit did not run on this pull request. It runs after merges to main and before each release; pull requests that touch components run it with the ci:heavy-lanes label.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
…b input drivers, meta#8535) into uikit/c09-search-fr43
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
…b input drivers, meta#8535) into uikit/c09-search-fr43
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 31, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 1, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 1, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 1, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 1, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 1, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 1, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…y pointer

meta#8696's own change (spec:AST-094 FR43). CheckboxInput, CheckboxList and
RadioList take one press model for a finger, a mouse and a pen: their owners
and the layer over the box serve every pointer, a RadioList row drops its
`:active` press arm, and the press tests read that one model.

The pen case follows in its own commit: it needs the pen driver
(`webInputDriver`, `PEN_SKIP`) from meta#8666, which lands first.

Absorbs meta#8696 (d96069b).
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
meta#8696's pen case (spec:AST-094 FR43), on its own because it needs the pen
driver (`webInputDriver`, `PEN_SKIP`) from meta#8666, which lands first.

Absorbs meta#8696 (d96069b).
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…y pointer

meta#8696's own change (spec:AST-094 FR43). CheckboxInput, CheckboxList and
RadioList take one press model for a finger, a mouse and a pen: their owners
and the layer over the box serve every pointer, a RadioList row drops its
`:active` press arm, and the press tests read that one model.

The pen case follows in its own commit: it needs the pen driver
(`webInputDriver`, `PEN_SKIP`) from meta#8666, which lands in section 1.

Absorbs meta#8696 (d96069b).
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
meta#8696's pen case (spec:AST-094 FR43), on its own because it needs the pen
driver (`webInputDriver`, `PEN_SKIP`) from meta#8666, which lands in section 1
before this section.

Absorbs meta#8696 (d96069b).
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
… follow-ups

A helper for lanes on F2's line: the harness files (README, the harness self-test, index.ts) resolved by the harness owner, keeping both sides' instruments.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
This pull request carried meta#8666 only up to b246458; meta#8666's head adds
its main merge and its later harness text. The two conflicts are meta#8666's
harness files, resolved with meta#8666's author keeping both sides:
- internal/interaction-harness/README.md: meta#8360's module and
  engine-limits tables with meta#8666's webInput row and its wheel and pen
  rows, both engine columns (the same text as meta#8666 merged onto meta#8360);
- harness.interaction.browser.spec.ts: meta#8360's header with meta#8666's wheel
  and pen clause, and every test from both sides; this pull request's own
  changes to the backward-run timing stay.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…l (FR43)

A held pen (the harness's pen driver, meta#8666, Chromium) paints the checkbox's press layer
while the controller marks the press on, then releases it, as a mouse and a
finger do (spec:AST-094 FR11's fine-pointer profile, FR43). The case reads
the layer's image in the task each press state is written, so a press that
is marked but not painted fails: it fails on the previous build, where the
layer read the press under a coarse pointer only. WebKit has no pen input in
Playwright and skips with the driver's reason.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…ter proofs (meta#8666)

## Why

Gesture proofs could drive only a finger. The every-pointer requirement (`spec:AST-100` FR4: the same motion from touch, pen and mouse) and meta#8646, which has gestures attach for every pointer, need a pen stroke and a wheel step as real browser input. A hand-made wheel step was also wrong on phones: Chromium divides it by the device-pixel ratio, so a 120 px step reached a phone page as 40.

## What led to it

We are bringing Astryx's touch components to the behavior of native controls, and their proofs drive real browser input through the interaction harness. With gestures now accepting every pointer, the harness had to drive a pen and a wheel the same way it drives a finger.

## Options and tradeoffs

- Synthetic DOM events (`new WheelEvent`, `new PointerEvent`): untrusted, and a component can tell (`isTrusted`), so they prove nothing about real input.
- Playwright's own wheel as is: a third of the delta in a phone context, and no pen at all.
- The browser's own input commands (this pull request): in Chromium, its DevTools input, with the wheel delta scaled back and pen strokes carrying pressure, tilt and their scripted times; in WebKit, its own wheel in a desktop context. WebKit's phone emulation has no wheel and Playwright has no WebKit pen, so the driver says so with flags and proofs skip with a stated reason.

## Why this choice

It is the only option whose events are trusted and go through the browser's own input pipeline, and it states each engine's limits instead of hiding them.

A run of wheel steps, as a trackpad page swipe sends, goes through `wheelBurst({x, y, steps, everyMs, maxGapMs})`: it sends every step on its schedule without waiting for the one before, resolves once the page has the run's whole delta, and, past `maxGapMs`, throws `WheelPageStallError` when the page's own wheel listeners held the main thread on the step before (WebKit dispatches the next step only once the page is free), and `WheelPacingError`, naming the gaps, when the dispatch stalled before the page. `retakeOnWheelPacing` re-takes a proof once, only on `WheelPacingError`, and lists the re-take; a stall the page caused fails the proof.

## How to check it

1. `pnpm exec playwright test --config playwright.interaction.config.ts internal/interaction-harness/src/harness.interaction.browser.spec.ts --project chromium -g "wheel and pen input"`.
2. Expected: a wheel step is on the page by the time `wheel()` resolves, as exactly its deltas, trusted, with Control when held, whether the page's wheel listeners are passive or not; a pen stroke arrives as trusted pen pointer events with its pressure and its scripted 100 ms between the first and last points.
3. With `--project webkit`, the desktop wheel cases pass and the phone wheel and pen cases skip, each naming why.
4. `pnpm exec vitest run internal/interaction-harness/src/webInput.pacing.test.ts`: the re-take stays red when both attempts are off pace, never re-takes a product failure, and passes and is listed when an off-pace attempt is followed by a good one.
5. `-g "burst"`: a burst paced at 180 ms against a 100 ms bound throws `WheelPacingError` in both engines, as does one paced at 125 ms over a page whose listener takes 30 ms (the page is free before each step arrives); a page that blocks 150 ms on each step is never re-taken (`WheelPageStallError` in WebKit, where a gap is the page's only when the step reached it within a frame of its listeners finishing the one before; in Chromium every gap is the dispatch's).
6. Two earlier mistakes now have their own cases: reading the page right after `wheel()` missed the step when every listener was passive, and a stroke sent right after a navigation pressed at 41 px for 100.

## Evidence

- Gestures for every pointer: meta#8646
- WebKit's one red in the harness self-test, "a run going backward is dated from when it began", is main's own check, which meta#8535 fixes: at a CI runner's size (four CPUs), main fails it in 4 of 6 full harness runs.

Applied from main for a local build of this branch. Where its header
comment in harness.interaction.browser.spec.ts overlaps this base's, the
comment is main's; the code applied cleanly.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
meta#8696's pen case (spec:AST-094 FR43), on its own because it needs the pen
driver (`webInputDriver`, `PEN_SKIP`) from meta#8666, which lands first.

Absorbs meta#8696 (d96069b).
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026

This branch was successfully deployed

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

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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.

2 participants