Skip to content

test(interaction-harness): two page-freeze cases wait for the frame - #9873

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/harness-page-freeze-waits-for-frames
Nov 4, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/harness-page-freeze-waits-for-frames

Conversation

@vjeux

@vjeux vjeux commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

Two page-freeze self-test cases failed once in a full Chromium interaction run on a loaded machine (1 worker, load average 69 to 86). "A run that finished before a freeze…" dated the run 487 ms after the freeze. "…ten freeze and thaw cycles" measured a drift of 1,224 ms. Side-by-side reruns passed, so the red read as a one-off, but it is a real dependency on the machine's load.

#9701 still carries an older copy of this section; its rebase takes main's.

Intended invariant

Each page-freeze case proves the same claim as before, whatever the delay before the page's next frame.

Change

  • A run starts only at a frame, and both cases assumed that a fixed wait covered that frame.
  • "A run that finished before a freeze…" waits for the run's own finished before it reads frozenAt and freezes, instead of waiting 400 ms.
  • "…ten freeze and thaw cycles" reads the run's startTime once run.ready resolves, instead of after 100 ms. Read before any frame, a pending run's start time is null, which Number() reads as 0. The drift then measured the run's whole start.

Evidence

  • Failure before the change: NOT-FOR-LANDING commit 68bdd35 on main stops the page drawing frames after each run starts. A busy loop on the harness's real clock holds the main thread for 500 ms in the first case and 300 ms in the second. Both cases fail 3 of 3, the same way as the loaded run: the run dated 350 ms or more after the freeze, and a drift of about 350 ms. With each case's fixed wait at 0 instead (3138a9a), the first case fails 3 of 3 and the second 1 of 3. A CPU quota alone (1 CPU beside 10 busy loops) did not delay frames enough to reproduce it: main passed 20 of 20.
  • Success after the change: the same frame stall on the fix (c428930) passes 6 of 6, and the fix alone passes 10 of 10.
  • Product/runtime behavior verified unchanged: test-only.
  • CI impact: none; no workflow changes.

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

Rebased onto main bd69bed. The file's import of test now comes from main's @astryxdesign/a11y-spec/playwright, and this change's own lines are the same.

At 8ed6edc:

  • the two cases ×3 in Chromium: 6 of 6;
  • ESLint (CI=true) over the whole repository: no errors;
  • pnpm review:pre: no findings.

At 5212d64, on main 1800b47:

  • the harness spec in Chromium, pinned to one core's two threads: 107 passed, 1 skipped;
  • the harness spec in WebKit, in the Playwright container with CI's WebKit settings (--cpus=4, CI=1, 1 worker): 95 passed, 13 Chromium-only skipped;
  • the two cases ×5: 10 of 10;
  • the harness typecheck, ESLint and Prettier on the changed file;
  • pnpm review:pre: no findings.

@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 7:47am 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

AI review status for this pull request.

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

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 8ed6edc

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 8 rows, theme-butter 1 row, theme-chocolate 1 row, theme-gothic 1 row, theme-matcha 1 row, theme-neutral 1 row, theme-stone 1 row, theme-y2k 1 row; run pnpm api:report.

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

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 from a fork, so CI starts once it is marked ready for review and a maintainer adds the ci:run label.

Both page-freeze cases now wait for the engine's own signal (finished, ready) instead of a fixed timeout, and they keep the claims they proved before. With the page's first frame held back, the old forms fail and the new ones pass.

  • Non-blocking: in Chromium the finish check at line 4814 now passes by about 1 ms whenever the finishing frame lands exactly on start + 200 ms, because frozenAt is read as soon as finished resolves. Awaiting one more frame inside the same evaluate (await new Promise(requestAnimationFrame);) would restore a frame of margin.

[Automated review]

[{transform: 'translateX(0px)'}, {transform: 'translateX(100px)'}],
{duration: 200},
);
).finished;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Non-blocking: frozenAt (line 4806) is now read as soon as finished resolves. The recorder dates the finish at start + 200 ms, and in Chromium that is often exactly the finishing frame's time. So the check at line 4814 (finishedAt < frozenAt, with frozenAt a whole millisecond) passes by about 1 to 2 ms there. One more frame before returning keeps the ordering this change wants and adds a frame of margin whatever the load:

await el.animate(/* … */).finished;
await new Promise(requestAnimationFrame);

@vjeux
vjeux marked this pull request as ready for review November 4, 2026 05:05
@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 4, 2026
@cixzhang
cixzhang marked this pull request as draft November 4, 2026 06:07
@cixzhang
cixzhang marked this pull request as ready for review November 4, 2026 06:07
Two page-freeze self-test cases assumed that a fixed wait covered the
frame that starts a run. A busy machine can draw no frame for longer
than the wait, and both cases failed once that way in a full Chromium
run. The run that finishes before the freeze had not started when the
freeze landed, so it was dated after the freeze (487 ms). The ten-cycle
case read the run's start time before any frame, got null, and so
measured a drift of the run's whole start (1224 ms).

The first case now waits for the run's own end before it freezes, and
the second reads the start time once the run is ready.

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown

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. Its admission step found no room under the CI ceiling, so the required checks report failure without having run; a maintainer re-runs all jobs, or a later push starts a new run.

Both page-freeze cases now wait for the engine's own signal (finished, ready) instead of a fixed timeout, and they keep the claims they proved before. With the page's first frame held back, the old forms fail and the new ones pass.

  • Non-blocking: the finish check at line 4821 passes by about 1 ms in roughly half of Chromium runs, because frozenAt is read as soon as finished resolves; awaiting one more frame inside the same evaluate (await new Promise(requestAnimationFrame);) would restore a frame of margin.

[Automated review]

@cixzhang
cixzhang marked this pull request as draft November 4, 2026 08:35
@cixzhang
cixzhang marked this pull request as ready for review November 4, 2026 08:36
@cixzhang
cixzhang merged commit b8f2a9f into meta:main Nov 4, 2026
103 of 110 checks passed
@vjeux
vjeux deleted the test/harness-page-freeze-waits-for-frames branch November 4, 2026 10:46

This branch was successfully deployed

1 active deployment
Preview — 8ed6edc4 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

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