"""
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")
    )


def is_executable_repair_approval_action(action: str | None) -> bool:
    """Return True when approving the action should schedule a repair executor."""
    return not is_no_action_approval_action(action)
