Skip to content

Fixes #38693: stop three recurring browser-test flakes at their root - #38694

Merged
chirag-madlani merged 1 commit into
mainfrom
fix/browser-test-flakes
Nov 26, 2026
Merged

chirag-madlani merged 1 commit into
mainfrom
fix/browser-test-flakes

Conversation

@chirag-madlani

Copy link
Copy Markdown
Collaborator

Fixes #38693

Describe your changes:

Three browser-test failures kept coming back on PRs that don't touch the code they test. Of the last 25 failed UI Browser Tests runs, 9 were "Data Consumer denied EditDescription" (Table, Dashboard, Container, File, Topic), 6 were advanced search "two conditions as a group", and 2 were DriveService "children search placeholder". Each one has a root-cause fix and a test that fails without it.

1. Requests started during unmount landed unhandled in the next test (src/test/browser/network.ts)

setup.ts unmounts the page in afterEach, waits for networkIdle, then resets the handlers. networkIdle counted requests from MSW's request:start worker events, which reach the page through the service worker, later than the request itself. Unmounting flushes the page's pending effects, and those start requests. When the test's last activity was more than 150 ms earlier, the first idle check passed before the worker reported them. The handlers were then reset, and the requests became "API calls without an MSW handler" in the next test. That's why the failing test is always the one after a hard delete, and why the unhandled calls are always the delete test's landing page (databaseSchemas/name/…, storedProcedures, dashboardServices/name/…, containers, drives/*).

I confirmed it with timing logs: 12 requests started after cleanup() returned. The fix counts /api requests where the page sends them (fetch and XMLHttpRequest, which axios uses), and networkIdle yields one task first so axios's promise-based interceptors have sent. The new network.browser.test.ts fails on both cases (fetch, axios) with the old code, every time.

2. Advanced search pickOption could stall until the test timed out (src/test/browser/advanced-search/queryBuilder.ts)

listboxOf(input) built its locator from the listbox id read at that moment. When the popup re-opened under the click, it got a new id ("element was detached"), and the click waited out the whole test (175 s). The step also clicked the "Show options" toggle whenever the popup wasn't open yet, which closed one that opened a moment later (the queryBuilder.ts:67 failures). It now opens with ArrowDown, which opens the popup or moves focus inside it and never closes it, and it finds the option at click time. pickSuggestion had the same pinned id and is fixed the same way.

3. SchemaTable: a stale page-1 list replaced the search hits (product bug, SchemaTable.component.tsx)

onSearch sets columnSearch and resets to page 1 as two updates. In between, the list effect can start a plain page-1 fetch next to the search fetch, and whichever answers last sets the rows. The CI failure screenshot showed exactly that: order_col_11 in the search box, unfiltered order_col_001… in the table. Users can hit it too. Only the latest columns request now sets rows, paging and the loader. The new browser test holds the page-1 list back for 500 ms; it fails without the fix and passes with it.

Not in scope

EditConnectionFormPage secret masking failed once, only on test/connection-secret-masking, the PR that changes that page, so it isn't treated as a flake here.

Type of change:

  • Bug fix

Tests

  • Full browser suite locally: 131 files, 1,073 passed, 0 failed.
  • network.browser.test.ts: fails with the old networkIdle (2/2) and passes with the fix.
  • SchemaTable: the new race test fails before the fix and passes after; the existing browser tests (8) and Jest tests (29) pass.
  • Advanced search: 22 files and 277 tests pass.
  • ESLint and Prettier are clean on the changed files, and tsc reports no errors in them.

🤖 Generated with Claude Code

- networkIdle counted requests from MSW's service-worker events, which
  reach the page later. Unmounting a page in afterEach flushes its
  pending effects, and the requests they start could miss the first idle
  check, so the handlers were reset and they landed unhandled in the
  next test ("Data Consumer denied EditDescription", "children search
  placeholder"). Count /api requests where the page sends them (fetch and
  XMLHttpRequest), and yield one task first so axios has sent.
- Advanced search pickOption pinned its locator to the listbox id read
  once; a popup that re-opened under the click got a new id and the click
  waited out the test (175 s). It also toggled "Show options", which could
  close a popup that opened a moment later. Open with ArrowDown and find
  the option at click time.
- SchemaTable: searching also resets to page 1, which can start a plain
  list fetch beside the search; a slower list response replaced the hits.
  Only the latest columns request now sets the rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chirag-madlani
chirag-madlani requested a review from a team as a code owner November 25, 2026 13:48
@chirag-madlani
chirag-madlani requested review from anuj-kumary and a balanced review from Copilot November 25, 2026 13:48

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

The SchemaTable latest-request guard changes concurrent result handling; without it, an older page fetch could replace filtered search results.

Fixes three recurring browser-test flakes at their root: networkIdle now counts /api requests at the page level so late requests no longer leak into the next test, advanced search pickOption and pickSuggestion open the listbox with ArrowDown and locate options at click time, and SchemaTable only lets the latest columns request set rows, paging, and loader. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

Copy link
Copy Markdown
Contributor

UI browser tests

Ran: all test files (no impact map from main yet)

Result: ✅ 1075 passed · 154 skipped

Changed code executed by these browser tests: 12 / 17 lines (71%)

File Changed lines Executed %
src/components/Database/SchemaTable/SchemaTable.component.tsx 17 12 71%

@chirag-madlani
chirag-madlani merged commit b59fcf4 into main Nov 26, 2026
55 of 56 checks passed
@chirag-madlani
chirag-madlani deleted the fix/browser-test-flakes branch November 26, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browser tests: fix the recurring CI flakes (unhandled leak after unmount, advanced-search pick, schema search race)

3 participants