fix(eps): cap alarm texts per event to stop eps_alarm_history.json growing unbounded
CI for csaxs_bec / test (push) Failing after 7m36s

A long-running/flapping EPS alarm appended every slightly-different
AlarmList_EPS text to the open event's texts list with no limit,
eventually growing eps_alarm_history.json past the upload server's
size limit (HTTP 413), which then retried and re-failed indefinitely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XdHenMmwbrCz1juWMi1yZc
This commit is contained in:
x12sa
2026-09-11 09:07:25 +02:00
co-authored by Claude Sonnet 5
parent e65389376d
commit 36d34d2858
@@ -92,6 +92,9 @@ _HISTORY_MAX = 50 # events persisted per stream
_HISTORY_SHOW = 5 # events surfaced to the page per stream
_TRACE_MAX = 288 # ring-current samples (24 h at 5 min)
_FLAP_COALESCE_S = 60 # re-alarm within this window extends the event
_ALARM_TEXTS_MAX = 100 # distinct alarm texts kept on a single open eps_event;
# only one event is ever open at a time, so this bounds
# total history growth during a long-running flapping alarm
_SEVERITY_NAMES = {0: "NO_ALARM", 1: "MINOR", 2: "MAJOR", 3: "INVALID"}
@@ -235,7 +238,9 @@ class HistoryTracker:
if open_ev is not None:
open_ev["count"] = max(open_ev.get("count", 0), count)
if text and text not in open_ev.get("texts", []):
open_ev.setdefault("texts", []).append(text)
texts = open_ev.setdefault("texts", [])
texts.append(text)
del texts[:-_ALARM_TEXTS_MAX]
return
# coalesce a rapid re-alarm with identical text
if self.eps_events: