Skip to content

feat(ui): the alert form and view follow several sources - #33970

Merged
manerow merged 18 commits into
feat/alerting-redesign-3-alert-definitionsfrom
feat/alerting-redesign-4-alert-form-sources
Oct 6, 2026
Merged

manerow merged 18 commits into
feat/alerting-redesign-3-alert-definitionsfrom
feat/alerting-redesign-4-alert-form-sources

Conversation

@manerow

@manerow manerow commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #20504

What this pull request implements

The alert form and the alert view follow every source an alert watches, not only the first one.

  • A new source picker, built from core components, groups sources by kind and lets the user choose several sources of one kind.
  • The filters, triggers and destination sections read one shared selection, and ask the server which filters and triggers the chosen sources support.
  • Recipient choices and the name search follow every chosen source.
  • The alert view shows source display names ("Table", not "table").
  • The AI-mode alert form and view, and the notification alert form on a user's profile, offer the recipients the server offers. The AI-mode form finds a data contract's names with the contract's own search, as the classic form does.

What was wrong before

The form and the view read only the first source of an alert. An alert with several sources, such as a mention alert that the 2.0 upgrade makes watch both conversations and tasks, showed one source, and saving it from the form dropped the others. Each section looked up the first source's filters and triggers in the catalog on its own, so nothing tied what the form offered to what the server accepts on save.

Design

  • useAlertSelection is created once by the page that shows an alert and handed down through a context, so the source picker, the filters, the triggers and the recipients read one selection and never disagree.
  • useAlertCapabilities asks the server what a selection supports, once per distinct selection. The rules for combining sources stay on the server, where the save applies them too, so the form never decides them itself. While a new answer is on its way the previous one stays on screen, and an answer to a selection the user has already changed is not shown.
  • AlertSelectionUtil turns that answer into what each section offers, and into the source options: which sources can still be chosen, which are disabled and why, and which selected source gets a warning because it can never produce a match. Until the server answers, the catalog the form already has describes the first source.
  • AlertSourceSearch decides how a field searches the names a source holds. A source with a search of its own uses it (data contracts are not in the search indexes); the other sources share one search over their indexes.
  • AlertSourcePicker shows the sources grouped by kind, with a disabled source's reason beside it, rather than failing on save.

What users notice

Users can pick several sources for one alert, and the view reads better. Existing single-source alerts look and save as before.

Screen recordings

Recorded on a local Collate deployment.

1. One alert on several sources. Before this change, the form let an alert watch only one source, so the same owner filter on tables and dashboards needed two alerts. The video creates one alert for both. The source picker lists every source, grouped by kind. Conversation shows as disabled, with the reason: it is an activity source, Table is an entity source, and the two share no filters. Once Dashboard joins Table, the form asks the server what the pair supports and offers only those filters; the alert filters by owner and emails the owners. After saving, the alert view lists both sources by their display names, and the edit form opens with both still chosen.

1-several-sources.webm

2. A mention alert the 2.0 upgrade changed. The 2.0 upgrade makes every mention alert watch Task as well as Conversation, so that people mentioned in incident tasks keep being notified. Before this change, the form and the view read only the first source: such an alert showed only Conversation, and saving it from the form, even just to edit its description, dropped Task without a warning. In the video, the view and the edit form show both sources, and after changing only the description and saving, the alert still watches both.

2-upgraded-mention-alert.webm

3. A warning for a source the trigger never reaches. Observability alerts can watch several sources too. This one watches Table and Topic, and its trigger, "Get Schema Changes (Table)", only fires for tables. The form asks the server what the selection supports and shows a warning under Topic, so the user learns before saving that no event from a topic can ever match this alert.

3-observability-warning.webm

4. Recipients in the AI-mode alert form. Who an alert can notify depends on its source: a table has owners and followers, a task has assignees, a conversation has mentioned users. The AI-mode form now offers the recipients the server lists for the chosen source. With Table it offers Users, Teams, Admins, Owners and Followers. Changing the source starts the destinations over, as the form's hint says, and with Task it offers Assignees, Owners and Mentions.

4-ai-mode-recipients.webm

5. Recipients on a user's profile. Users can also create notification alerts from their own profile (in AI mode: user menu, Profile, Notification, Alerts). That form offers recipients the same way: Users, Teams, Admins, Owners and Followers for Table, and Assignees, Owners and Mentions for Task.

5-profile-recipients.webm

How it was tested

Every UI Checkstyle step passes locally, the antd guard and the bundle budget included. Jest: 133 suites, 1,321 tests. Playwright: NotificationAlerts, ObservabilityAlerts, AlertSeveralSources, AlertRecipients and the five AI-mode alert specs, profile notifications included, 70 of 70, against a server built from this branch.

@manerow manerow added the UI UI specific issues label Sep 24, 2026
@manerow manerow added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 75%
75.74% (117309/154872) 61.5% (72158/117320) 62.89% (24089/38299)

@github-actions

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: 826 → 806
- 0 added, 20 removed, 37 changed spec-list

