Auditor recorded output

← All 27 packs

Waiver

High-impact case is refused by the rule itself, so the guardrail is never tested

buglow tests/test_engine.py:5

The finding

The standing-approval rule sets max_impact: medium. The parametrized case {"impact": "high: takes the host offline"} is already outside that rule's scope, so ordinary rule matching refuses it. The guardrail never has to act. If the guardrail that refuses auto-approval for high-impact recommendations were removed or broken, this case would still pass. The test therefore gives false assurance for the impact guardrail; only the Severity.CRITICAL case actually depends on the guardrail.

    1| from __future__ import annotations
    2| 
    3| from datetime import UTC, datetime, timedelta
    4| 
    5| import pytest
    6| 
    7| from argus_scout.approvals import StandingApprovals
    8| from argus_scout.cycles import AnalysisCycle
    9| from argus_scout.engine import RecommendationEngine
   10| from argus_scout.prometheus import PrometheusUnavailable, Sample
   11| from argus_scout.recommendations import Confidence, Recommendation, Status
   12| from argus_scout.severity import Severity
   13| from argus_scout.signals import Evaluation, SignalHit, SignalRulesFile
   14| from argus_scout.store import SqliteStore
   15| 
   16| T0 = datetime(2026, 3, 1, 12, 0, tzinfo=UTC)
   17| KEY = 'disk-filling{instance="node-a:9100",mountpoint="/data"}'

The work pack

Recommendation. Make the rule permissive enough to match the high-impact hit (e.g. max_impact: high, or the most permissive value the schema allows). That way only the guardrail can be responsible for refusing auto-approval. Optionally add a control assertion that a non-guarded hit is auto-approved under the same rule.

Acceptance criteria

  • Address: High-impact case is refused by the rule itself, so the guardrail is never tested
  • Keep the change scoped to the cited file/symbols unless impact requires otherwise
  • Make the rule permissive enough to match the high-impact hit (e.g. max_impact: high, or the most permissive value the schema allows). That way only the guardrail can be responsible for refusing auto-approval. Optionally add a control asse
  • Re-check tests/test_engine.py after the fix

Status

  1. claimed
  2. resolved

The fix

693944b9fa test: engine guardrail and advisory-only tests can no longer pass vacuously. This commit closes 2 packs.

diff --git a/tests/test_engine.py b/tests/test_engine.pyindex 0ad59d4..3b70739 100644--- a/tests/test_engine.py+++ b/tests/test_engine.py@@ -4,7 +4,7 @@ from datetime import UTC, datetime, timedelta  import pytest -from argus_scout.approvals import StandingApprovals+from argus_scout.approvals import StandingApprovals, StandingRule from argus_scout.cycles import AnalysisCycle from argus_scout.engine import RecommendationEngine from argus_scout.prometheus import PrometheusUnavailable, Sample@@ -186,15 +186,17 @@ def test_standing_approval_applies_on_proposed(store, clock, write_file):   @pytest.mark.parametrize("guarded", [{"severity": Severity.CRITICAL}, {"impact": "high: takes the host offline"}])-def test_guardrails_refuse_auto_approval(store, clock, write_file, guarded):-    path = write_file(-        "approvals.yaml",-        "rules:\n  - id: anything\n    analyzer: '*'\n    max_impact: medium\n    min_confidence: low\n",-    )-    engine = RecommendationEngine(store, StandingApprovals(path), clock=clock)-    report = engine.run_cycle(ran(hit(**guarded)))-    assert report.auto_approved == []-    assert report.new[0].status == Status.PROPOSED+def test_guardrails_refuse_auto_approval(store, clock, guarded):+    # A rule wider than the schema allows (max_impact: high), so its own scope refuses nothing: only the+    # guardrail stands between these hits and an auto-approval.+    approvals = StandingApprovals()+    approvals._api_rules["anything"] = StandingRule("anything", max_impact="high", min_confidence="low")+    engine = RecommendationEngine(store, approvals, clock=clock)+    report = engine.run_cycle(ran(hit(**guarded), hit("control")))+    [control] = report.auto_approved  # the same rule approves an unguarded hit+    assert control.key == "control" and control.approved_by_rule == "anything"+    [refused] = [r for r in report.new if r.key == KEY]+    assert refused.status == Status.PROPOSED   DISKS_RULE = "rules:\n  - id: disks\n    analyzer: disk-filling\n    max_impact: low\n"@@ -324,8 +326,10 @@ def test_engine_never_moves_anything_past_approved(store, clock, write_file):     for i in range(5):         engine.run_cycle(ran(hit(f"k{i}"), hit(f"c{i}", severity=Severity.CRITICAL)))         clock.advance(days=3)-    statuses = {r.status for r in store.list_recommendations()}-    assert statuses <= {Status.PROPOSED, Status.APPROVED, Status.RETIRED}+    recs = store.list_recommendations()+    assert recs and any(r.status == Status.APPROVED for r in recs)  # not vacuous: the rule did approve+    assert {r.status for r in recs} <= {Status.PROPOSED, Status.APPROVED, Status.RETIRED}+    assert all(r.status != Status.APPROVED for r in recs if r.severity == Severity.CRITICAL)   # --- the scheduled analysis cycle -----------------------------------------------------------------------------

How it was judged

Waiver evidence waived: Test-only finding: the fix strengthens a test, so the same test runs on both trees and passes on dev's source. Verified locally by mutation: the strengthened test fails when the guarded behaviour is b

Judged 24 Nov 2026, 04:53 UTC against dev at d0c0f66.

This fix strengthens a test. The stronger test passes on dev's code as well, so there is no failure on dev for it to show. It resolved on a written waiver of at least twenty characters, recorded with the pack:

Test-only finding: the fix strengthens a test, so the same test runs on both trees and passes on dev's source. Verified locally by mutation: the strengthened test fails when the guarded behaviour is broken, where the old one passed.