Skip to content

test(host): stop the console's switcher and authoring-sheet tests flaking by waiting for Base UI's initial focus (MMR-597) - #518

Merged
dbtlr merged 3 commits into
mainfrom
fix/mmr-597-deflake-console-tests
Oct 24, 2026
Merged

dbtlr merged 3 commits into
mainfrom
fix/mmr-597-deflake-console-tests

Conversation

@dbtlr

@dbtlr dbtlr commented Oct 24, 2026

Copy link
Copy Markdown
Owner

bun run test:ui failed about one run in five, each time on a different keyboard or focus test in the project switcher or the authoring sheet. The console code was not at fault.

Base UI moves a popup's initialFocus on the next animation frame, so the search box or sheet could render, and findBy resolve, before focus landed. The picker test then asserted focus while the header button still held it. The authoring-sheet test clicked the DEPENDS-ON combobox and typed auth, and the delayed title focus took the keystrokes partway through. The failing run's DOM shows auth in the Title field.

The open helpers now wait for that initial focus before a test acts. switcherSearch() backs openSwitcher and openSwitcherFromButton, and titleFocused() backs sheetReady and promoteReady. The two drawer tests go through openSwitcher. No timeouts changed. The jump palette's helpers were already safe, and no other test types into these popups before focus lands.

Before the fix, 2 of 10 full test:ui runs failed. After it, 20 consecutive full runs passed, and bun run verify is green. The change is test-only, so it carries skip-changelog.

Made with Claude Opus 5.5 in Claude Code.

dbtlr added 2 commits October 24, 2026 11:34
…tcher and authoring sheet (MMR-597)

Base UI moves a popup's initialFocus on the next animation frame, so a
findBy can resolve before focus lands. Under the parallel jsdom run the
picker's search box was asserted focused too early, and the authoring
sheet's title stole focus mid-type from the DEPENDS-ON combobox. The
open helpers now wait for the initial focus before the test acts.
@dbtlr dbtlr added the skip-changelog PR is behavior-preserving; waives the changelog-guard entry requirement label Oct 24, 2026
@dbtlr

dbtlr commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

skip-changelog: test-only change; the console's runtime behavior is untouched.

@kody-ai

kody-ai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 89 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 8411c3e9-e90e-4624-b85c-12c0445b1c3d
Commits

Reviewing files that changed from the base of the PR and between 7e1fa3c and 43ec315.

Files selected for processing: 1
  • packages/host/src/test/project-picker.test.tsx

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 2f1ad8d8-94d2-41bf-8278-fbea1e229ed9
Commits

Reviewing files that changed from the base of the PR and between 696cff4 and 7e1fa3c.

Files selected for processing: 2
  • packages/host/src/test/authoring-sheet.test.tsx
  • packages/host/src/test/project-picker.test.tsx

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

📝 Summary

Summary by CodeRabbit

  • Tests
    • Updated authoring-sheet tests to verify that the Title field has focus before proceeding, including during initial rendering and radio-arrow interactions.
    • Updated project-picker tests to wait for the search field to receive focus when opening the switcher and phone drawer.
    • Reused shared focus and readiness checks across test scenarios, reducing duplicated setup and making focus-related assertions more consistent.

Tests now wait for the authoring-sheet Title field or project search combobox to receive focus before continuing. Project-picker phone-drawer tests use the shared switcher-opening helper.

Changes: Focus-ready UI tests

Layer / File(s) Summary
Authoring-sheet focus readiness
packages/host/src/test/authoring-sheet.test.tsx
sheetReady and promoteReady wait for Title focus. Tests use this readiness check instead of separate focus waits.
Project-picker focus readiness
packages/host/src/test/project-picker.test.tsx
Switcher-opening helpers wait for the search combobox to receive focus. Phone-drawer tests use the shared openSwitcher helper.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

  • dbtlr/mimir#514: Updates the UI library that provides popup and dialog initialFocus behavior; this PR updates tests to wait for that focus.
Merge Risk: Minimal · up to 7e1fa

This test-only change reliably waits for popup focus without altering console runtime behavior.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the test flakiness and the affected host tests. It accurately summarizes the primary change.
Description check Passed The description directly explains the focus-timing failures, the helper changes, and the test-only scope.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@dbtlr
dbtlr merged commit d7183c0 into main Oct 24, 2026
9 checks passed
@dbtlr
dbtlr deleted the fix/mmr-597-deflake-console-tests branch October 24, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog PR is behavior-preserving; waives the changelog-guard entry requirement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant