Skip to content

test: watch before the action at 28 first-contact waits - #10286

Merged
cixzhang merged 4 commits into
meta:mainfrom
vjeux:first-contact-watch
Nov 7, 2026
Merged

cixzhang merged 4 commits into
meta:mainfrom
vjeux:first-contact-watch

Conversation

@vjeux

@vjeux vjeux commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

On a busy runner, 28 interaction tests can miss the animation they wait for. Each reads it with an unwatched waitForAnimation right after the action that starts it, as the page's first harness call. That call installs the recorder, so a run that ends before it was never recorded. The wait then fails with the harness's first-contact error, "no animation started on the element". With WebKit on one CPU and 4 workers, main hit this error 17 times in 10 runs of the WebKit tests.

Intended invariant

The harness README, "Waiting for an animation": once the recorder runs, a wait reports an animation that started and ended before the test looked. On the page's first contact, watchAnimations(locator), taken before the action, starts it.

Change

  • Each site takes watchAnimations on the same locator before its action, then reads watch.started() with the same options. No assertion changes.
  • SegmentedControl's waitForLens takes an optional watch.
  • Traced and screencast tests take the watch before the window their proof counts, as the harness documents.

Sites: NavigationStack ×9, SegmentedControl ×8, Wheel ×4, Switch ×3, ButtonPressRelease ×2, and one each in ListRowPress and NavigationStackScrollEdge. BottomSheetKeyboardInset's site is left to #10279, which holds that scene at the keyboard report.

Out of scope: under one CPU, 15 of the 17 WebKit tests then fail at their next step in some runs. The motion has already ended when they hold, sample or read it again. That late read is a separate cause, and a follow-up converts those tests to armHold.

Evidence

  • Failure before the change: at one CPU, main's first look failed 17 times. NavigationStack's reduced-motion push failed it 7 of 10, and the Wheel storyboard 10 of 10. Chromium with 4 workers on two CPUs failed it once in 55 runs.
  • Success after the change: the first look failed 0 times in the same runs (late reads still fail; see Out of scope). Under CI's WebKit profile, every test passed 20 of 20. In Chromium with one worker, every test passed 20 of 20.
  • Product/runtime behavior verified unchanged: the diff is in interaction specs only.
  • CI impact: none; no workflow or CI script changes.

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

# WebKit, one CPU, 4 workers (the profile that shows the miss)
podman run --cpus=1 -e CI=1 … mcr.microsoft.com/playwright:v1.61.1-noble \
  node ./node_modules/@playwright/test/cli.js test \
  --config playwright.interaction.config.ts --project=webkit \
  --workers=4 --retries=0 --repeat-each=5 <the 18 WebKit tests>
# CI's WebKit profile: --cpus=4, 1 worker, --repeat-each=20
# Chromium: two pinned CPUs, --workers=4 and --workers=1

Counts:

  • WebKit, one pinned CPU, 4 workers, two rounds of 5 runs per arm with the first arm alternating:
    • Main passed 58 of 170. Its first look failed 17 times: "a push cross-fades in place instead of sliding" 7, "storyboard: a flick and its coast onto a row" 10.
    • This change passed 73 of 170, with 0 first-look failures.
    • Every other failure, in both arms, is a late read: the motion had ended before a hold, a sample or a second read. A follow-up converts those tests to armHold.
  • CI's WebKit profile (--cpus=4, 1 worker), 20 runs: this change passed 340 of 340 (17 tests; one more skips in WebKit).
  • Chromium, two pinned CPUs, 1 worker: this change passed 220 of 220 (11 tests, 20 runs). Main passed 55 of 55 (5 runs).
  • Chromium, two pinned CPUs, 4 workers, 5 runs per arm: main's first look failed once (ListRowPress); this change's never did. Both arms fail the same busy-window proofs and late reads under this load: each passed 25 of 55.
  • Core, lab and harness typecheck pass, and ESLint reports nothing on the added lines.

@vercel

vercel Bot commented Nov 6, 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 7, 2026 3:26am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 7, 2026, 3:35 AM UTC

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

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 18aabfe

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Button · Storybook 56.3 kB (0) · 9.8 kB CSS (0) 688 (0) — · — · —
DateInput · Storybook 177.8 kB (0) · 16.6 kB CSS (0) 5,586 (0) — · — · —
List 5.4 kB (0) · 469 B CSS (0) — — · — · —
6 more components
Component Size LoC Visual · A11y · RTL
ListItem 65.5 kB (0) · 11.1 kB CSS (0) — — · — · —
SegmentedControl 90.2 kB (0) · 6.8 kB CSS (0) — — · — · —
SegmentedControlItem 16.3 kB (0) · 4.3 kB CSS (0) — — · — · —
Switch · Storybook 97.0 kB (0) · 9.9 kB CSS (0) 1,725 (0) — · — · —
lab/NavigationScreen 78.6 kB (0) · 1.5 kB CSS (0) — — · — · —
lab/NavigationStack 78.6 kB (0) · 1.5 kB CSS (0) — — · — · —

Package size: measured; main has no measurement of the merge base to compare yet.

