Skip to content

[Alerting] Decouple rule-creation enablement from the datasource browse filter - #2835

Draft
lezzago wants to merge 2 commits into
opensearch-project:mainfrom
lezzago:fix/audit-rules-create-gating
Draft

[Alerting] Decouple rule-creation enablement from the datasource browse filter#2835
lezzago wants to merge 2 commits into
opensearch-project:mainfrom
lezzago:fix/audit-rules-create-gating

Conversation

@lezzago

@lezzago lezzago commented Aug 26, 2026

Copy link
Copy Markdown
Member

What & why

The Create button's enablement was tied to the datasource browse facet, so selecting a browse facet could disable creation. Fixes the useMemo gating in this file only, leaving the MonitorsMainPanel prop contract intact.

Findings: M8.

Before / after

Before / after — Create ▸ Logs alert rule with only Prometheus selected (disabled → enabled)

Before / after — Create ▸ Logs alert rule with only Prometheus selected (disabled → enabled)

Before flow — narrowing the browse filter to only Prometheus wrongly DISABLES 'Create ▸ Logs alert rule'

Before flow — narrowing the browse filter to only Prometheus wrongly DISABLES 'Create ▸ Logs alert rule'

After flow — same steps, 'Create ▸ Logs alert rule' stays ENABLED (gated on capability, not the browse filter)

After flow — same steps, 'Create ▸ Logs alert rule' stays ENABLED (gated on capability, not the browse filter)

Testing

Covered by test. Note: behavioural, not pixel-visible in the happy path.

Review

Independent review agent: APPROVE (review commit applied).

Regression check

The before/after above is a full-viewport capture, so adjacent components on the same surface are visible and unchanged — the diff is scoped to what's called out. Cross-component safety is also verified centrally: this change is file-disjoint from the other in-flight audit fixes (no file overlap, so it merges cleanly with them), and the affected plugin test suites pass with 0 new type errors vs main. Aside from the merge-order note below, it can be reviewed, merged, and reverted independently.

Dependency

No dependencies — can merge independently (file-disjoint from #2829's prop change).

Draft — see the merge-order note above.

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

(Review updated until commit d28d93b)

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@lezzago lezzago added the enhancement New feature or request label Aug 26, 2026
Rule-creation enablement was keyed off selectedDsIds (the datasource
browse/facet filter): with an empty selection BOTH create branches were
disabled, and otherwise each was disabled unless every selected datasource
matched its type. This wrongly hid a capability based on an unrelated list
filter — e.g. a user with a Prometheus datasource but no facet selection
could not start creating a metrics rule.

Derive logsCreateDisabled/metricsCreateDisabled from the datasources
AVAILABLE to the user instead: metrics create is enabled when at least one
Prometheus datasource exists, logs create when at least one OpenSearch
datasource exists. The MonitorsMainPanel prop contract is unchanged; only
the derivation moved. The user picks the specific datasource in the wizard.

Audit ID: M8 (Major, flow heuristic AL3)

Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>
Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>
@lezzago
lezzago force-pushed the fix/audit-rules-create-gating branch from 38446ca to d28d93b Compare August 27, 2026 17:15
@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit d28d93b

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant