Files
awoooi/apps/api/src/services/approval_action_classifier.py
Your Name e2ab879636
Some checks failed
CD Pipeline / tests (push) Failing after 52s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
Code Review / ai-code-review (push) Successful in 11s
fix(alerts): correct telegram execution truth
2026-05-31 13:58:39 +08:00

27 lines
788 B
Python

"""
Approval action classifier
==========================
2026-05-31 ogt + Codex: Telegram 告警鏈路一致性修復。
將 OBSERVE / INVESTIGATE / NO_ACTION 這類「純觀察、未執行修復」的
判斷集中,避免 execution、Telegram、統計各自用不同語意。
"""
from __future__ import annotations
def is_no_action_approval_action(action: str | None) -> bool:
"""Return True when an approval action records observation instead of repair."""
text = (action or "").strip()
upper = text.upper()
if not text:
return True
return (
"NO_ACTION" in upper
or "NO-ACTION" in upper
or "NOACTION" in upper
or "(未設)" in text
or upper.startswith("OBSERVE")
or upper.startswith("INVESTIGATE")
)