Removed source→spec entries:
  openmetadata-ui/src/main/resources/ui/playwright/e2e/AlertsE2E/support/activity.ts
  openmetadata-ui/src/main/resources/ui/playwright/e2e/AlertsE2E/support/alerts.ts
  openmetadata-ui/src/main/resources/ui/playwright/e2e/AlertsE2E/support/api.ts
  openmetadata-ui/src/main/resources/ui/playwright/e2e/AlertsE2E/support/collate.ts
  openmetadata-ui/src/main/resources/ui/playwright/e2e/AlertsE2E/support/db.ts
  openmetadata-ui/src/main/resources/ui/playwright/e2e/AlertsE2E/support/env.ts
  openmetadata-ui/src/main/resources/ui/playwright/e2e/AlertsE2E/support/form.ts
  openmetadata-ui/src/main/resources/ui/playwright/e2e/AlertsE2E/support/formAlerts.ts
  openmetadata-ui/src/main/resources/ui/playwright/e2e/AlertsE2E/support/ledger.ts
  openmetadata-ui/src/main/resources/ui/playwright/e2e/AlertsE2E/support/mail.ts
  … and 10 more

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/constant/sidebar.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/domain/Domain.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/user/UserClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/alert.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/domain.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/notificationAlert.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

@ShaileshParmar11 ShaileshParmar11 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.

The classic form and view now follow several sources, but the AI-mode alert form (AlertAiFormFields) still handles one source. That form is used by the AI-mode create/edit modal, the AI-mode alert details view, and the notification alert form on a user's profile.

The PR wires the server's capabilities into the AI form (recipients, filters, triggers, data contract search), which is good. But the source field itself was not changed, so the bug this PR fixes in the classic form is still present in AI mode:

  • AlertAiFormFields.component.tsx#L112 reads only the first source: const [selectedSource] = getAlertAiResources(value, alert);
  • #L273 renders a single-select <Select selectedKey={selectedSource}>, not AlertSourcePicker.
  • #L206: handleSourceChange writes resources: nextSource ? [nextSource] : [].

Repro: open a mention alert that the 2.0 upgrade made watch Conversation and Task (the case in recording 2) from the AI-mode alert page or the profile Notification tab. The source field shows only Conversation. Changing the source drops Task without a warning. Saving after a description-only edit keeps both, because value.resources is left untouched.

