From 3d2a5ecc43c8af965f69ece910d5bd10c1b21f09 Mon Sep 17 00:00:00 2001 From: Eduardo Rios Date: Tue, 15 Sep 2026 11:26:06 -0300 Subject: [PATCH] test: lock in that levels union replaces default_filter's level, not AND Manual code-review pass (code-review-python checklist) flagged that no test exercised default_filter already restricting level (e.g. Alerts' ERROR-only default) combined with every active group specifying its own levels. The replace-not-AND behavior is deliberate per SIENTIAPDE-2011's design doc and ticket text, but was previously only covered by a docstring comment. Adds test_compute_query_time_filter_union_replaces_default_level_restriction so a future change reintroducing AND semantics fails a test instead of passing silently. Co-Authored-By: Claude Sonnet 5 --- .../test_load_notification_package.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/orchestrator/workflows/subworkflows/test_load_notification_package.py b/tests/orchestrator/workflows/subworkflows/test_load_notification_package.py index 4f049be..3266f70 100644 --- a/tests/orchestrator/workflows/subworkflows/test_load_notification_package.py +++ b/tests/orchestrator/workflows/subworkflows/test_load_notification_package.py @@ -199,6 +199,27 @@ def test_compute_query_time_filter_mixed_groups_no_levels_restriction(load_notif assert result == {'level': 'ERROR'} +def test_compute_query_time_filter_union_replaces_default_level_restriction( + load_notification_package, +): + # default_filter already restricts level (e.g. Alerts' ERROR-only default), + # but every active group specifies levels of its own -> the union REPLACES + # default_filter's level restriction, it does not AND with it. This is + # deliberate per SIENTIAPDE-2011's design doc and ticket text ("Alerts' + # hard-coded level: ERROR should become whatever levels the active groups + # actually care about"), not a bug -- this test locks the behavior in so a + # future "fix" reintroducing AND semantics fails loudly instead of passing + # silently. + sending_configs = [ + {'group_name': 'group_a', 'levels': ['WARNING'], 'ignore_models_id': []}, + ] + default_filter = {'level': 'ERROR'} + + result = load_notification_package._compute_query_time_filter(sending_configs, default_filter) + + assert result == {'level': {'$in': ['WARNING']}} + + def test_compute_query_time_filter_model_ignored_by_only_one_group_not_excluded( load_notification_package, ):