Skip to content

azure_alert_rules: suppression fields and processing rule counts are null when processing rules weren't read - #370

Open
Controgon wants to merge 7 commits into
mainfrom
fde-1210
Open

Controgon wants to merge 7 commits into
mainfrom
fde-1210

Conversation

@Controgon

@Controgon Controgon commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes FDE-1210

Summary

azure_alert_rules 0.4.0: a refused alert processing rule list gives null suppression fields instead of reading as an empty list. Before, the empty fallback made every rule read suppressed: false, so every enabled rule counted as reaching a person. Now, when the list is not read, each enabled rule's suppressed and reaches_human are null, and enabled_rules_suppressed, enabled_rules_possibly_suppressed, enabled_rules_reaching_human, enabled_rules_reaching_human_unknown, enabled_rules_not_reaching_human, reaching_human_percentage, all_enabled_rules_reach_human, suppressing_processing_rules_active, processing_rules, in_scope_processing_rules and excluded_processing_rules are null. The run still exits 1 as partial_failure. A list that was read and is empty still gives 0 and false. alert_routing.route() takes rules=None for an unread list, the same change as in PR #368 for azure_activity_log_alerts. The plain-text field descriptions and the changelog are updated.

Tests

tests/test_azure_alert_rules_null_counts.py (new): runs main() with the processing rule list refused and asserts the per-rule fields and every summary field above are null while the rule counts still read; a read-and-empty list still gives false and true, and 0 for the processing rule counts; a read suppression rule still suppresses; route() with None is unknown for an enabled rule and not reaching anyone for a disabled one. With the fix reverted the file fails.

Ran: the new file, the existing monitor and exclusion tests, tests/test_contracts.py and the text-format tests (1085 passed), plus the SDK-surface, reference and pattern tests (657 passed). No full suite (CI runs it).

Validator impact

No validator on main. On added-validators, four read changed fields. ECMAScript evaluation of each regex on evidence from a refused processing rule list (two rules, one availability and one WAF request count, both routed), before and after:

Validator Refused, before Refused, after
azure_availability_alert_routed pass (1 match) fail (no match)
azure_rate_limit_alert_routed pass (1 match) fail (no match)
azure_availability_rate_limit_alerts_none_unrouted pass (0 matches) fail (2 matches, "suppressed": null)
azure_alert_rules_reach_person_groups_deliverable fail (partial_failure true) fail (no match)

On a run that read the list, all four give the same verdict before and after. The three that change were passing a refused run on "suppressed": false, which was false evidence; now they fail it. None is edited here, so whether they go back for review is a separate decision. The shared Evidence Collection Succeeded validator already fails the refused run.

Changed after review

  • route() in _shared/alert_routing.py: with the processing rule list unread, an enabled rule whose own action groups give False for routes_to_enabled_receiver or routes_to_person now gets null, since a processing rule may add a group. A True stays. reaches_human follows, so the rule counts in enabled_rules_routing_unknown. processing_rule_matches and suppressed_by_processing_rules are null, not []. The file is byte-identical to the one in the azure_activity_log_alerts PR (Azure monitoring fetchers: an unread list gives null counts, not 0 or false #368).
  • enabled_rules_without_action_groups is added to SUPPRESSION_FIELDS: null when the processing rule list was not read. Its field text now says so instead of implying it knew about groups added by a processing rule. Field text for enabled_rules_routing_unknown covers the unread-list case.
  • CHANGELOG entry for 0.4.0 updated; no further version bump.
  • Tests: route() unit tests and an end-to-end run with a rule that has no action group and a refused processing rule list; a read-empty list still gives false and counts the rule in enabled_rules_without_action_groups.

🤖 Generated with Claude Code

Controgon and others added 2 commits November 16, 2026 08:44
…sing rules were not read

A refused alert processing rule list fell back to an empty list, so every rule read as not suppressed and counted as reaching a person. A rule's suppressed and reaches_human, and the summary counts and verdicts built from them, are now null when the list was not read. A list that was read and is empty still gives 0 and false.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e list was not read

processing_rules, in_scope_processing_rules and excluded_processing_rules still read 0 after a refused processing rule list. They are now null, and a list that was read and is empty still gives 0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@bruceweygandt bruceweygandt 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 main change is correct. After a refused processing rule list, the
suppression counts, the reaching-human counts, processing_rules and the two
scope counts are null. A list that was read and is empty still gives 0 and
false. The version, the CHANGELOG entry and the field text match the code. It
merges cleanly with main, and the tests pass. One gap remains.

1. fetchers/azure/_shared/alert_routing.py:227-228 and :238 (should fix)

Problem: A processing rule can add an action group to an alert rule. When the
processing rule list was not read, route() still decides routing from the
rule's own action groups only. A rule with no own action group, or with no
own deliverable one, gets routes_to_enabled_receiver: false and
routes_to_person: false. Line 238 then makes reaches_human false, not null,
because routes is False. I checked this: route(True, [], [scope], {}, None)
returns routes_to_enabled_receiver: false and reaches_human: false.

Why this is a problem: The record says "does not reach a person" when this is
not known. The CHANGELOG says each enabled rule's reaches_human is null in
this case; that is true only for rules with a deliverable own group. In the
summary, enabled_rules_without_action_groups (alert_rules/fetcher.py:170)
still counts the rule (1, not null), and the rule is in neither
enabled_rules_routing_to_enabled_receiver nor enabled_rules_routing_unknown.
The field text (fetcher.yaml:110) says this count includes groups "added by a
processing rule", which were not read.

Fix: In route(), when rules is None and the rule is enabled, change a
False from _tri to None for routes and to_person. A True can stay,
because a known own group already delivers. Then reaches_human becomes null
too. Also return None, not [], for processing_rule_matches and
suppressed_by_processing_rules. In summarize, add
enabled_rules_without_action_groups to SUPPRESSION_FIELDS, or count only
rules that have no own group and say so in the text. Add a test with a rule
that has no own action group. #368 has the same route() change, so make the
fix in both PRs.

Controgon and others added 4 commits November 17, 2026 12:57
… without its own group unknown

With the processing rule list unread, an enabled rule with no deliverable own
action group read false for routes_to_enabled_receiver, routes_to_person and
reaches_human, and still counted in enabled_rules_without_action_groups. A
False from the own groups is now null, a True stays, processing_rule_matches
and suppressed_by_processing_rules are null, not [], and
enabled_rules_without_action_groups is null.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants