fix: recognise grafana_alert_rules in check_evidence_availability (#684)#685
Conversation
…acer-Cloud#684) The key is already in _INVESTIGATED_EVIDENCE_KEYS and emitted by the _map_grafana_alert_rules mapper, but check_evidence_availability's has_cloudwatch_evidence OR-chain never probed it. A healthy alert whose only evidence was grafana_alert_rules fell through to _handle_insufficient_evidence instead of satisfying the evidence gate. Same drift-bug class as commit 3dbfb52 (EKS) and open PR Tracer-Cloud#672 (AM/CL/HC).
Greptile SummaryThis PR fixes a key-drift bug where Confidence Score: 5/5Safe to merge — fix is correct, minimal, and all existing tests pass. Only P2 findings remain: a suggestion to add a cross-reference comment documenting the coupling between No files require special attention. Important Files Changed
|
| or evidence.get("grafana_error_logs") is not None | ||
| or evidence.get("grafana_traces") is not None | ||
| or evidence.get("grafana_metrics") is not None | ||
| or evidence.get("grafana_alert_rules") is not None |
There was a problem hiding this comment.
No direct
check_evidence_availability test for this key
The parametrized test in TestIsClearlyHealthyExistingSources covers grafana_alert_rules for is_clearly_healthy, but there is no test that calls check_evidence_availability directly with {"grafana_alert_rules": ...} and asserts has_cloudwatch_evidence is True. Given this is the exact code path the bug affected, a targeted test here would provide a regression lock.
Prompt To Fix With AI
This is a comment left during a code review.
Path: app/nodes/root_cause_diagnosis/evidence_checker.py
Line: 62
Comment:
**No direct `check_evidence_availability` test for this key**
The parametrized test in `TestIsClearlyHealthyExistingSources` covers `grafana_alert_rules` for `is_clearly_healthy`, but there is no test that calls `check_evidence_availability` directly with `{"grafana_alert_rules": ...}` and asserts `has_cloudwatch_evidence is True`. Given this is the exact code path the bug affected, a targeted test here would provide a regression lock.
How can I resolve this? If you propose a fix, please make it concise.
VaibhavUpreti
left a comment
There was a problem hiding this comment.
awesome @kaushal-bakrania !
Summary
grafana_alert_rulesto thehas_cloudwatch_evidenceOR-chain incheck_evidence_availabilityso it matches_INVESTIGATED_EVIDENCE_KEYS.Context
Same drift-bug class as commit 3dbfb52 (EKS keys) and open PR #672 (Alertmanager / Coralogix / Honeycomb keys): the key is in the frozenset and emitted by
_map_grafana_alert_rules, but the OR-chain guard was not updated in lockstep. A healthy Grafana alert whose only evidence isgrafana_alert_rulesfell through to_handle_insufficient_evidenceinstead of satisfying the evidence gate.Test plan
pytest tests/nodes/root_cause_diagnosis/test_evidence_checker.py— 22 passedruff check app/nodes/root_cause_diagnosis/evidence_checker.py— cleanmypy app/nodes/root_cause_diagnosis/evidence_checker.py— clean