I also checked the rest of the stack (#33971 to #33975) and #33740. None of them changes AlertAiFormFields, so this gap would ship as-is.

Suggested fix: use AlertSourcePicker (or a multi-select built on AlertSelectionUtil's source options, with the disabled reasons and the per-source warnings) in AlertAiFormFields, and pass the full resources array instead of selectedSource to the filter, trigger, search and destination sections. Add one AI-mode Playwright spec that edits a two-source alert and asserts both sources survive.

isViewOnly,
inlineAlert,
onChange,
recipientCategories,

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.

recipientCategories now follows every source, but the source field in this component still handles one:

  • L112 const [selectedSource] = getAlertAiResources(value, alert); keeps the first source only.
  • L273 is a single-select <Select>, so a second source cannot be added or even seen.
  • L206 resources: nextSource ? [nextSource] : [] drops the other sources when the user changes the source. This is the silent drop the PR fixes in the classic form.
  • L290-L292 getRuleEventTypes(value.alertType, selectedFilterResource) takes event types from the first source's catalog entry only.

Could this use AlertSourcePicker (or the same AlertSelectionUtil source options) and pass the full resources array down instead of selectedSource?

(resource) => resource.name === selectedSource
),
[alertFormState.filterResources, selectedSource]
// The configuration view follows every source the alert watches, as the server answers for them.

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.

The capabilities now cover every source, but the view still renders AlertAiFormFields in view mode, whose source <Select> shows only selectedSource (the first one, L273). So in AI mode the mention alert from recording 2 still shows only Conversation, while the classic view shows Conversation and Task. The view needs to list every source too.

const resourceDescriptor = useMemo(
() => filterResources.find((r) => r.name === selectedTrigger),
[filterResources, selectedTrigger]
const sources = formData.resources ?? NO_SOURCES;

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.

The profile form now asks the server about every source in formData.resources, but it renders AlertAiForm, whose source field is still single-select. A user can only pick one source here, and changing the source of a two-source alert keeps only the new one. Same fix as in AlertAiFormFields would cover this form.

if (argument === 'fqnList' && selectedSource === EntityType.DATA_CONTRACT) {
const contracts = await getDataContractSuggestions(trimmedSearchText);
// A source whose names are not in the search indexes, such as a data contract, has a search of its own.
const ownSearch = selectedSource

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.

This and the index lookup in getAlertAiFqnSearchIndexes (L131-L149) use one selectedSource. The classic form now searches names across every chosen source (Table + Data Contract in AlertSeveralSources.spec). Once the AI form allows several sources, this needs the same: the sources with their own search plus one indexed search over the rest, as AlertSourceSearch does.

.join('');

// What the form offers follows the server's answer about the chosen source, so wait for it.
export const selectAlertSource = async (page: Page, source: string) => {

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.

selectAlertSource picks one option from a single-select, and no AI-mode spec covers several sources (AlertSeveralSources.spec drives only the classic pages). Could you add one AI-mode case: open an alert that watches two sources, edit it, save, and assert filteringRules.resources still has both?

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — stack_invalidated (2026-10-06T10:43:07Z)

No failing check on merge-queue commit 74bd4fe — invalidated by an entry ahead in the queue, or a required check timed out.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — stack_invalidated (2026-10-06T13:07:12Z)

The entry left the queue before it was built, so no checks ran against it.

manerow added 18 commits October 6, 2026 15:54
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — manual (2026-10-06T14:09:57Z)

The entry left the queue before it was built, so no checks ran against it.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 28 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 28 warning(s) across 16 changed file(s).

Count Rule
14 react-hooks/exhaustive-deps
13 openmetadata-imports/no-lower-layer-page-imports
1 openmetadata-imports/no-cross-page-imports
All findings
Location Rule Message
🟡 src/components/Alerts/AlertDetails/AlertConfigDetails/AlertConfigDetails.tsx:34:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/Alerts/AlertDetails/AlertConfigDetails/AlertConfigDetails.tsx:108:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/components/Alerts/AlertDetails/AlertConfigDetails/AlertConfigDetails.tsx:139:6 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'getResourcePermission' and 't'. Either include them or remove the dependency array.
🟡 src/components/Alerts/AlertDetails/AlertConfigDetails/AlertConfigDetails.tsx:145:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'fetchTemplates'. Either include it or remove the dependency array.
🟡 src/components/Alerts/AlertDetails/AlertConfigDetails/AlertConfigDetails.tsx:149:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'fetchFunctions'. Either include it or remove the dependency array. Outer scope values like 'Fqn' aren't valid de
🟡 src/components/Alerts/AlertFormSourceItem/AlertFormSourceItem.tsx:114:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'form'. Either include it or remove the dependency array.
🟡 src/components/Alerts/DestinationFormItem/DestinationFormItem.component.tsx:36:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/Alerts/DestinationFormItem/DestinationFormItem.component.tsx:72:9 react-hooks/exhaustive-deps The 'destinations' logical expression could make the dependencies of useMemo Hook (at line 86) change on every render. To fix this, wrap the initialization of '
🟡 src/components/Alerts/DestinationFormItem/DestinationFormItem.component.tsx:72:9 react-hooks/exhaustive-deps The 'destinations' logical expression could make the dependencies of useCallback Hook (at line 146) change on every render. To fix this, wrap the initialization
🟡 src/components/Alerts/DestinationFormItem/DestinationFormItemFormBridge.tsx:19:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/Alerts/DestinationFormItem/DestinationSelectItem/DestinationSelectItem.tsx:60:9 react-hooks/exhaustive-deps The 'destinationItem' logical expression could make the dependencies of useMemo Hook (at line 105) change on every render. To fix this, wrap the initialization
🟡 src/components/observability/Alerts/AlertAiDestinationSection.component.tsx:60:9 react-hooks/exhaustive-deps The 'destinations' logical expression could make the dependencies of useCallback Hook (at line 107) change on every render. To fix this, wrap the initialization
🟡 src/components/observability/Alerts/AlertAiFormFields.component.test.tsx:47:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/observability/Alerts/AlertAiFormFields.interface.ts:24:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/observability/Alerts/AlertAiFormFieldsSearchUtils.ts:20:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/observability/Alerts/AlertDetailsPage.test.tsx:29:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/observability/Alerts/AlertDetailsPage.tsx:46:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/observability/Alerts/AlertEditModal.component.test.tsx:30:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/observability/Alerts/AlertEditModal.component.tsx:25:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/observability/Alerts/AlertEditModal.component.tsx:29:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/pages/AddNotificationPage/AddNotificationPage.tsx:85:1 openmetadata-imports/no-cross-page-imports Page features must not import another page feature. Move shared code to components, hooks, interfaces, or pure utilities.
🟡 src/pages/AddNotificationPage/AddNotificationPage.tsx:148:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/pages/AddNotificationPage/AddNotificationPage.tsx:193:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'fetchAlert' and 'fetchFunctions'. Either include them or remove the dependency array.
🟡 src/pages/AddNotificationPage/AddNotificationPage.tsx:221:5 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'getResourceLimit' and 'setInlineAlertDetails'. Either include them or remove the dependency array.
🟡 src/pages/AddNotificationPage/AddNotificationPage.tsx:282:6 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'getResourcePermission' and 't'. Either include them or remove the dependency array.
🟡 src/pages/AddNotificationPage/AddNotificationPage.tsx:288:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'fetchTemplates'. Either include it or remove the dependency array.
🟡 src/utils/Alerts/AlertsUtil.test.tsx:36:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/utils/Alerts/AlertsUtilPure.ts:42:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Multi-source alert editing changes source selection, filters, triggers, and recipients.

Enables alert forms and views to follow multiple sources instead of only the first one. Sources are now grouped by kind in a new picker, filters and triggers are queried from the server based on the selected sources, and recipient options are determined by source type. Existing single-source alerts remain unchanged. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Multi-Select in Notification Source

3 participants