From 2cd3e64cee8025333dcfd2f3e83aa10a0ea491cf Mon Sep 17 00:00:00 2001 From: h Date: Thu, 23 Jul 2026 05:04:14 +0200 Subject: [PATCH] fix(alerts): tell informational alerts from real stand-downs by type --- src/healthbot/alerts.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/healthbot/alerts.py b/src/healthbot/alerts.py index d0649c5..7f8233e 100644 --- a/src/healthbot/alerts.py +++ b/src/healthbot/alerts.py @@ -5,6 +5,18 @@ from typing import Any LEVEL_ICON = {"OK": "✅", "WARNING": "🟠", "CRITICAL": "🔴"} +INFORMATIONAL = frozenset( + { + "StackImageUpdateAvailable", + "DeploymentImageUpdateAvailable", + "StackAutoUpdated", + "DeploymentAutoUpdated", + "ScheduleRun", + "Test", + "Custom", + } +) + def _gb(value: Any) -> str: # noqa: ANN401 try: @@ -87,12 +99,20 @@ def _describe(kind: str, d: dict) -> tuple[str, list[str]]: # noqa: C901, PLR09 def format_alert(payload: dict) -> str: level = str(payload.get("level", "")).upper() - resolved = bool(payload.get("resolved")) or level == "OK" data = payload.get("data") or {} kind = str(data.get("type") or "Unknown") inner = data.get("data") or {} - icon = "✅" if resolved else LEVEL_ICON.get(level, "🔔") + informational = kind in INFORMATIONAL + resolved = bool(payload.get("resolved")) and not informational + + if informational: + icon = "â„šī¸" + elif resolved: + icon = "✅" + else: + icon = LEVEL_ICON.get(level, "🔔") + title, details = _describe(kind, inner if isinstance(inner, dict) else {}) if resolved: