Skip to content

test(AlertDialog): the busy-main-thread proof reads the alert's own fade, which has no stationary point - #12523

Merged
josephfarina merged 2 commits into
mainfrom
test/alertdialog-busy-alert-pixels
Nov 18, 2026
Merged

josephfarina merged 2 commits into
mainfrom
test/alertdialog-busy-alert-pixels

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

The AlertDialog motion test "present and dismiss keep moving through a 1 s main-thread block, against a compositor control" reads a region whose luma passes through a turning point partway through each motion. Before main lowered the busy judge's cut to 0.005, a frame landing near that point now and then read as missed on busy CI runners. The lower cut makes that rare. This change removes the turning point itself.

Intended invariant

The proof still asserts what it asserted: while the main thread is blocked for 1 s, the alert's pixels change on every frame the compositor control moves, and the alert never stalls longer than the control. The busy judge and its 0.005 cut are unchanged. The component, its motion and its timing do not change.

Change

The proof reads the luma of the middle of the alert on each lossless screencast frame and counts a frame as missed when that luma changes by the judge's cut (0.005) or less. It drew the alert's own light surface over an opaque black dim, and the dim fades on the same curve as the alert. The region's luma is then the alert's fade plus the dim's, a·W + (1−a)(1−d)·B with a = d. That expression has a turning point partway through each motion, where the two fades cancel. Near it the pixels change by only about a tenth of a level per frame, and at the turn itself by close to nothing, which is what the 0.005 cut has to tell apart from a frozen alert.

The test now draws the alert black over a white page with no dim: --color-overlay: transparent, --color-background-body: white, and a black --color-background-surface inside the dialog. The region then follows the alert's opacity alone. It is linear in the opacity and never turns, and it changes by about 1.4 levels or more on every frame, far above the cut. The judge's comment now says so.

Evidence

  • Before the change: each phase's luma flattens at the turning point. Over 40 runs the smallest per-frame change in the busy window was 0.093–0.113 levels, and the dismiss phase turns inside the window.
  • After the change: the smallest per-frame change is 1.40–1.50 levels (3.0 over two frames, 4.4 over three), and luma moves one way through each phase (present 244 → 150, dismiss 60 → 158). Rebased onto current main: 60 runs pinned to two cores, with six spinning loads beside the browser and the runner, all passed, and the judge's unit tests pass (4).
  • Product/runtime behavior verified unchanged: no source file changes. The whole motion spec passes in Chromium (19 passed).

Scope

Components: AlertDialog (test only: the motion spec's style tag and the busy-motion judge's comment)

  • 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

  • CI=1 playwright test --config playwright.interaction.config.ts --project=chromium -g "main-thread block" packages/core/src/AlertDialog/__tests__/AlertDialog.motion.interaction.browser.spec.ts, 60 times under taskset -c 0,1 with six spinning loads on those cores.
  • The whole AlertDialog.motion.interaction.browser.spec.ts in Chromium: 19 passed.
  • vitest run packages/core/src/AlertDialog/__tests__/busyMotionJudge.test.ts: 4 passed.
  • prettier and eslint on the changed files.

@vercel

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

Request Review

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

astracat-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 4:06 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.

Approved pending CI: CI has not finished on this head yet.

The busy-main-thread proof now judges pixels that follow the alert's opacity alone, so a frame can no longer read as missed where the alert's fade and the dim's fade cancel. With the old styles the judged luma changes by only about 0.1 level per frame near that turn; with the new styles it changes by at least 1.4 levels and moves one way through each phase.

  • Non-blocking: --color-background-body: rgb(255 255 255) changes nothing in this story, because the page behind the alert is the browser's canvas; drop it, or say in the comment that it only guards against a page that later paints the body colour.
Claims and files checked

Review mode: full; reason: no-earlier-review

Claims:

  • The proof fails now and then on busy runners: describes earlier CI runs, not this head; consistent with the old styles' smallest per-frame change of about 0.1 level, twice the 0.05 floor.
  • The proof still asserts the same thing, and the component, its motion and its timing do not change: verified; the assertions are unchanged (spec lines 1195-1204) and only this test file changes.
  • The proof reads the middle of the alert on each lossless frame and counts a miss at a change of 0.05 or less: verified (lines 1146, 1166-1173, 567).
  • The old styles drew the alert's light surface over an opaque black dim that fades on the same curve: verified (the base's style string; useAlertMotion.ts lines 84-86 and 103-106 drive both from one progress).
  • That combination turns partway through each motion, changing by under a tenth of a level per frame near the turn: verified; smallest change 0.096-0.112 levels, and the dismissal turns inside the busy window.
  • The new styles draw the alert black over a white page with no dim, through three declarations: verified for the result; the body-colour declaration itself has no effect (non-blocking note above).
  • The new luma is linear in opacity, never turns, and changes by about 1.4 levels or more per frame: verified; smallest change 1.405-1.499, one direction per phase.
  • Over 40 runs the old minimum was 0.093-0.113 levels: consistent; 0.096-0.112 in three runs.
  • The new minimum is 1.40-1.50 levels, with luma going 244 to 150 on present and 60 to 158 on dismiss: verified; 244.5 to 150.1 and 58.6 to 156.0.
  • 60 runs on two contended cores all passed: not repeated under contention; the proof passed every uncontended run and in CI's Chromium interaction lane.
  • The whole motion spec passes in Chromium, 19 tests: verified, 19 passed, also in CI.
  • Prettier and ESLint pass on the changed file: verified by the Lint workflow at this head.
  • No public API, product behavior, visual or policy change, and no internal context in public text: verified.

