fix(api): add manual handoff package for no-action alerts
This commit is contained in:
@@ -28,6 +28,33 @@ def test_action_required_card_exposes_ai_automation_on_fallback() -> None:
|
||||
assert "執行:<code>no_action_or_observe</code>" in body
|
||||
|
||||
|
||||
def test_repair_candidate_missing_card_exposes_manual_handoff_package() -> None:
|
||||
message = TelegramMessage(
|
||||
status_emoji="ℹ️",
|
||||
risk_level="LOW",
|
||||
resource_name="node-exporter-188",
|
||||
root_cause="AI 選擇不執行修復,需人工判斷是否接手",
|
||||
suggested_action="NO_ACTION - REPAIR_CANDIDATE_MISSING: LLM 分析失敗,尚未產生安全可執行修復指令",
|
||||
estimated_downtime="unknown",
|
||||
approval_id="test-approval-id",
|
||||
incident_id="INC-20260611-34BBF5",
|
||||
primary_responsibility="INFRA",
|
||||
confidence=0.0,
|
||||
alert_category="host_resource",
|
||||
)
|
||||
|
||||
body = message.format()
|
||||
|
||||
assert "缺少可執行修復候選,已產生人工處置包" in body
|
||||
assert "Mode:<code>repair_candidate_missing_manual_handoff</code>" in body
|
||||
assert "人工處置包" in body
|
||||
assert "補證據:node_exporter target up" in body
|
||||
assert "AwoooP 建立修復候選" in body
|
||||
assert "按鈕:<b>處置包</b>" in body
|
||||
assert "修復候選狀態" in body
|
||||
assert "等待人工批准" not in body
|
||||
|
||||
|
||||
def test_nemotron_card_exposes_same_ai_automation_chain() -> None:
|
||||
message = TelegramMessage(
|
||||
status_emoji="🚨",
|
||||
|
||||
@@ -762,6 +762,8 @@ async def test_build_inline_keyboard_hides_approval_for_no_action() -> None:
|
||||
|
||||
assert "✅ 批准" not in button_texts
|
||||
assert "❌ 拒絕" not in button_texts
|
||||
assert "🧰 處置包" in button_texts
|
||||
assert "🔄 重診" in button_texts
|
||||
assert "🔕 靜默" in button_texts
|
||||
assert {
|
||||
"text": "🧭 Runs",
|
||||
@@ -1170,7 +1172,7 @@ class TestTelegramMessageFormat:
|
||||
assert "AI 已提出修復建議,等待人工批准" in result
|
||||
|
||||
def test_telegram_message_no_action_marks_manual_judgement(self):
|
||||
"""NO_ACTION 卡片必須一眼看得出需要人工判斷。"""
|
||||
"""NO_ACTION 卡片必須一眼看得出需要人工處置包。"""
|
||||
msg = TelegramMessage(
|
||||
status_emoji="ℹ️",
|
||||
risk_level="LOW",
|
||||
@@ -1184,7 +1186,12 @@ class TestTelegramMessageFormat:
|
||||
result = msg.format()
|
||||
|
||||
assert "處置狀態" in result
|
||||
assert "AI 無可安全執行動作,需人工判斷" in result
|
||||
assert "未自動修復,已產生人工處置包" in result
|
||||
assert "人工處置包" in result
|
||||
assert "補證據:node_exporter target up" in result
|
||||
assert "AwoooP 建立修復候選" in result
|
||||
assert "execution result、verifier、KM / PlayBook trust" in result
|
||||
assert "等待人工批准" not in result
|
||||
|
||||
def test_telegram_message_diagnosis_state_is_not_auto_repair(self):
|
||||
"""SSH 只讀診斷 lane 不得被顯示成自動修復。"""
|
||||
|
||||
Reference in New Issue
Block a user