Skip to content

test(Typeahead): the FR8 count test does not count the busy start - #11764

Merged
cixzhang merged 1 commit into
mainfrom
test/typeahead-fr8-busy-flake
Nov 15, 2026
Merged

cixzhang merged 1 commit into
mainfrom
test/typeahead-fr8-busy-flake

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Primary intent

Test-only: removes a flaky timing assumption from one BaseTypeahead test. No product code changes, so there is no Changeset.

User impact

  • Contributors: an unrelated pull request no longer fails because "announces the result count once per query, when it settles (FR8)" in BaseTypeahead.incremental.test.tsx lost a frame race. Nothing changes for people using Typeahead.

Cause

The test records every write to the polite live region and expects none while a partial list shows, and only "4 results" when the query settles.

The busy start is also announced once per query (spec:AST-092 FR8, spec:AST-086 FR6). It is announced one frame after the search starts, through a channel that writes on the following frame. Normally the query settles first, and the busy start is withdrawn before it is written. On a slow runner a frame passes inside the typing act, so "Loading" is written before the check: expected [ 'Loading' ] to deeply equal [], the error from the reported CI run.

Change

The test's observer records result announcements only and skips the busy message. The busy start keeps its own tests, for example the FR9 case "announces only the count when the answer fails before the busy start is written".

Evidence

  • Reproduction: with one extra frame before the first check, standing in for a slow runner, the current test fails with exactly the CI error. This head passes the same probe. The probe is not committed.
  • Suite: BaseTypeahead.incremental.test.tsx passes (22).

Owner and land path

  • Owner: Astryx maintainers, fix-loop lane 1.
  • Land path: code review, CI, merge.

Overlap checked: #11733 (it changes the empty-message assertions in the same test file, not this FR8 test; a flaky-test fix that should land on its own and ahead of a feature)

The test watched every write to the polite region and expected none while
a partial list showed and only "4 results" at settle. The busy start is
announced once per query too (AST-092 FR8, AST-086 FR6), one frame after
the search starts, through a channel that writes on the next frame. On a
slow runner a frame passes inside the typing act, so "Loading" is written
before the check and the test fails. It now records result announcements
only; the busy start keeps its own tests.
@vercel

vercel Bot commented Nov 14, 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 14, 2026 5:33pm UTC

Request Review

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

astracat-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 15, 2026, 8:09 AM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec db7ea85

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · db7ea85

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
BaseTypeahead 78.2 kB (0) · 11.7 kB CSS (0) — — · ✓ · ✓
Typeahead 87.5 kB (0) · 13.3 kB CSS (0) — — · ✓ · ✓
TypeaheadItem 6.6 kB (0) · 3.6 kB CSS (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.

The busy start of a pending query is meant to be announced once, so the FR8 count test should not count it: with one extra frame after typing, the old test fails with expected [ 'Loading' ] to deeply equal [], this version passes, and it still fails when the busy start is joined with the count.

Two non-blocking follow-ups in the same file, not caused by this change:

  • The FR9 test "announces only the count when the answer fails before the busy start is written" has the same one-frame race: with one extra frame after typing it fails with expected 'Loading | 2 results' not to match /Loading|Searching/.
  • The FR8 observer reads the live region's text when its callback runs, so it misses a count written and cleared within one frame; collecting addedNodes from the mutation records would let it enforce "a partial list announces nothing".
Claims and files checked

Review mode: full; reason: recipe-changed (many rules)

  • Claim: test-only, with no product code, so no changeset is needed. Verified: one test file changes.
  • Claim: nothing changes for people using Typeahead. Verified: no shipped file changes, and the built API surface is unchanged.
  • Claim: the old test expected no live-region write while a partial list shows, and only the four-result count at settle. Verified in the base test.
  • Claim: the busy start is announced once per query, one frame after the search turns busy, through a channel that writes one frame later. Verified: useBusyAnnouncement.ts:62, useAnnounce.ts:256.
  • Claim: normally the query settles first, and the busy start is withdrawn before it is written. Verified: BaseTypeahead.tsx:1348, useBusyAnnouncement.ts:83-101.
  • Claim: one extra frame makes the current test fail with the reported error, and this head passes. Verified with a local probe.
  • Claim: the observer now records result announcements only. Verified: line 195.
  • Claim: the busy start keeps its own tests. Verified: the FR9 case, the busy-announcement hook tests and the adopter test pass, with the FR9 race noted above.
  • Claim: the file's suite passes (22 tests). Verified.
  • Claim: #11733 changes other assertions in this file, not this test. Verified from its patch.
  • File: packages/core/src/Typeahead/BaseTypeahead.incremental.test.tsx: clear.

Automated review (maintainer link)

// too (AST-086); whether it is written before the query settles depends on
// frame timing, so it does not count here.
const observer = new MutationObserver(() => {
const text = liveRegion()?.textContent ?? '';

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, and already true before this change: this reads the region's text when the callback runs, so a count that is written and then cleared in the same frame is never recorded. For example, a count announced from context.update for the partial list is cleared by the busy start's announce in the same frame, and this test still passes. Collecting record.addedNodes text from the mutation records would let the test enforce "a partial list announces nothing".

@cixzhang
cixzhang marked this pull request as ready for review November 15, 2026 07:47
@cixzhang
cixzhang merged commit 49227ce into main Nov 15, 2026
143 checks passed
@github-actions
github-actions Bot deleted the test/typeahead-fr8-busy-flake branch November 16, 2026 06:04

This branch was successfully deployed

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