Skip to content

test(Spinner): wait for announcements before tracing rotor paints - #10174

Closed
astracat-bot[bot] wants to merge 2 commits into
mainfrom
codebunny/fix/test-spinner-wait-for-announcements-before-tracing-rotor-paints-2ff82b
Closed

astracat-bot[bot] wants to merge 2 commits into
mainfrom
codebunny/fix/test-spinner-wait-for-announcements-before-tracing-rotor-paints-2ff82b

Conversation

@astracat-bot

@astracat-bot astracat-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

The Spinner motion contract fails on main with one Paint event where it expects zero. The failure reproduces on all three runs of the unchanged test at 1ef21f8.

Intended invariant

The motion test measures the ring's steady-state compositor animation, as described by the Spinner contract's motion verification map. The standalone Spinner also announces loading through the shared channel, and AST-086 FR9 requires that channel to clear its text shortly afterward. That one-time clear is not a rotor repaint.

Change

Wait for the shared live regions to become empty before starting the rendering trace. The new mount announcement's two-second clear previously fell inside the two-second tracing window and caused the unrelated Paint event. This change separates setup from the motion measurement without disabling announcements or removing any trace events. The measurement duration, zero-Paint and zero-Layout assertions, style-recalculation bound, and test timeout are unchanged.

No behavior change. Only seven lines of test setup are added; component code, stories, public APIs, visual direction, and policy are unchanged. No Changeset is needed.

Evidence

The original test fails 3/3 runs with Paint = 1. With the setup fix, it passes 5/5 repeated runs, and all six tests in SpinnerMotion.a11y.chromium.spec.ts pass, including the busy-main-thread, timing, reduced-motion, phase, and storyboard checks. A temporary SVG stroke animation still fails the corrected test with Paint = 240; that mutation is removed.

The 65 Spinner unit tests pass. The Storybook build, pnpm check:repo, strict ESLint for the changed file, Prettier, diff whitespace check, and pre-review report pass. The pre-review report has no findings.

Testing

Run pnpm exec playwright test packages/core/src/Spinner/__tests__/SpinnerMotion.a11y.chromium.spec.ts --config=playwright.config.ts --project=chromium against a built Storybook. The repeated regression check uses the same command with --grep='turning paints nothing on the main thread' --repeat-each=5. Unit coverage uses pnpm exec vitest run packages/core/src/Spinner/Spinner.test.tsx --project ui --maxWorkers=1.

Review note

The test now waits for the actual announcement lifecycle rather than guessing a longer delay. It also permits no shared regions when page-load announcements are suppressed. I considered silencing the story's Spinners, but kept their normal accessibility behavior intact and scoped the correction to tracing setup instead. Full repository unit tests and package builds were not run; validation is focused on the changed browser contract and unchanged Spinner behavior.

@vercel

vercel Bot commented Nov 5, 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 6, 2026 1:05am UTC

Request Review

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

astracat-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

AI review status for this pull request.

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

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 0a8fd7f

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Spinner · Storybook 20.3 kB (0) · 6.1 kB CSS (0) 351 (0) ✓ · ✓ · —

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

API changes: none in this pull request

Committed API report behind this build: cli 19 rows, core 23 rows; run pnpm api:report.

Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 6, 2026

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

Checked locally in Chromium (Storybook built at main ab7facf, one worker, no retries):

  • Main's test fails 3 of 3 with Paint 1. In a trace of the same window, the only Paint (on #document, after one style recalc and two layouts) lands 4 ms after the polite live region's text is cleared. A trace started after the clear has no paint, layout or style recalc in 2 s, so the turning itself paints nothing.
  • With this change the test passes 5 of 5. A mutant whose rotor animates box-shadow still fails it (Paint 600, style recalc 120). A background-color mutant, which Chromium composites, fails on the style-recalc bound (20).
  • Non-blocking: every() is also true before any region exists, and in the frame before the write. Waiting for the region to hold text, then to empty, would make the wait prove that the announcement ran and ended.

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

Approved by Cindy's agent with her authorization

@astracat-bot

astracat-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Closing: every test this PR fixes passes on main without it, fixed on main by e191eed (#10195).

@astracat-bot astracat-bot Bot closed this Nov 6, 2026
@github-actions
github-actions Bot deleted the codebunny/fix/test-spinner-wait-for-announcements-before-tracing-rotor-paints-2ff82b branch November 6, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 0a8fd7f3 Deployed Nov 6, 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-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) 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.

3 participants