From d77f998ad5b3b104a1e7ed01132bb780e260dbc7 Mon Sep 17 00:00:00 2001 From: Mark McKee <1002775+mark-mckee@users.noreply.github.com> Date: Sat, 9 May 2026 12:04:57 +0100 Subject: [PATCH] fix(monitors): restore _worst helper The aggregation patch in #N inadvertently replaced rather than appended-after the existing _worst helper, breaking every monitor check at runtime with NameError. Restoring it; _compute_service_status relies on it for status comparison. --- backend/app/tasks/monitors.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/app/tasks/monitors.py b/backend/app/tasks/monitors.py index 694b271..7dd0ce2 100644 --- a/backend/app/tasks/monitors.py +++ b/backend/app/tasks/monitors.py @@ -37,6 +37,14 @@ "major_outage": 6, } +def _worst(s1, s2): + """Return whichever of the two status strings has higher severity.""" + if s1 is None: + return s2 + if s2 is None: + return s1 + return s1 if _STATUS_PRIORITY.get(s1, 0) >= _STATUS_PRIORITY.get(s2, 0) else s2 + def _compute_service_status(service, source_monitor=None, source_status=None): """Compute the rolled-up service status across all active monitors.