Files:

  • packages/core/src/AlertDialog/__tests__/AlertDialog.motion.interaction.browser.spec.ts: clear, with one non-blocking note.

Automated review (maintainer link)

// there reads as missed.
await page.addStyleTag({
content: `* { --duration-medium-max: ${BUSY_MS}ms !important; --duration-exit: ${BUSY_MS}ms !important; --ease-entrance: linear !important; --ease-exit: linear !important; --color-overlay: rgb(0 0 0) !important; }`,
content: `* { --duration-medium-max: ${BUSY_MS}ms !important; --duration-exit: ${BUSY_MS}ms !important; --ease-entrance: linear !important; --ease-exit: linear !important; --color-overlay: transparent !important; --color-background-body: rgb(255 255 255) !important; } dialog { --color-background-surface: rgb(0 0 0) !important; }`,

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.

Non-blocking: --color-background-body: rgb(255 255 255) has no effect in this story. Nothing behind the middle of the alert paints that token; the white there is the browser's canvas, and the judged luma is the same without the declaration. Drop it, or say in the comment above that it only guards against a page that later paints the body colour.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 5cd118f

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
AlertDialog · Storybook 130.0 kB (0) · 15.5 kB CSS (0) 448 (0) ✓ · ✓ · ✓

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

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

…ade, which has no stationary point

The proof reads the middle of the alert on each screencast frame and
expects it to change on every frame a compositor control moved. It drew
the alert's own light surface over an opaque black dim that fades on the
same curve. Those pixels are the alert's fade plus the dim's, and the two
cancel partway through, so near that point a moving alert changes the
mean luma by little. The judge's cut near zero tells a frozen alert from
a slow one there. The proof now also draws a black alert over a white page
with no dim, so the region follows the alert's opacity alone, has no
stationary point, and changes by about 1.4 levels or more on every frame.
@josephfarina josephfarina changed the title test(AlertDialog): the busy-main-thread proof reads the alert's own fade, which never stops changing test(AlertDialog): the busy-main-thread proof reads the alert's own fade, which has no stationary point Nov 18, 2026
@josephfarina
josephfarina force-pushed the test/alertdialog-busy-alert-pixels branch from 6ea85d3 to c52f77e Compare November 18, 2026 02:38

@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 test change is sound and passes at this head, but the description still describes the judge's old 0.05 cut.

  • Regression: since the rebase onto main lowered the busy judge's cut to 0.005 (busyMotionJudge.ts:20), the description's "0.05 or less", "about twice the floor" and "against the 0.05 floor" are false and its "fails now and then on busy CI runners" describes the judge before that cut, so please update those sentences to the 0.005 cut and state the impact as removing the turning point that the cut only made rare.

No code change is needed: with the new styles the judged luma moved one way on every frame by at least 1.42 levels, and the whole motion spec passed in Chromium. Two non-blocking notes are inline.

Claims and files checked

Review mode: full; reason: rebase

Claims:

  • The busy proof fails now and then on busy runners: overstated at this base; the failure it cites is from the judge before main lowered the cut to 0.005, and the old styles passed every run here.
  • The failure comes from what the proof measures, not from the component: verified; with the old styles the dismissal's luma turns inside the busy window.
  • The proof asserts the same thing, and the component, its motion and its timing do not change: verified; the assertions are unchanged (spec lines 1154-1163) and only two test files change.
  • Main already lowered the cut to 0.005, and this change touches only the judge's comment: verified (busyMotionJudge.ts line 20; the diff there is comment-only).
  • The proof reads the middle of the alert on each lossless frame: verified (spec lines 1105 and 1125-1132).
  • It counts a miss at a luma change of 0.05 or less: false; the cut is 0.005 (busyMotionJudge.ts lines 20 and 48-49).
  • The old styles drew the light alert over an opaque black dim that fades on the same curve: verified (the base style string; useAlertMotion.ts lines 84-86 and 103-106).
  • That combination turns partway through a motion: verified for the dismissal, which turns inside the busy window.
  • Near the turn the step is under a tenth of a level, about twice the floor: false in part; the step is 0.112-0.120 levels here, about 20 times the 0.005 cut.
  • The new styles draw the alert black over a white page with no dim: verified for the result; the body-colour declaration has no effect.
  • The new luma is linear in opacity, never turns, and changes by about 1.4 levels or more per frame: verified; smallest step 1.42-1.50, one direction per phase.
  • Over 40 runs the old smallest step was 0.093-0.113 against the 0.05 floor: the numbers are consistent (0.112-0.120 in three runs); the floor at this head is 0.005.
  • Failures were seen on three pull requests: not checked; no runs are named.
  • Luma goes from 244 to 150 on presentation and from 60 to 158 on dismissal: verified; 244.5 to 150.1, and 58.6-61.9 to 155.9-159.2.
  • 60 runs on two contended cores all passed: not repeated under contention; every uncontended run here passed.
  • The judge's 4 unit tests pass: verified.
  • The whole motion spec passes in Chromium, 19 tests: verified, 19 passed.
  • Prettier and ESLint pass on the changed files: verified.
  • No public API, product behavior, visual or policy change, and no internal context in public text: verified.

Files:

  • packages/core/src/AlertDialog/__tests__/AlertDialog.motion.interaction.browser.spec.ts: clear apart from two non-blocking notes (the comment's per-frame figure, the inert body-colour declaration).
  • packages/core/src/AlertDialog/__tests__/busyMotionJudge.ts: clear; its comment matches the measured step.

Automated review (maintainer link)

Comment on lines +1093 to +1094
// so the middle of the alert follows its opacity alone: it changes by
// about two levels on every frame, which a lossless cast shows, and it

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.

Non-blocking: this says the alert's pixels change "by about two levels on every frame", while the judge's comment (busyMotionJudge.ts:18) and the description say about 1.4 or more. Measured at this head, the smallest step is 1.42-1.50 levels and the mean 1.66-1.70, so "by about 1.4 levels or more" keeps the two files in step.

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

Approved pending CI: CI has not finished on this head yet.

The busy-main-thread proof now judges a black alert over the light page with no visible dim, so its luma follows the alert's opacity alone and never stalls where the two fades cancel; the description now matches the judge's 0.005 cut. The two earlier non-blocking inline notes still apply: the spec comment's "about two levels" against the measured 1.4-level floor, and the --color-background-body declaration that changes nothing in this story.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claims:
  • The old styles' region passes through a luma turning point in each motion: verified; the alert and its dim fade on one progress (useAlertMotion.ts:84-86, :103-106), and the dismissal turns inside the busy window (17 frames up, 41 down).
  • Before main lowered the cut to 0.005, frames near the turn now and then read as missed on busy runners, and the lower cut makes that rare: verified against main's earlier change to the judge, which lowered 0.05 to 0.005 after traced misses of 0.043 and 0.049.
  • The proof asserts the same invariant, and the judge, its 0.005 cut, the component, its motion and its timing are unchanged: verified; the assertions (AlertDialog.motion.interaction.browser.spec.ts:1154-1163), busyMotionJudge.ts:20 and every source file are unchanged.
  • A frame counts as missed when the luma changes by 0.005 or less: verified (busyMotionJudge.ts:48-49).
  • The old styles drew the light alert over an opaque black dim on the same curve, a·W + (1−a)(1−d)·B with a = d, which turns partway through: verified; the expression's slope is zero at a = 1 − W/2B.
  • Near the turn the change is about a tenth of a level per frame: verified (smallest 0.112-0.120).
  • The test now draws a black alert over a white page with no dim through the three tokens: verified (AlertDialog.motion.interaction.browser.spec.ts:1099).
  • The region then follows the opacity alone, is linear, never turns, and changes by about 1.4 levels or more per frame: verified (smallest 1.42-1.50, one direction on all 58 frames of each phase).
  • The judge's comment now says so: verified (busyMotionJudge.ts:16-18).
  • Before the change, 40 runs gave a smallest step of 0.093-0.113 with the dismissal turning in the window: consistent with the measured 0.112-0.120 and the turn; the 40 runs were not repeated.
  • After the change the floor is 1.40-1.50, with present 244 → 150 and dismiss 60 → 158: verified (present 244.5 → 150.1, dismiss 58.6-61.9 → 155.9-159.2); the two- and three-frame sums follow from that floor.
  • 60 runs on two loaded cores passed: not reproduced here; consistent with a floor about 280 times the cut.
  • No source file changes; the whole motion spec (19) and the judge's unit tests (4) pass; prettier and eslint are clean: verified.
  • No public API, behavior, visual or policy change, and no internal context in public text: verified.
  • Files:
  • packages/core/src/AlertDialog/__tests__/AlertDialog.motion.interaction.browser.spec.ts: two non-blocking notes (lines 1094 and 1099); otherwise clear.
  • packages/core/src/AlertDialog/__tests__/busyMotionJudge.ts: clear; its comment matches the spec's styles and the measured floor.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit eabfea6 into main Nov 18, 2026
84 checks passed
@github-actions
github-actions Bot deleted the test/alertdialog-busy-alert-pixels branch November 19, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 5cd118fd Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant