Skip to content

feat(alerter): fail alertrule linting if rule exposes multiple ambiguous reserved words#1159

Merged
matucker-msft merged 2 commits into
mainfrom
alerter-lint-reserved-words
May 22, 2026
Merged

feat(alerter): fail alertrule linting if rule exposes multiple ambiguous reserved words#1159
matucker-msft merged 2 commits into
mainfrom
alerter-lint-reserved-words

Conversation

@matucker-msft
Copy link
Copy Markdown
Member

@matucker-msft matucker-msft commented May 22, 2026

  • Added AlertRule query result validation for duplicate reserved alert columns with different casing, such as Severity and severity.
  • Reserved alert columns are tracked as a lowercase set and validated before row conversion so lint and execution fail clearly instead of silently choosing one value.
  • Preserved support for non-reserved/custom columns with different casing.
  • Updated linter error handling so lint failures include the underlying validation message.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR strengthens AlertRule linting/execution by detecting and rejecting ambiguous duplicate reserved alert output columns that differ only by casing (e.g., Severity vs severity), so adx-mon fails clearly instead of implicitly picking one value.

Changes:

  • Added reserved-column duplicate detection (case-insensitive) before row-to-alert conversion in the alerter executor.
  • Refactored Lint to be testable via an injectable Kusto client factory and to return a more informative lint error (lint.Err()).
  • Added unit tests covering duplicate reserved columns (failure) and duplicate custom columns (allowed).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
alerter/service.go Refactors linting to use an injectable Kusto client factory and returns lint.Err() on failures.
alerter/lint_test.go Adds a lint-level test ensuring duplicate reserved columns (different casing) fail lint with a clear message.
alerter/fake.go Enhances lint handler to accumulate failure messages and expose them via Err().
alerter/engine/executor.go Adds reserved notification column validation to reject duplicate reserved columns with different casing.
alerter/engine/executor_test.go Adds executor tests for duplicate reserved columns (fail) and duplicate custom columns (allowed).

Comment thread alerter/engine/executor.go
Comment thread alerter/service.go
Comment thread alerter/fake.go
@matucker-msft matucker-msft marked this pull request as ready for review May 22, 2026 01:23
@matucker-msft matucker-msft merged commit e823bd2 into main May 22, 2026
4 checks passed
@matucker-msft matucker-msft deleted the alerter-lint-reserved-words branch May 22, 2026 01:30
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.

3 participants