Skip to content

Fix AiObservabilityAlerts receiver flake: keep the team/user picker open while the drawer scrolls - #36887

Merged
ShaileshParmar11 merged 6 commits into
mainfrom
fix/ai-alert-receiver-picker-flake
Nov 3, 2026
Merged

ShaileshParmar11 merged 6 commits into
mainfrom
fix/ai-alert-receiver-picker-flake

Conversation

@ShaileshParmar11

@ShaileshParmar11 ShaileshParmar11 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes the Features/AIMode/AiObservabilityAlerts.spec.ts:309 › saves every destination kind with its receivers and authentication flake. It was the top flaky merge-queue test in the 2026-11-02 Playwright report: 3 failures and 7 flaky runs across 4 PRs.

Root cause. #36707 moved the team/user receiver picker (TeamUserSelectInput in AlertAiDestinationConfigFields.component.tsx) into a portalled <Popover isNonModal>. For a non-modal popover, react-aria closes it on any scroll of an element that contains the trigger: usePopover passes onClose: state.close to useOverlayPosition. The add-alert drawer is often still scrolling after a destination is added. The picker opened, that scroll closed it, searchText reset, and the test waited 180 s on a team-user-option-… button that had been removed from the page.

Evidence from the merge-queue reports:

  • Failure: element was detached from the DOM, retrying on team-user-option-PW%team-…, then a test timeout.
  • The failure screenshot shows the picker closed with an empty "Please Select a team".
  • One trace attempt shows a trigger click retried after the element moved 68px. The user search input then never appeared, and no search request was sent.
  • The test had 0 failed or flaky runs in the 292 merge-queue runs from Oct 29 to Nov 2, before Fixes #8065: Settings modal QA fixes #36707.

Fix. The picker already handles its own dismissal with an outside-pointerdown listener. So onOpenChange now acts only on react-aria's open request, the same approach core TreeSelect and FilterSelect use for this bug. To replace what react-aria's close handled:

  • Escape closes the picker through the same document listener. It is skipped while an IME composition is active, as react-aria does.
  • Focus moving outside the picker closes it, as react-aria's blur close did.
  • A wheel or touch scroll the user starts outside the picker closes it. Otherwise the portalled popover would stay put while the form moves under it. The scrolls that caused the flake come from the page settling, not from the user, so they fire neither event.

Type of change:

  • Bug fix

High-level design:

N/A — small change (one component, one new test file).

Tests:

Use cases covered

  • The picker stays open when an ancestor of its trigger scrolls programmatically (the flake).
  • Escape closes it, unless it ends an IME composition.
  • A wheel scroll on the form closes it; a wheel scroll inside the options does not.
  • A pointer press or focus moving outside closes it.

Unit tests

  • Added AlertAiDestinationConfigFields.component.test.tsx, 6 tests, 6 passing. It renders the real core Popover and react-aria; only the search utils and i18n are mocked.
  • The ancestor-scroll test fails on the pre-fix component, which confirms it reproduces the bug.

Backend integration tests

Not applicable — UI-only change.

Ingestion integration tests

Not applicable — no ingestion changes.

Playwright (UI) tests

No spec changes. The existing spec is the regression check.

I ran everything locally on a Vite dev server for this branch, against a local OSS Docker backend, with PLAYWRIGHT_IS_OSS=true and --retries=0:

Code Run Result
Before this fix saves every destination kind ×10 10/10 failed, same signature as CI: timed out clicking team-user-option-…
This fix saves every destination kind ×10 10/10 passed
Final HEAD 45c0c48fc659 AiObservabilityAlerts.spec.ts ×3 5 tests × 3 = 15/15 passed

make playwright_affected_run at the final HEAD 45c0c48fc659:

Local Playwright run: impacted specs PASSED (26/26) · smoke 41/42, 1 environment failure (Dashboards.spec.ts:189, see below)

  • Commit: 45c0c48fc659 (base origin/main)
  • Started: 2026-11-03T05:41:31.979Z · Playwright 1.57.0 · 4.0 min
  • Totals: 70 passed, 1 failed, 0 flaky, 0 skipped across 8 selected specs
Spec Reason Passed Failed Flaky Skipped
playwright/e2e/Features/AIMode/AiAlertPermissions.spec.ts impact-mapped 4 0 0 0
playwright/e2e/Features/AIMode/AiObservabilityAlerts.spec.ts impact-mapped 5 0 0 0
playwright/e2e/Features/AIMode/Observability.spec.ts impact-mapped 17 0 0 0
playwright/e2e/Features/Dashboards.spec.ts smoke 3 1 0 0
playwright/e2e/Flow/Navbar.spec.ts smoke 22 0 0 0
playwright/e2e/Pages/DataMarketplace.spec.ts smoke 5 0 0 0
playwright/e2e/Pages/Lineage/LineageControls.spec.ts smoke 8 0 0 0
playwright/e2e/Pages/Policies.spec.ts smoke 3 0 0 0
playwright/e2e/auth.setup.ts setup 1 0 0 0
playwright/e2e/entity-data.setup.ts setup 1 0 0 0
playwright/e2e/entity-data.teardown.ts setup 1 0 0 0
Command
cd openmetadata-ui/src/main/resources/ui
npx playwright test playwright/e2e/Features/AIMode/AiAlertPermissions.spec.ts playwright/e2e/Features/AIMode/AiObservabilityAlerts.spec.ts playwright/e2e/Features/AIMode/Observability.spec.ts playwright/e2e/Features/Dashboards.spec.ts playwright/e2e/Flow/Navbar.spec.ts playwright/e2e/Pages/DataMarketplace.spec.ts playwright/e2e/Pages/Lineage/LineageControls.spec.ts playwright/e2e/Pages/Policies.spec.ts

