Skip to content

test(AlertDialog): the busy-thread motion proof tells a slow alert from a frozen one - #11927

Merged
cixzhang merged 2 commits into
mainfrom
test/alertdialog-busy-judge
Nov 18, 2026
Merged

cixzhang merged 2 commits into
mainfrom
test/alertdialog-busy-judge

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

User impact

No product change. Contributors and CI see the AlertDialog motion proof "present and dismiss keep moving through a 1 s main-thread block, against a compositor control" fail about once in 200 runs under load, while the alert is still moving. After this change it fails only when the alert really stops changing.

Problem and solution fit

  • Why it flaked: the proof counts an alert frame as still when the mean luma of the alert's region changes by 0.05 or less from the previous frame. Near the fade curve's luma stationary point, a moving alert can change less than that in one frame.
  • Evidence: two traced misses from 400 repeats of the main-branch test, on 8 workers in Chromium. In both, the missed frame was the same frame (61), with a luma step of 0.049 and 0.043. The frames around it stepped by 0.07–0.35 in the same direction, and the control moved 10 px on every frame. So the alert never froze; a frozen frame repeats its pixels and steps by 0.000.
  • The fix: the cast is lossless (PNG), so a frozen alert reads exactly the same mean luma. The motion cut is now 0.005.
  • Tolerance derivation (not a loosened check): a still frame repeats its pixels, so its step is exactly 0. Real motion near the fade's stationary point steps under 0.05, so the old cut read motion as a stall. The new cut of 0.005 still fails every truly stalled frame.
  • How 0.005 was chosen: the fixed proof ran 400 times on the same machine, 8 workers, no retries. All 400 passed, with no missed frame in either phase. The smallest step on a frame the control moved was 0.039 for the entrance (5th percentile 0.056) and 0.075 for the exit. That's about 8 times the cut. A frozen alert still fails on its first repeated frame, and longestAlertStall <= longestControlStall is unchanged.
  • The judge moves to AlertDialog/__tests__/busyMotionJudge.ts so unit tests can pin it. The browser proof imports it and is otherwise unchanged.

Smallest restoration

  • Test and harness only: the AlertDialog motion spec, a new judge module, and its unit test.
  • No product, record or API change. No changeset.

Evidence

  • Red first: busyMotionJudge.test.ts has these cases:
    • a frozen alert misses all 12 frames;
    • a slow alert with the traced step pattern (−0.28, −0.049, −0.27, −0.085, …) misses none;
    • one repeated frame inside motion counts as a one-frame stall;
    • only frames inside the window are judged.
      At the old 0.05 cut, the slow-alert case fails with 2 misses. At 0.005, all 4 pass.
  • Browser: 400 of 400 runs pass with the fix, as above.

Scope

Components: AlertDialog (tests only)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run packages/core/src/AlertDialog/__tests__/busyMotionJudge.test.ts: 4 passed (red first, as above).
  • tsc --noEmit -p packages/core: clean.
  • eslint (strict) on the changed files: no errors.
  • test:interaction AlertDialog (the motion proof at :1082): 400 of 400 under load.

Owner and land path

Owner: Cindy's Astryx gaps lane 3 (agent). The motion spec's owner signs off before merge. Land path: Specs stamp as a test-only repair, then CodeBunny review on the exact head, then ready, CI, and merge through the drain queue. No release.

…om a frozen one

The proof counted an alert frame as still when its region's mean luma changed by 0.05 or less. Near the fade curve's luma stationary point a moving alert changes it by less than that in one frame (0.043 and 0.049 in two traced misses), so about one run in 200 failed under load with the alert still moving. The cast is lossless, so a frozen alert repeats its luma exactly. The cut is now 0.005: in 400 busy runs the smallest step on a frame the control moved was 0.039 for the entrance and 0.075 for the exit. The judge moves to its own module with unit tests: a frozen alert misses every frame, a slow alert misses none, and one repeated frame counts as a one-frame stall.
@vercel

vercel Bot commented Nov 15, 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 17, 2026 6:22pm UTC

Request Review

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

astracat-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 1:11 AM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 278163a

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 6196e4e

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

@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 run on this head yet, and it starts when the pull request is marked ready for review.

The lower motion cut is test tuning under the AlertDialog motion verification. The old cut's failure reproduces in the new unit test (2 misses at 0.05, none at 0.005), and the busy-main-thread proof passed 5 of 5 Chromium runs on this head. No changes requested.

Claims and files checked

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

  • Claim: a one-frame luma step under 0.05 near the fade's stationary point caused the flake. Consistent: the traced step pattern gives 2 misses at 0.05 in the new unit test; the trace itself is the author's measurement.
  • Claim: the still-frame cut is now 0.005. Verified at busyMotionJudge.ts:20.
  • Claim: a frozen alert still fails on its first repeated frame. Verified by the frozen-alert unit case (12 of 12 frames missed) and the zero-miss assertion at AlertDialog.motion.interaction.browser.spec.ts:1154.
  • Claim: the stall comparison between alert and control is unchanged. Verified at AlertDialog.motion.interaction.browser.spec.ts:1155-1158.
  • Claim: the judge moved to its own module and the browser proof is otherwise unchanged. Verified against the diff; only the cut and a wider control type differ.
  • Claim: red first, with the slow-alert case failing at 0.05 and all four cases passing at 0.005. Verified by running the unit test at both cuts.
  • Claim: 400 of 400 browser runs pass, with a smallest moving step of 0.039 (entrance) and 0.075 (exit), about 8 times the cut. Consistent: 5 of 5 runs pass here; the 400-run figures were not repeated.
  • Claim: typecheck and lint are clean. Verified with tsc --noEmit -p packages/core and eslint on the three files.
  • Claim: test only, with no product, record, API or changeset change. Verified from the file list and identical built API surfaces.
  • File packages/core/src/AlertDialog/__tests__/AlertDialog.motion.interaction.browser.spec.ts: clear.
  • File packages/core/src/AlertDialog/__tests__/busyMotionJudge.ts: clear.
  • File packages/core/src/AlertDialog/__tests__/busyMotionJudge.test.ts: clear.

Automated review (maintainer link)

A clean merge onto current main; no conflicts.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 6196e4e

@cixzhang
cixzhang marked this pull request as ready for review November 17, 2026 18:17

@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: CI passed on this head, including the Chromium run of the busy-main-thread proof with no missed frame in either phase.

The lower motion cut is test tuning under the AlertDialog motion verification; the old cut's failure reproduces in the new unit test (2 misses at 0.05, none at 0.005), and a frozen alert still misses every frame. A possible follow-up, not needed for this change: this proof keeps its own luma tracker and judge, while the interaction harness's brightness busy proof (used by Lightbox and Switch) already judges fades against the compositor control by capture step, which would retire the hand-tuned cut.

Claims and files checked

Review mode: same-head; reason: none

  • Claim: the proof flaked about once in 200 runs with the alert still moving, because a one-frame luma step near the fade's stationary point fell under 0.05. Consistent: the traced steps give 2 misses at 0.05 in the new unit test; the flake rate and the traces are the author's measurements.
  • Claim: in the traced misses the frames around the missed one kept stepping the same way while the control moved every frame, so the alert never froze. Consistent: the unit test's slow cast uses those steps with the control moving on every frame; the traces themselves are the author's.
  • Claim: the cast is lossless, so a frozen alert repeats its luma exactly. Verified: the proof records a PNG screencast (AlertDialog.motion.interaction.browser.spec.ts:1101) and reads the mean luma from the decoded pixels over a fixed region (:484, :1121-1126).
  • Claim: the still-frame cut is now 0.005. Verified at busyMotionJudge.ts:20.
  • Claim: a frozen alert still fails on its first repeated frame, and the stall comparison with the control is unchanged. Verified by the frozen and one-stall unit cases and the assertions at AlertDialog.motion.interaction.browser.spec.ts:1151-1158.
  • Claim: the judge moved to its own module and the browser proof is otherwise unchanged. Verified against the diff; only the export, a control parameter that needs only each frame's box, and the cut differ from the removed function.
  • Claim: red first, with the slow-alert case failing with 2 misses at 0.05 and all four cases passing at 0.005. Verified by running the unit test at both cuts on this head's files; CI's unit job also passed the four cases on this head.
  • Claim: 400 of 400 browser runs pass, with a smallest moving step of 0.039 (entrance) and 0.075 (exit), about 8 times the cut. Consistent: CI's Chromium run of the proof at :1082 passed on this head with no missed frame, and 0.039 is 7.8 times 0.005; the 400-run figures were not repeated.
  • Claim: typecheck and lint are clean. Verified: CI's typecheck and Lint succeeded on this head.
  • Claim: test and harness only, with no product, record, public API, default, interaction or changeset change. Verified from the file list, Core's build excluding the test folder, and CI's API change report with no rows.
  • Claim: the land path is a spec stamp as a test-only repair, then review, CI and the merge queue, with the motion spec's owner signing off before merge. The spec stamp is present for this head and CI has passed; the owner's sign-off is still ahead.
  • Claim: the public text carries no internal context. Verified against the title, description, branch name and commit messages.
  • File packages/core/src/AlertDialog/__tests__/AlertDialog.motion.interaction.browser.spec.ts: clear.
  • File packages/core/src/AlertDialog/__tests__/busyMotionJudge.ts: clear.
  • File packages/core/src/AlertDialog/__tests__/busyMotionJudge.test.ts: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 17, 2026 19:32
@cixzhang
cixzhang marked this pull request as ready for review November 17, 2026 19:32
@cixzhang
cixzhang marked this pull request as draft November 17, 2026 21:21
@cixzhang
cixzhang marked this pull request as ready for review November 17, 2026 21:22
@cixzhang
cixzhang marked this pull request as draft November 17, 2026 21:46
@cixzhang
cixzhang marked this pull request as ready for review November 17, 2026 21:46
@cixzhang
cixzhang marked this pull request as draft November 17, 2026 22:21
@cixzhang
cixzhang marked this pull request as ready for review November 17, 2026 22:21
@cixzhang
cixzhang merged commit 248e91d into main Nov 18, 2026
451 of 485 checks passed
@github-actions
github-actions Bot deleted the test/alertdialog-busy-judge branch November 18, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 6196e4ea Deployed Nov 17, 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