Skip to content

fix(interaction-harness): a finished run is dated by its start at its finish, and the backward self-test checks dates to a millisecond - #8535

Merged
cixzhang merged 3 commits into
meta:mainfrom
vjeux:uikit/backward-oracle
Oct 31, 2026
Merged

cixzhang merged 3 commits into
meta:mainfrom
vjeux:uikit/backward-oracle

Conversation

@vjeux

@vjeux vjeux commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

waitForAnimation and watch.started() report when a finished run started and ended (from, to, finishedAt). The recorder dated a finish by performance.now() when the finish event arrived and a finished run by a start time read later, so a proof that compares those dates could be off by a frame or more, and the backward self-test, which checks them, needed 50 ms of slack and still failed on a loaded runner.

Intended invariant

A finished run is dated by the engine's own clock at its finish: its start as the engine had it then, and its end where that start puts it, through the playback rate. Running animations are dated as before.

Change

  • The recorder's finish listener, added as the animation is made and so before the page's own, records the run's start from its start time at that moment, or, for a run that ended before its start time resolved (one reversed from rest), from the event's timeline time; finishedAt is where that start puts the end. waitForAnimation dates a finished run from that recorded start instead of a start time read later.
  • A run whose start time the page has cleared by its finish (in Chromium, a CSS animation or transition whose element the page removes on its end event is cancelled before the recorder's listener runs) is dated from the start the recorder holds, before the event's timeline time. The recorder keeps that start current, read on every frame that sees the run running, so a run paused and resumed, held and released, seeked, sped up or reversed falls back to the start it ended on.
  • The backward self-test's expected start comes from the engine's clock: while the run runs, its current time read at one instant; once it has ended, its start time, read at the first of ready and its finish and before the page can cancel it.
  • Every bound in that test is now the timeline's rounding, a millisecond, instead of 50 ms, and the run that ended before the look must have finished where its curve ends.
  • A new case removes a CSS animation's element and a transition's element at their end and checks each start to a millisecond. Its expected start is the animation's own start time, held from its creation and read at its finish or end event, whichever first has it: WebKit resolves it after the start event.
  • Six cases run a CSS animation exit and a CSS transition exit that is held and then seeked and released, or finished; paused and then resumed, or finished; sped up; or reversed partway, remove each element at its end, and check its start and its finish against the engine's own to a millisecond. The harness holds a 10 s exit, so its hold lands partway however slowly the page answers, and seeks it near its end before releasing it; the page changes a 3 s exit, which a starved page still renders partway.
  • The reversed case of the cubic-bézier test reads its start by the engine's clock too, to a millisecond.

Evidence

  • Failure before the change:
    • The test's old clock (performance.now() after ready) read about 35 ms late in WebKit on an idle page, and 68 ms (WebKit) and 121 ms (Chromium) late with a held 120 ms frame.
    • The ready-time clock read alone: under a 3-CPU cap, a starved page reached ready after a 60 ms run had ended in 22 of 40 runs, dating its start up to 41 ms late.
    • The harness's finish date at a millisecond: the finish() check failed 32 of 40 runs in Chromium (the event arrives about 17 ms after the call) and 4 of 40 in WebKit under a 3-CPU cap. A WebKit probe of a run reversed from rest: finish event at timeline time 705, start time 721 when read afterwards.
  • The recorder-start fallback: without it, a CSS animation or transition removed at its end was dated a frame late in Chromium (6.6 ms on a 60 ms exit, 16.7 ms on a 200 ms one), and the new case fails there.
  • The start kept current: with the start read only when the run was first seen, Chromium dated such an exit from where it began: 167 ms early after a 150 ms pause, about 9.5 s after a hold and a seek near its end, 50 to 58 ms after doubling its rate partway, 2.8 s after a reverse. 4 of the 6 new cases fail there, both runs of each; the finished ones were already exact. WebKit passes either way.
  • The finished-at check: |finishedAt − to| ≤ 1 in the "ended before the look" case fails against the earlier harness every time (7 ms in Chromium, 5 ms in WebKit).
  • Success after the change: the self-test passes 40 of 40 in Chromium, in WebKit, and in WebKit under a 3-CPU cap, with every date within a millisecond.
  • Product/runtime behavior verified unchanged: no product code is touched; the harness browser spec passes in Chromium and WebKit, and the harness unit tests pass.

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

  • pnpm exec playwright test --config playwright.interaction.config.ts --project chromium internal/interaction-harness/src/harness.interaction.browser.spec.ts
  • node internal/interaction-harness/scripts/webkit-container.mjs internal/interaction-harness/src/harness.interaction.browser.spec.ts
  • the backward self-test repeated 40 times at 16 workers in each engine, and in WebKit with the container capped at 3 CPUs
  • pnpm exec vitest run internal/interaction-harness

Local gates at 2cdb211: Prettier, ESLint and the harness typecheck pass on the changed files; the root build passes; the core UI suite passes; the node project passes except two process-timing cases in packages/cli/foundation/release/cache.test.mjs, which pass when that file runs alone (34 of 34), on this head and on main; the harness browser spec passes in Chromium (58 of 58) and in WebKit (50 passed, 8 skipped); the backward self-test, the two removed-exit cases and the six changed-exit cases pass 40 of 40 each in Chromium, in WebKit, and in WebKit with the container capped at 3 CPUs.

@vercel

vercel Bot commented Oct 26, 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 31, 2026 2:20am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 31, 2026, 2:25 AM 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.

Recommended for approval: the backward self-test now takes its expected start from the animation's own clock, read in the same task as ready, so a slow start frame no longer fails it, and the harness itself is untouched. In Chromium the new expectation matches the harness exactly even with a 120 ms held start frame (the old one was up to 129 ms late against the 50 ms bound), and it still fails a harness that drops the backward shift or plays the start delay first. No changes are needed; as an optional follow-up, the reversed case in "a held end is solved through a cubic-bézier effect easing…" (harness.interaction.browser.spec.ts:627) still uses the performance.now()-after-ready expectation under a 100 ms bound.

[Automated review]

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 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

This was referenced Oct 26, 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 27, 2026
…b input drivers, meta#8535) into uikit/c09-search-fr43
@vjeux vjeux changed the title test(interaction): the backward self-test dates the run by its own clock, read at one instant fix(interaction-harness): a finished run is dated by its start at its finish, and the backward self-test checks dates to a millisecond Oct 30, 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: dating finished runs by the engine's clock works for script animations and for CSS animations the page leaves in place, but in Chromium it re-dates a CSS animation or transition whose element the page removes on animationend or transitionend from the finish frame, so from, to and finishedAt land about 6.7 ms late on a 60 ms exit where from and to used to be exact. Please fall back to the start the recorder already holds before the event's timeline time, and add checks that fail without each fix:

  • curves.ts:125: playStart(animation) ?? entry.startedAt ?? (at == null ? null : Number(at) - end / speed) makes all four endings probed exact in Chromium and WebKit, and the harness spec still passes in both.
  • The new 1 ms bounds still pass against the old curves.ts at the default single worker in both engines; asserting |finishedAt - to| <= 1 in the "ended before the look" case fails against the old harness every time and passes on this head.
  • No case covers a CSS exit whose element is removed at its end; one asserting from within 1 ms of the animation's start time would catch this regression.

[Automated review]

Comment on lines +124 to +125
entry.finishStart =
playStart(animation) ?? (at == null ? null : Number(at) - end / speed);

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.

When the page's animationend or transitionend handler removes the element, Chromium cancels the CSS animation before this listener runs, so playStart is null here and the run is re-dated from the event's timeline time, the frame that noticed its end. On a 60 ms exit that put from, to and finishedAt 6.6 to 6.7 ms late in every run, though entry.startedAt already held the exact start (the base reported from and to exactly). Falling back to the recorded start first fixes it in Chromium and keeps WebKit exact:

entry.finishStart =
  playStart(animation) ??
  entry.startedAt ??
  (at == null ? null : Number(at) - end / speed);

expect(ended.finishedAt).not.toBeNull();
expect(Math.abs(ended.from - readyAt)).toBeLessThan(50);
expect(Math.abs(ended.from - begunAt)).toBeLessThanOrEqual(1);
expect(ended.to).toBeLessThanOrEqual((ended.finishedAt ?? 0) + 1);

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.

At one worker the head's backward test passes against the old curves.ts in Chromium and WebKit (10 of 10 each), so nothing here fails if the finishedAt change is reverted. The finish event has been delivered by the 200 ms wait above, so this check pins it: it fails against the old harness every time (6.8 to 6.9 ms in Chromium, 4 to 5 ms in WebKit) and passes on this head.

expect(Math.abs((ended.finishedAt ?? 0) - ended.to)).toBeLessThanOrEqual(1);

…eared is dated from the start the recorder holds

In Chromium a CSS animation or transition whose element the page removes on
its end event is cancelled before the recorder's finish listener runs, so its
start time is gone there, and the run was dated from the event's timeline
time, the frame that noticed its end: `from`, `to` and `finishedAt` came 6.6 ms
late on a 60 ms exit and 16.7 ms late on a 200 ms one. The start the recorder
already holds now stands in before the event's time.

- The backward self-test checks that the run that ended before the look
  finished where its curve ends; against the earlier harness it fails by 7 ms
  in Chromium and 5 ms in WebKit.
- A new case removes a CSS animation's element and a transition's element at
  their end and checks each start to a millisecond. Its expected start is the
  animation's own start time, held from its creation and read at its finish
  or end event, whichever first has it: WebKit resolves it after the start
  event, and Chromium cancels the animation once the page removes the element.
  The page renders first and the exit spans several frames, since a CSS
  animation that starts and ends between two frames of a page that has not
  rendered yet is never seen.
- The reversed case of the cubic-bézier test reads its start by the engine's
  clock too, to a millisecond.
@vjeux

vjeux commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 42a1835:

  • The finish listener falls back to the start the recorder holds before the event's timeline time (playStart(animation) ?? entry.startedAt ?? …).
  • The "ended before the look" case checks |finishedAt - to| <= 1; it fails against the earlier harness (7 ms in Chromium, 5 ms in WebKit).
  • A new case removes a CSS animation's element and a transition's element at their end and checks each start to 1 ms; without the fallback it fails in Chromium (a frame late).
  • The reversed case of the cubic-bézier test now reads its start by the engine's clock too.

@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 two earlier points are fixed (CSS exits removed at their end are now dated exactly, and the new checks fail without each fix), but in Chromium a CSS exit that is paused or held mid-run and removed at its end now reports finishedAt 150 ms or more before it actually ended. The recorder's fallback start (curves.ts:129) is read once and never refreshed after a pause or a holdAnimations/releaseAnimations round trip; refreshing startedAt from playStart while the run is still running makes every such case exact and keeps the harness spec green. Please add a case that holds a CSS exit, releases it and removes its element at its end, checking from and finishedAt to 1 ms.

[Automated review]

const at = (event as AnimationPlaybackEvent).timelineTime;
entry.finishStart =
playStart(animation) ??
entry.startedAt ??

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 start is the one the recorder read on an early frame, and nothing refreshes it after the run is paused and resumed (by the page, or by holdAnimations then releaseAnimations). A 200 ms CSS exit paused for 150 ms and removed on animationend then reports from, to and finishedAt 150 ms early, where the base had finishedAt within 5 ms of the end. Keeping it current fixes that: in remember, for an entry already held whose animation is still running with a start time, set startedAt = playStart(animation). With that, every probed case is exact and the harness spec still passes.

cixzhang pushed a commit that referenced this pull request Oct 31, 2026
…against a compositor-only control (#8906)

## Why

A busy-window proof judges a compositor animation against a display-rate bound. On a two-core or loaded runner the compositor presents fewer frames than that bound allows though the animation moves on every one: Lightbox's double-tap zoom missed it in 7 of 10 two-core runs. A short fade gives one window too few frames.

## What led to it

Both were written for Lightbox's proofs; only its pull requests carried them.

## Options and tradeoffs

- Loosen the bound: it can't then tell a starved compositor from a frozen element.
- Keep them in Lightbox's pull requests: other proofs would carry its base.
- Their own harness pull request, on main (this one).

## Why this choice

`startBusyControl(page)` mounts a small top-layer box that the compositor animates, tracked from the same screencast. `busyWindowProof(frames, window, {control})` passes when the component moves on every frame the control moves and never stalls longer. Same frames, so no tolerance. One exception: on an easing tail, a run of unchanged frames counts as moved when a single cast step ends it and it is at most a frame longer than the run before; a freeze ends in a larger catch-up. At least four control frames need a visible move.

- `pooledBusyProof(runs)` judges short runs together.
- `{within: dialog}` mounts the control inside an open dialog, for a backdrop proof. `waitForAnimation` and `blockMainThread`'s `during` never count the control's own animation, so on a dialog they still wait for the backdrop's.
- A hold that starts before the block is judged from its first presented change inside it: WebKit presents a just-started compositor animation 130 to 300 ms late. Every frame after that change is judged, so a freeze later in the block still fails.
- Main's three busy self-tests judge against the control.

## How to check it

1. `pnpm exec vitest run --project node internal/interaction-harness/src/busy.control.test.ts`
2. `pnpm test:interaction internal/interaction-harness/src/harness.interaction.browser.spec.ts --grep "busy|control|pooled"`: a compositor animation passes; a rAF one, timed or frame-counted, fails.

## Evidence

- Noise floor: a compositor animation missed no control frame in 180 single and 90 pooled proofs.
- Margin: the rAF mutant moved on at most 1 of 40 to 47 control frames (the one presented as the block starts) and always stalled longer; a frame-counted loop failed all 20 pools.
- Lightbox's five busy proofs: Chromium 30 of 30; WebKit 33 of 40, the rest too few frames.
- Load: main's first busy self-test failed 6 of 32 at 16 workers (every frame moved, stalls 63 to 109 ms); against the control, 48 of 48. Main's other two failed the same way (3 of 16 Chromium runs at 16 workers: "31/31 moved, longest stall 169 ms"); against the control, 32 of 32 per engine.
- The first self-test's rAF run blocked right after cancelling the compositor run, so the compositor kept playing the cancelled animation into the block (the rAF mutant read 6 to 8 changed frames). With two animation frames before the block, a cancel-then-block probe kept moving in 0 of 8 Chromium runs, against 1 of 8 without them.
- BottomSheet's dim in WebKit: under the top-layer control it held 155 to 225 ms into the block while the control moved; with `within` it moves in step with the sheet. On a dialog that animates nothing else, the two waits resolved at once on the control's animation; now they wait for the dialog's own, 6 of 6 per engine.
- Wrapped self-test animations: a turnaround in the block failed 7 of 12; now 12 of 12.
- Red first: every new case fails on main's `busy.ts`.

Local gates at 187ee49: Prettier, ESLint and the harness typecheck pass on the changed files; the root build passes; the core UI suite passes; the node project passes except two process-timing cases in `packages/cli/foundation/release/cache.test.mjs`, which pass when that file runs alone (34 of 34), on this head and on main; the harness browser spec passes in Chromium (56 of 56, in two runs) and in WebKit apart from the backward self-test, a flake on main that #8535 fixes.
…st ran on

The start the recorder falls back to, for a run the page cancels before its
finish is read (in Chromium, a CSS exit whose element the page removes on its
end event), was read once, when the run was first seen. A run paused and
resumed, held and released, seeked, sped up or reversed runs on another start
time, so Chromium dated such an exit from where it began: 167 ms early after a
150 ms pause, about 9.5 s after a hold and a seek to near its end, 50 to 58 ms
after doubling its rate partway, 400 ms after a reverse. The recorder now keeps
the start a run is running on, read on every frame that sees it.

New cases run a CSS animation exit and a CSS transition exit that is held and
then seeked and released, or finished; paused and then resumed, or finished;
sped up; or reversed partway, remove each element at its end, and check its
start and its finish against the engine's own to a millisecond. Before this
change Chromium fails 4 of the 6 cases, both runs of each; the finished ones
were already exact. The harness holds a 10 s exit, so its hold lands partway
however slowly the page answers, and seeks it near its end before releasing
it; the page changes a 3 s exit, which a starved page still renders partway.
@vjeux

vjeux commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 2cdb211: the recorder keeps the start a run is running on, refreshed from playStart on every frame that sees it running, so a removed run falls back to the start it ended on. Six new cases hold, seek and release or finish, pause and resume or finish, speed up, or reverse a CSS animation exit and a CSS transition exit partway, remove the element at its end, and check from and finishedAt against the engine's own to 1 ms; before the fix Chromium fails 4 of them (the finished ones were already exact).

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

Recommended for approval: dating a finished run from the start the engine had at its finish now also holds after the run is held and seeked, paused and resumed, sped up or reversed partway, so the earlier gap is closed. Rechecked in Chromium by swapping only curves.ts in the reviewed tree: the whole harness browser spec passes 58 of 58 at this head, all eight date cases fail against the merge base, and four of the six changed-exit cases fail without the refreshed start, in both their CSS-animation and CSS-transition form. Nothing further is needed from you; the pull request is still a draft, so its required checks stay skipped until it is marked ready for review. One note for the record: WebKit would not launch in this review's environment, so the WebKit measurements in the description rest on your own runs.

[Automated review]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Oct 31, 2026
@cixzhang
cixzhang marked this pull request as ready for review October 31, 2026 03:47
cixzhang pushed a commit that referenced this pull request Oct 31, 2026
…copy inside the test (#9066)

## Maintainer impact

A proof that writes evidence can fail on a loaded runner after every check it makes has already run. `writeEvidence` attached each file by path, so Playwright copied it into the test's output folder (a `mkdir` and a `copyFile`) inside the test, on the test's own timeout. Under a 3-CPU cap with 16 workers, one interaction proof timed out 4 times in 720 runs, each in its evidence step; the 3 runs with per-call timings all hung inside `testInfo.attach` for more than 45 s, after `writeEvidence` had made the folder and written the file in at most 54 ms.

## Intended invariant

Evidence is still written under `test-results/interaction-evidence/` for local paths and still reaches the test report; the time a test takes no longer includes copying it.

## Change

`writeEvidence` attaches each file by `body` instead of `path`. Playwright hands a body to the reporter, which stores it outside the test's time, so no file call of the attachment runs inside the test. The file itself is written as before.

## Prior art

Open pull requests searched for `writeEvidence` and for `testInfo.attach`: none touch how evidence is attached.

## Why not just a disk stall

- Host I/O pressure (`/proc/pressure/io`, sampled every second) stayed at 3, 6 and 8 ms/s at most during the three hung attaches.
- The same pair of calls, a fresh 30 KB `writeFileSync` and a `fs.promises.copyFile` of it, repeated every 200 ms in a separate process on the same disk for 25 minutes (7,426 pairs, beside the proof's runs): write p50 0.3 ms, p99 0.8 ms, max 190 ms; copy p50 0.8 ms, p99 2.3 ms, max 354 ms.

So the copy is not slow as such; what holds it inside a busy test worker is not established, and the fix does not depend on it: by body, the attachment does no file work in the test at all.

## Evidence

- Failure before the change: the new self-test, which makes `fs.promises.copyFile` never return, times out at its 15 s budget in Chromium and WebKit.
- Success after the change: the self-test passes in both engines (5 of 5 each), and the storyboard self-tests, which attach PNG buffers, pass.
- Product/runtime behavior verified unchanged: no product code is touched; the harness browser spec passes in Chromium and WebKit, and the harness unit tests pass.

## Scope

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

## Testing

- `pnpm exec playwright test --config playwright.interaction.config.ts --project chromium internal/interaction-harness/src/harness.interaction.browser.spec.ts`
- `node internal/interaction-harness/scripts/webkit-container.mjs internal/interaction-harness/src/harness.interaction.browser.spec.ts`
- `pnpm exec vitest run internal/interaction-harness`

Local gates at 5192b89: Prettier, ESLint and the harness typecheck pass on the changed files; the root build passes; the core UI suite passes; the node project passes except two process-timing cases in `packages/cli/foundation/release/cache.test.mjs`, which pass when that file runs alone (34 of 34), on this head and on main; the harness browser spec passes in Chromium (52 of 52) and in WebKit apart from the backward self-test, a flake on main that #8535 fixes.
@cixzhang
cixzhang merged commit aeb0e77 into meta:main Oct 31, 2026
139 of 141 checks passed
@vjeux
vjeux deleted the uikit/backward-oracle branch October 31, 2026 04:36
cixzhang pushed a commit that referenced this pull request Oct 31, 2026
… long enough for its holds to reach them (#9110)

## Maintainer impact

The harness self-test "a held end is solved through a cubic-bezier effect easing, a reversed one reads to the full end, and a rotate about x composes on its axis" fails on a loaded runner: in WebKit with the container capped at 3 CPUs at 16 workers it fails 34 of 40 runs, its holds finding nothing.

## Intended invariant

The self-test proves that a held run reports where its curve ends (`HeldAnimation.curveEndMs`), through an effect easing, a reversed direction, a negative playback rate and implicit end frames, and that a rotate about x composes on its axis. It needs each run still running when the hold reads the page.

## Change

Only the self-test changes. On such a runner the hold read the page as late as 2.4 s after the run was made, past the end of the test's 1 s runs (and its 300 ms rotate run), which had finished. Measured: in 25 of 40 runs of the first case the run was `finished` when the hold read the page, 1.2 to 2.4 s after it was made. Each run now lasts 10 s, and the curve ends the test expects scale with it.

Prior art: open pull requests searched for this test's title, `holdAnimations` and `curveEndMs`: none touches this test. #8535, merged, changed its `reverse()` case's start, which this change keeps.

## Evidence

- Failure before the change: under the 3-CPU cap at 16 workers, 34 of 40 runs fail with this test as on main (the first hold finds nothing, or the rotate sample has no held run).
- Success after the change: 40 of 40 under the same cap, 40 of 40 uncapped in WebKit, 40 of 40 in Chromium, and 24 of 24 in Chromium pinned to two cores.
- Product/runtime behavior verified unchanged: no product or harness code changes.

## Scope

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

## Testing

- `node internal/interaction-harness/scripts/webkit-container.mjs --repeat-each=40 --workers=16 internal/interaction-harness/src/harness.interaction.browser.spec.ts --grep "a held end is solved"` with the container capped at 3 CPUs
- the same uncapped, and `pnpm exec playwright test --config playwright.interaction.config.ts --project chromium --repeat-each=40 --workers=16 …` in Chromium

Local gates at a0feb08: Prettier, ESLint and the harness typecheck pass on the changed file; the root build passes; the core UI suite passes; the node project passes except two process-timing cases in `packages/cli/foundation/release/cache.test.mjs`, which pass when that file runs alone (34 of 34); the harness browser spec passes in Chromium and WebKit; the test passes 20 of 20 under the WebKit cap and 24 of 24 in Chromium pinned to two cores.
cixzhang pushed a commit that referenced this pull request Oct 31, 2026
…s its place at any playback rate (#9109)

## Maintainer impact

`holdAnimations` placed a run whose play was still pending (resumed, or just made, with no start time yet) as if it ran at rate 1. A run at another playback rate, held before its start time resolved, was then seeked and sampled at the wrong place: at rate 2, a run resumed 400 ms into its curve landed 400 ms further along it than the hold found it, in Chromium and WebKit.

## Intended invariant

Held runs keep their timing relative to one another: a seek to t moves each held run to its own t − `offsetMs` through its playback rate (`HeldAnimation.offsetMs`, `seekAnimations` in `internal/interaction-harness/src/curves.ts`), so a seek to the moment of the hold leaves every held run where the hold read it.

## Change

- A pending run's start on the document timeline is now `now − currentTime / playbackRate` (a rate of 0 counts as 1, as seeking reads it), not `now − currentTime`. A run at rate 2 covers its curve in half the timeline, so it started half as long ago.
- The other timing paths already read the rate: the recorder's start and finish dating, `waitForAnimation`'s dates and progress, `seekAnimations` and `sampleCurve`.
- A new self-test resumes a rate-2 run from the hold's own first read of the timeline's time, caught once on the prototype that defines it, so its resume is still pending when the hold takes it, and seeks to the moment of the hold: both held runs must stay where the hold read them, to a millisecond. The animation recorder never reads the timeline's time; it lists the page's animations itself, at install and on every frame, so a trigger there resumed the run too early. Both runs last 60 s, as a hold on a loaded runner can come seconds after the runs were made.

Prior art: open pull requests searched for `holdAnimations`, `seekAnimations` and `curveEndMs`. #8535, merged, dated finished runs; #8446 changes the recorder while a trace runs. Neither changes how a hold reads a run's start.

## Evidence

- Failure before the change: the new case fails every run in Chromium pinned to two cores (12 of 12) and in a WebKit container capped at 3 CPUs at 16 workers (12 of 12), the faster run 400 ms off.
- Success after the change: 24 of 24 pinned to two cores, 40 of 40 under the WebKit cap, and 10 of 10 uncapped in each engine; the existing hold cases pass 5 of 5 runs each in both engines.
- Product/runtime behavior verified unchanged: no product code changes.

## Scope

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

## Testing

- `pnpm exec playwright test --config playwright.interaction.config.ts --project chromium internal/interaction-harness/src/harness.interaction.browser.spec.ts --grep "resume is still pending"`
- `node internal/interaction-harness/scripts/webkit-container.mjs internal/interaction-harness/src/harness.interaction.browser.spec.ts --grep "resume is still pending"`
- the harness browser spec in both engines

Local gates at da89ae6: Prettier, ESLint and the harness typecheck pass on the changed files; the root build passes; the core UI suite passes; the node project passes except two process-timing cases in `packages/cli/foundation/release/cache.test.mjs`, which pass when that file runs alone (34 of 34); the harness browser spec passes in Chromium and WebKit; the new case passes 24 of 24 in Chromium pinned to two cores, 40 of 40 in WebKit capped at 3 CPUs at 16 workers, and 10 of 10 uncapped in each engine.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…k) into the FR43 harness helper

Keeps the helper's harness self-test green in WebKit too: meta#8535 fixes the backward case's flake under load.
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
…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
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
…a#8666's wheel and pen drivers, meta#8535) into meta#8218 cc5353d

The base of this pull request: its parents only.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026

This branch was successfully deployed

1 active deployment
Preview — 2cdb211d Deployed Oct 31, 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