Skip to content

test(interaction-harness): the frame-evidence trace judges one layout per frame the page drew - #9456

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/harness-frame-evidence-drawn-frames
Nov 4, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/harness-frame-evidence-drawn-frames

Conversation

@vjeux

@vjeux vjeux commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

The interaction harness's own spec fails now and then on a loaded runner in "frame evidence › the trace counts no Layout for a transform animation and one per frame for top".

  • It required more than 18 layouts in a 400 ms window of a top animation: the 24 frames 400 ms holds at 60 Hz.
  • A loaded runner draws fewer frames. The check read 18 and 11 layouts with nothing wrong in the harness: one per frame the page drew.

Intended invariant

A layout-property animation lays out on every frame the page draws, and a transform animation lays out and paints on none. Both claims are judged against the frames actually drawn, whatever their rate.

Change

  • While the top animation runs, the page records when it drew each frame (its rAF times).
  • The check counts those frames in the same 400 ms window as the trace:
    • at least 4 to judge;
    • a layout for each, less one for a frame the window's end splits between its start and its layout.
  • The transform half is unchanged.

Evidence

  • Failure before the change: a seam keeps the main thread busy in 30 ms tasks while the top animation runs, so fewer frames are drawn. Main fails 3 of 3 with "Expected: > 18, Received: 13", the shape seen on loaded runners.
  • Success after the change: with the same seam, the check passes 3 of 3.
  • The per-frame claim still bites: a mutant moves top in four steps (steps(4)), so it lays out on 4 of the frames drawn. It fails 3 of 3: Layout 3 against at least 23 frames.
  • The whole harness spec: Chromium with 1 worker ×2, 170 of 170.
  • Same-time comparison, whole harness spec pinned to two cores with 4 workers ×10, box load 65 to 78:
    • 849 of 850 on each side;
    • this test passed every run on both;
    • the one failure on each side was "a compositor animation advances every frame through a blocked main thread", which this change does not touch.

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

internal/interaction-harness/src/harness.interaction.browser.spec.ts in Chromium (playwright.interaction.config.ts).

Local gates at 3e66124:

  • the harness spec;
  • the harness's unit tests (104);
  • Prettier;
  • the harness typecheck;
  • pnpm lint (0 errors);
  • changeset coverage (nothing ships).

… per frame the page drew

"the trace counts no Layout for a transform animation and one per frame for
`top`" required more than 18 layouts in a 400 ms window of a `top`
animation: 24 frames at 60 Hz. A loaded runner draws fewer frames, and the
check failed with 18 and 11 layouts, one per frame it drew, with nothing
wrong in the harness.

The page now records when it drew each frame of the animation (its rAF
times), and the check counts those frames in the same window: at least 4
to judge, and a layout for each of them, less one for a frame the window's
end splits. The transform half is unchanged.
@vercel

vercel Bot commented Nov 2, 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 2, 2026 4:46am UTC

Request Review

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

astracat-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

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

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 3e66124

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: core 4 rows; 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
Contributor

Choose a reason for hiding this comment

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

This looks good to merge: counting the frames the page actually drew keeps the top check passing on a slow runner, and an animation that skips per-frame layout (steps(4)) still fails it. One optional tidy-up: the frame recorder also runs during the transform half, where it adds a style recalculation per frame (Layout and Paint stay 0). Either start it only for top, or drop "The transform half is unchanged" from the description and commit message.

[Automated review]

Comment on lines +1225 to +1234
const animation = el.animate(keyframes, {duration: 600});
const drawn: number[] = [];
(window as unknown as {drawn: number[]}).drawn = drawn;
const frame = (time: number) => {
drawn.push(performance.timeOrigin + time);
if (animation.playState === 'running') {
requestAnimationFrame(frame);
}
};
requestAnimationFrame(frame);

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: this recorder also runs for the transform call, so that half now has a main-thread frame and a style recalculation every frame (Layout and Paint stay 0). If it should match main, start it only when prop === 'top'; otherwise the description's "The transform half is unchanged" could mention it.

@vjeux
vjeux marked this pull request as ready for review November 3, 2026 20:44
@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 3, 2026
@cixzhang
cixzhang marked this pull request as draft November 3, 2026 22:37
@cixzhang
cixzhang marked this pull request as ready for review November 3, 2026 22:37
@cixzhang
cixzhang merged commit d0171bf into meta:main Nov 4, 2026
147 of 152 checks passed
@vjeux
vjeux deleted the test/harness-frame-evidence-drawn-frames branch November 4, 2026 02:55

This branch was successfully deployed

1 active deployment
Preview — 3e661249 Deployed Nov 2, 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