Refine Telegram alert behavior
Deploy / lint (push) Successful in 7s
Deploy / test (push) Successful in 1m18s
Deploy / deploy (push) Successful in 39s

This commit is contained in:
2026-07-04 12:37:12 +02:00
parent ce6035ee3c
commit edc1a9757b
3 changed files with 337 additions and 32 deletions
+8 -1
View File
@@ -2,7 +2,7 @@
from __future__ import annotations
from app.services.alert_service import _classify_quadrant
from app.services.alert_service import _classify_quadrant, _parse_quadrant_log_key, _quadrant_log_key
# Quadrant ids: 1=① hot&brittle (regime low, warning high), 2=② transition
@@ -43,3 +43,10 @@ def test_boundary_sitting_does_not_flip():
# A point parked exactly on both dividers keeps whatever quadrant it had.
for q in ("1", "2", "3", "4"):
assert _classify_quadrant(40, 60, prev=q) == q
def test_quadrant_log_key_keeps_previous_values():
key = _quadrant_log_key("3", 32.4, 54.6)
assert _parse_quadrant_log_key(key) == ("3", 32.4, 54.6)
# Existing pre-value keys still parse so old installs do not need migration.
assert _parse_quadrant_log_key("3") == ("3", None, None)