API changes: cli +14 · ~5 · −0 (against the merge base's committed report)

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

19 API changes (advisory)
Package Where Signature Usage
+ cli ./api · Types · type SearchResultEntry deprecated?: ComponentDeprecation | undefined import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …}
+ cli ./authoring · Types · interface ComponentDeprecation interface ComponentDeprecation import type {ComponentDeprecation} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface ComponentIconSlotDoc interface ComponentIconSlotDoc import type {ComponentIconSlotDoc} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface ComponentIconSlotStateDoc interface ComponentIconSlotStateDoc import type {ComponentIconSlotStateDoc} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface MultiComponentDoc deprecated?: ComponentDeprecation import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …}
+ cli ./authoring · Types · interface SingleComponentDoc deprecated?: ComponentDeprecation import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …}
+ cli ./doc · Types · interface ComponentBaseDoc deprecated?: ComponentDeprecation import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …}
+ cli ./doc · Types · interface SubComponentDoc deprecated?: ComponentDeprecation import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …}
+ cli ./doc · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/doc'
+ cli ./doc · Also exported from an earlier entry point · ComponentIconSlotDoc ComponentIconSlotDoc (./authoring) import {ComponentIconSlotDoc} from '@astryxdesign/cli/doc'
+ cli ./doc · Also exported from an earlier entry point · ComponentIconSlotStateDoc ComponentIconSlotStateDoc (./authoring) import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/doc'
+ cli ./template · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/template'
+ cli ./template · Also exported from an earlier entry point · ComponentIconSlotDoc ComponentIconSlotDoc (./authoring) import {ComponentIconSlotDoc} from '@astryxdesign/cli/template'
+ cli ./template · Also exported from an earlier entry point · ComponentIconSlotStateDoc ComponentIconSlotStateDoc (./authoring) import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/template'
~ cli ./api · Functions · function search function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "hook" | "theme" | "doc" | undefined; limit?: number | undefined }) => Promise<SearchResponse> → function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "doc" | "theme" | "hook" | undefined; limit?: number | undefined }) => Promise<SearchResponse> import {search} from '@astryxdesign/cli/api'; search(…)
~ cli ./authoring · Types · interface MultiComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {theming: …}
~ cli ./authoring · Types · interface SingleComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {theming: …}
~ cli ./doc · Types · interface ComponentBaseDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {theming: …}
~ cli ./doc · Types · interface SubComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {theming: …}

Wide change (6 components): add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

@vjeux
vjeux force-pushed the first-contact-watch branch from 3fe52ec to 34e1b2f Compare November 6, 2026 14:07
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 34e1b2f

@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 for one wording fix; the test change itself follows what the harness README prescribes for first-contact waits.

  • The title says "every first-contact wait", but packages/core/src/BottomSheet/__tests__/BottomSheetKeyboardInset.interaction.browser.spec.ts:299 still has an unwatched first-contact waitForAnimation(content) (the description leaves it to #10279), so please retitle to what this pull request changes, for example "test: watch before the action at 28 first-contact waits".
  • Non-blocking: Wheel.interaction.browser.spec.ts now uses waitForAnimation only as typeof, so ESLint warns consistent-type-imports on its import; type waitForAnimation clears it.

CI has not run on this head yet (the pull request is a draft).

[Automated review]

@@ -49,6 +49,7 @@ import {
trackMarker,
waitForAnimation,

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: with the four calls converted, waitForAnimation is now used only in typeof waitForAnimation (line 236), so ESLint warns @typescript-eslint/consistent-type-imports on this import. Importing it as type waitForAnimation, or typing WheelAnimation as the harness's ActiveAnimation, clears it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 4d488bb: the import is now type waitForAnimation. The title says 28 first-contact waits, leaving BottomSheetKeyboardInset's to #10279.

Twenty-eight interaction tests read their first animation with an
unwatched waitForAnimation, right after the action that starts it.
That call is the page's first contact with the harness, so it also
installs the recorder. A run that ends before it is invisible, and the
wait times out under load.

Each test now takes watchAnimations on the same locator before the
action, then reads it with started(), with the same options.
SegmentedControl's waitForLens takes an optional watch. Traced tests
take the watch before the window their proof counts.
@vjeux
vjeux force-pushed the first-contact-watch branch from 34e1b2f to 4d488bb Compare November 6, 2026 14:44
@vjeux vjeux changed the title test: watch before the action at every first-contact wait test: watch before the action at 28 first-contact waits Nov 6, 2026
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 4d488bb

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

Approving: each of the 28 converted waits now takes watchAnimations before its action, as the interaction harness README prescribes for a page's first contact, with no assertion changed, and the title matches what the pull request changes.

Approved pending CI: CI has not run on this head yet, because the pull request is a draft from a fork; once it is ready for review, a maintainer adds the ci:run label so CI runs.

[Automated review]

@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

/approve-spec f42aef8

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

Approving: each of the 28 converted waits takes watchAnimations before its action, as the interaction harness README prescribes for a page's first contact, with no assertion changed, and the merge of main since the last review leaves every converted site as it was.

Approved pending CI: CI has not run on this head yet; a maintainer adds the ci:run label so CI runs (it takes effect on the next push, or a close and reopen).

[Automated review]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 7, 2026
@cixzhang
cixzhang marked this pull request as draft November 7, 2026 00:22
@cixzhang
cixzhang marked this pull request as ready for review November 7, 2026 00:22
@cixzhang

cixzhang commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 12002a0

@cixzhang

cixzhang commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 18aabfe

@cixzhang
cixzhang merged commit b1327c0 into meta:main Nov 7, 2026
70 checks passed
@vjeux
vjeux deleted the first-contact-watch branch November 7, 2026 04:01

This branch was successfully deployed

1 active deployment
Preview — 18aabfe1 Deployed Nov 7, 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