Dashboards.spec.ts:189 is a smoke spec and fails without this change too: the local backend has no sample_superset.model.big_analytics_data_model_with_nested_columns (the screenshot shows "Data model instance … not found"). That data model comes from current sample data, which the older local Docker build doesn't have. I reverted AlertAiDestinationConfigFields.component.tsx to base and the test still failed the same way. It covers dashboard data-model tags, which the alert picker doesn't affect.

Manual testing performed

  1. Started the UI dev server for this branch on :3300, against the local Docker backend on :8585.
  2. In AI mode, opened Observability → Alerts → Add Alert, added a Teams destination, set Type to Email, and opened the team picker.
  3. Searched for and selected a team. The picker stays open while the drawer settles.

UI screen recording:

Not applicable — this fixes a flaky test; there is no new feature or UI.

Checklist:

  • I have read the CONTRIBUTING document.

  • My PR title is Fixes <issue-number>: <short explanation> — test fix, so it has a descriptive title and the skip-pr-checks label instead.

  • My PR is linked to a GitHub issue via Fixes #<issue-number> above — test fix, no issue.

  • I have commented on my code, particularly in hard-to-understand areas.

  • For JSON Schema changes: N/A.

  • For a UI feature or feature task: N/A — test fix.

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.

    • Two passes, the last at 5103eb00568e; the focus fix was added after it. No 🔴. Fixed 🟡: a user scroll left the popover detached from its trigger; Escape during an IME composition closed the picker; focus moving away no longer closed it; an out-of-date preventScroll comment.
    • Not fixed, out of scope: the classic TeamAndUserSelectItem picker still closes on ancestor scroll. The "drop react-aria's close" pattern now exists in three places and could become a core Popover prop.
  • Decision check: no new decision; this follows the existing core TreeSelect / FilterSelect pattern.

  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

…olls

The receiver picker became a portalled isNonModal Popover in #36707.
React-aria closes such a popover on any scroll of an ancestor of its
trigger, so the add-alert drawer, still settling after a destination is
added, closed the picker right after it opened. That made
AiObservabilityAlerts "saves every destination kind" the top flaky
merge-queue test.

The picker already owns outside-press dismissal, so drop react-aria's
close request (as core TreeSelect and FilterSelect do) and handle Escape
in the same document listener.
With react-aria's close-on-scroll dropped, a wheel or touch scroll of the
form left the portalled picker floating over the wrong destination. Close
on a user-started scroll outside the picker; the settling scrolls behind
the flake fire neither event. Escape no longer closes the picker while it
ends an IME composition, matching react-aria.
React-aria's dropped close request also covered blur; close on a focusin
outside the picker and its trigger instead.
@ShaileshParmar11 ShaileshParmar11 added the skip-pr-checks Bypass PR metadata validation check label Nov 3, 2026
@ShaileshParmar11
ShaileshParmar11 requested a review from a team as a code owner November 3, 2026 05:34
Copilot AI balanced review requested due to automatic review settings November 3, 2026 05:34
@ShaileshParmar11 ShaileshParmar11 added the skip-pr-checks Bypass PR metadata validation check label Nov 3, 2026

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.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 1024 → 1028
- 4 added, 0 removed, 37 changed spec-list

New source→spec entries:
  openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaTable/ColumnCustomPropertyCell.tsx
  openmetadata-ui/src/main/resources/ui/src/components/common/Form/JSONSchema/JsonSchemaWidgets/LdapRoleMappingWidget/LdapRoleMappingWidget.tsx
  openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/components/AccessTokenRow.tsx
  openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/access-control/AccessControlRulesTable.tsx

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/e2e/fixtures/pages.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/entity/Entity.interface.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/entity/TableClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/fixtures/isolatedUser.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/aiProfile.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/apiResponse.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/customProperty.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/dragDrop.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts
  … and 27 more

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

Copilot AI balanced review requested due to automatic review settings November 3, 2026 05:35

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.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 81%
81.15% (137600/169552) 68.07% (49414/72587) 71.14% (27817/39099)

Fixes two openmetadata-imports/no-lower-layer-page-imports warnings: the
key list is a plain union, and the test takes its types from the sibling
AlertAiFormFields interface.
Copilot AI balanced review requested due to automatic review settings November 3, 2026 06:47

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.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 07:06

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 3, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Changing picker dismissal to ignore popover close requests and handle outside events manually could leave the receiver picker open or close it unexpectedly.

Keeps the alert team/user receiver picker open when an ancestor of its trigger scrolls programmatically, fixing the AiObservabilityAlerts.spec.ts flake by handling dismissal through an outside-pointerdown listener, Escape (skipped during IME composition), focus leaving the picker, and user wheel/touch scrolls outside it. 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

@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@ShaileshParmar11
ShaileshParmar11 added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit c928f43 Nov 3, 2026
72 checks passed
@ShaileshParmar11
ShaileshParmar11 deleted the fix/ai-alert-receiver-picker-flake branch November 3, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants