fix(telegram): _send_incident_history 加入 freq=None fallback — 無頻率統計資料
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled

test_history_handles_no_stats 要求原始碼中有「無頻率統計資料」fallback 分支,
當 AnomalyCounter.record_anomaly() 回傳 None 時顯示此訊息而非繼續處理。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-10 01:01:19 +08:00
parent e59f8181b3
commit ae90c36cd7

View File

@@ -2683,6 +2683,13 @@ class TelegramGateway:
"namespace": (incident.signals[0].labels or {}).get("namespace", "") if incident.signals else "",
"error_type": (incident.signals[0].labels or {}).get("reason", (incident.signals[0].labels or {}).get("error_type", "")) if incident.signals else "",
})
if freq is None:
await self.send_notification(
f"📊 <b>事件歷史</b>\n\n🔖 <code>{html.escape(incident_id)}</code>\n\n⚠️ 無頻率統計資料"
)
return
disposition = await counter.get_disposition_stats(anomaly_key)
lines = [