Skip to content

test(CircularProgress): the tracing test judges a window it marks inside the change - #9450

Merged
cixzhang merged 2 commits into
meta:mainfrom
vjeux:test/cp-tracing-window
Nov 3, 2026
Merged

cixzhang merged 2 commits into
meta:mainfrom
vjeux:test/cp-tracing-window

Conversation

@vjeux

@vjeux vjeux commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

CircularProgress's "a value change lays out and paints nothing per frame" fails now and then on a loaded runner with nothing wrong in the product: expect(moving).toBe(true) reads false. It failed in 1 of 5 runs with one worker, and 1 of 40 pinned to two cores.

The test stretches the change to 3 s, waits 200 ms, starts tracing, waits a second, and then requires the change to still be running. Starting tracing takes no fixed time. When it ran long on a loaded runner, the second ended after the change did.

Intended invariant

The test judges a full second inside the change, however long tracing takes to start. Over that second, nothing on the main thread lays out or paints.

Change

  • The change runs inside the interaction harness's traceRendering, which starts tracing before it. The time tracing takes to start is not taken from the change.
  • The test reads the page's time at the start of the second it judges, and again at its end.
    • It starts two frames after the change's animations are ready, 200 ms in, and ends a second later.
    • At the end the test also reads whether the change is still running.
  • Layout and Paint on the page's main thread are counted between those two times with the harness's countBetween; the spec's own trace parsing is gone. The waits are the same as before.

Evidence

  • Failure before the change: a seam makes tracing start 2.5 s later. Main fails 3 of 3 at expect(moving).toBe(true).
  • Success after the change: the change starting 2.5 s after tracing does passes 3 of 3: tracing's start no longer takes the change's time.
  • The judged second still catches per-frame work: a mutant repaints the fill every frame from its start on. It fails 3 of 3 (Paint 120, expected 0).
  • Same-time comparison at this pull request's first commit (the same window, parsed by the spec), whole spec, pinned to two cores with 4 workers ×40, box load 99 to 40:
  • The test alone: 10 of 10. The whole spec with one worker ×3: 30 of 30.

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

packages/lab/src/CircularProgress/__tests__/CircularProgressMotion.a11y.chromium.spec.ts in Chromium, against the built Storybook.

Local gates at aa8b44d:

  • Prettier and ESLint on the spec;
  • the lab typecheck;
  • pnpm lint (0 errors);
  • changeset coverage (nothing ships).

@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 6:00am 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, 6:05 AM UTC

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · aa8b44d

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC
lab/CircularProgress · Storybook 8.5 kB (0) · 1.1 kB CSS (0) 597 (0)

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

API changes: none in this pull request

Committed API report behind this build: core 5 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.

Requesting changes. The fix works: tracing now starts before the change, and only a marked second inside the change is judged. But the new window logic re-implements traceRendering and countBetween from @astryxdesign/interaction-harness, which exist for this exact no-Layout/Paint proof. Please run the change inside traceRendering, count the judged second with countBetween, and drop the spec's own trace parsing; the inline comment sketches the shape.

[Automated review]

Comment on lines +432 to +438
const mark = (name: string) =>
trace.traceEvents.find(
e => e.cat === 'blink.user_timing' && e.name === name,
)?.ts ?? NaN;
const from = mark('window-start');
const to = mark('window-end');
expect(to - from).toBeGreaterThanOrEqual(1_000_000);

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 marked window re-implements traceRendering + countBetween from @astryxdesign/interaction-harness (already imported here), which trace blink.user_timing marks and count Layout/Paint on the page's main thread between them. Wrapping setArgs and the waits in traceRendering(page, async () => …), returning performance.timeOrigin + performance.now() for the window's bounds, and counting with countBetween(trace, from, to) keeps one path for this proof and lets the local trace parsing go.

@vjeux

vjeux commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Done in 1d62d9d. The change runs inside traceRendering, and the judged second is counted with countBetween between the page times read at its start and end. The spec's own trace parsing is gone.

The seams still hold: the change starting 2.5 s after tracing passes, and a per-frame repaint inside the second fails (Paint 120).

@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. The value change now runs inside traceRendering and the judged second is counted with countBetween, so the duplicated trace parsing from the first revision is gone, and the test still fails a fill that repaints every frame. One optional cleanup: the description's Change and Testing sections still describe the first commit's in-page performance.mark window and the gates run at that commit.

[Automated review]

vjeux added 2 commits November 1, 2026 21:41
…ide the change

"a value change lays out and paints nothing per frame" stretched the
change to 3 s, waited 200 ms, started tracing, waited a second, and then
required the change to still be running. Starting tracing takes no fixed
time: on a loaded machine it took long enough that the second ended after
the change did, and the test failed on `moving` with nothing wrong in the
product (1 run in 5 with one worker).

Tracing now starts before the change, so the time it takes to start is not
taken from the change. The page marks the window the test judges in the
trace itself (performance.mark, recorded under blink.user_timing): from two
frames after the change's animations are ready, 200 ms in, to a second
later, where it also checks that the change is still running. Layout and
Paint are counted on the renderer's main thread inside that window only.
The waits are the same as before.
…aceRendering

Review: the marked window re-implemented the interaction harness's
traceRendering and countBetween, which trace the page's main thread
between marks and count its Layout and Paint events by time. The change now
runs inside traceRendering, which starts tracing before it as before, and
the judged second is counted with countBetween between the page times the
test reads at its start and end; the spec's own trace parsing is gone.

@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. The value change runs inside traceRendering and the judged second is counted with countBetween, so tracing's start-up no longer eats into the change, and the test still fails a fill that repaints every frame. The rebase onto main leaves the test's own change as it was approved.

[Automated review]

@vjeux
vjeux marked this pull request as ready for review November 3, 2026 21:04
@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 23:00
@cixzhang
cixzhang marked this pull request as ready for review November 3, 2026 23:00
@cixzhang
cixzhang merged commit 3372c22 into meta:main Nov 3, 2026
139 of 144 checks passed
@vjeux
vjeux deleted the test/cp-tracing-window branch November 4, 2026 00:02

This branch was successfully deployed

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