Skip to content

test(useAnnounceRenderedText): the Tokenizer adopter loads the on-demand sheet module before its one-second wait - #8896

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/tokenizer-adopter-sheet-load
Oct 31, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/tokenizer-adopter-sheet-load

Conversation

@vjeux

@vjeux vjeux commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Why

The Tokenizer case of useAnnounceRenderedText.adopters.test.tsx fails at random on a busy machine, on pull requests that don't touch Tokenizer: "Unable to find a label with the text of: Search Tags".

What led to it

Tokenizer loads its touch sheet on demand (loadTokenizerBottomSheet in Tokenizer.tsx). The case opens the sheet and waits one second, the default findByLabelText wait, for the sheet's search field, so that second covers the sheet module's first load as well as the open. The load alone takes about a second on an idle machine. With vitest's default worker count on a 166-core box (165 workers), the case failed in all three full core runs I made; with 16 workers it passed in both, and it passes alone.

Options and tradeoffs

  • Raise the wait: hides the cause, and a slower machine still fails.
  • Load the sheet eagerly in Tokenizer: changes product code, and the on-demand load is deliberate (component:Tokenizer PR6).
  • Load the module in the test before the open, so the wait covers only what the test checks (this pull request).

Why this choice

The case checks that the sheet hands its own content to the shared announcement module, not how its code loads. It now awaits import('../Tokenizer/TokenizerBottomSheet') before it renders. That load counts against the test's 30-second budget, never against the one-second wait. The other lazily loaded sheets and layers have the same fix open in #8642 (Selector, MultiSelector), #8352 (Item's swipe layer) and #8353 (DropdownMenu's sheet).

How to check it

  1. Make the sheet module's load cost CPU, as on a starved machine: in a copy of the test, mock ../Tokenizer/TokenizerBottomSheet with a factory that busy-waits 1.2 s before returning the real module.
  2. Run that copy. On main the Tokenizer case fails with the error above; with this change all 8 cases pass.
  3. Run the real test without the mock: all 8 pass.

Evidence

  • With the 1.2 s busy-wait: 3 of 3 runs fail on main, 3 of 3 pass here.
  • The hooks and Tokenizer test folders pass (46 files, 747 tests), along with core's typecheck and pnpm check:repo.
  • A setTimeout delay in the mock did not reproduce it: the sheet rendered before the delay ended. A busy-wait starves the event loop the way load does.

Local gates at 4e6b38d: Prettier and ESLint pass on the changed file; the root build passes; the core UI suite passes, and the adopters file passes alone in 5 runs of 5; the node project passes except two process-timing cases in packages/cli/foundation/release/cache.test.mjs, which pass when that file runs alone (34 of 34), on this head and on main.

@vercel

vercel Bot commented Oct 29, 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 Oct 30, 2026 11:41pm UTC

Request Review

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

astracat-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 30, 2026, 11:45 PM 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.

Recommended for approval: awaiting Tokenizer's sheet module before the case opens the sheet keeps the one-second wait on the open alone, and no product code changes. With the module's load made CPU-bound, the Tokenizer case fails on main with the reported "Search Tags" error and passes with this change, and it still fails if the sheet stops handing its content to the shared announcement module. No changes are needed.

[Automated review]

@vjeux
vjeux marked this pull request as draft October 29, 2026 22:40
…and sheet module before its one-second wait

Tokenizer loads its touch sheet on demand (loadTokenizerBottomSheet), and the adopter test's sheet case opened it with a one-second findByLabelText, so that second covered the module's first load as well as the open. On a busy machine the load alone outlasts it: the case failed in every full core run at vitest's default worker count on a 166-core box, and passed alone. The case now awaits the sheet module before it opens the sheet, so its wait covers only the open; inside the case, the load counts against the test's 30 s budget, never the one-second wait. Red first: with the module's load costing 1.2 s of CPU (a mock that busy-waits before returning it), the case fails 3 of 3 on main with the error seen under load, and passes 3 of 3 here.
@vjeux
vjeux force-pushed the test/tokenizer-adopter-sheet-load branch from 392c9ad to 4e6b38d Compare October 30, 2026 23:33
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 35.6KB 35.6KB 0B

Accessibility Audit

Status: The accessibility audit did not run on this pull request. It runs after merges to main and before each release; pull requests that touch components run it with the ci:heavy-lanes label.


Generated by PR Enrichment workflow | Storybook | Sandbox | 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.

Recommended for approval: loading Tokenizer's sheet module before the case opens the sheet keeps the one-second wait on the open alone, and no product code changes. With the module's load made CPU-bound, the Tokenizer case fails on main with the reported "Search Tags" error and passes with this change, and it still fails if the sheet stops handing its content to the shared announcement module. No changes are needed.

[Automated review]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Oct 31, 2026
@cixzhang
cixzhang marked this pull request as ready for review October 31, 2026 02:30
@cixzhang
cixzhang merged commit 5013729 into meta:main Oct 31, 2026
139 of 143 checks passed
@vjeux
vjeux deleted the test/tokenizer-adopter-sheet-load branch October 31, 2026 04:34

This branch was successfully deployed

1 active deployment
Preview — 4e6b38d9 Deployed Oct 30, 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