test(alerts): 對齊 no-action 修復語意測試
All checks were successful
CD Pipeline / tests (push) Successful in 1m19s
Code Review / ai-code-review (push) Successful in 12s
CD Pipeline / build-and-deploy (push) Successful in 3m29s
CD Pipeline / post-deploy-checks (push) Successful in 1m47s

This commit is contained in:
Your Name
2026-05-31 15:52:24 +08:00
parent 8d9525fb3b
commit e9a8a2b3e9
3 changed files with 7 additions and 3 deletions

View File

@@ -63,6 +63,8 @@ async def test_no_action_execution_resolves_incident_once(monkeypatch):
approval.id,
success=True,
execution_kind="no_action",
repair_executed=False,
repair_attempted=False,
)
assert "未執行修復" in timeline_add_event.await_args.kwargs["title"]
assert alert_completed.await_args.kwargs["execution_kind"] == "no_action"
@@ -129,5 +131,7 @@ async def test_no_action_execution_returns_true_when_resolve_raises(monkeypatch)
approval.id,
success=True,
execution_kind="no_action",
repair_executed=False,
repair_attempted=False,
)
incident_service.resolve_incident.assert_awaited_once_with("INC-TEST-002")

View File

@@ -68,8 +68,8 @@ python3 -m json.tool apps/web/messages/en.json
-> pass
cd apps/api && ruff check --select E9,F401,F821,F841 src/services/operator_outcome.py src/services/approval_db.py src/services/approval_execution.py src/services/awooop_truth_chain_service.py src/services/platform_operator_service.py src/services/telegram_gateway.py tests/test_operator_outcome.py tests/test_awooop_operator_timeline_labels.py tests/test_telegram_message_templates.py
-> pass
cd apps/api && DATABASE_URL=postgresql+asyncpg://test:test@localhost:5432/test pytest tests/test_operator_outcome.py tests/test_awooop_truth_chain_service.py tests/test_awooop_operator_timeline_labels.py tests/test_telegram_message_templates.py tests/test_incident_timeline_service.py -q
-> 159 passed
cd apps/api && DATABASE_URL=postgresql+asyncpg://test:test@localhost:5432/test pytest tests/test_approval_execution_no_action.py tests/test_operator_outcome.py tests/test_awooop_truth_chain_service.py tests/test_awooop_operator_timeline_labels.py tests/test_telegram_message_templates.py tests/test_incident_timeline_service.py -q
-> 161 passed
pnpm --dir apps/web exec tsc --noEmit --tsBuildInfoFile /tmp/awoooi-operator-outcome-20260531.tsbuildinfo
-> pass
NEXT_PUBLIC_API_URL=https://awoooi.wooo.work pnpm --dir apps/web run build

View File

@@ -2688,7 +2688,7 @@ Phase 6 完成後
- 觸發使用者指出批准後、已處理、執行中、degraded 等狀態仍缺少終局結論operator 看不出「處理結果是什麼、是否需要人工介入、人工介入透過什麼通知方式接手」。Production 抽查也看到部分 approval 的 `telegram_result_total=0`,舊 `_push_execution_result_to_alert()` 在找不到 Redis 原始 Telegram message id 時會靜默 return。
- 修正:新增 `operator_outcome_v1` 共用契約,集中輸出 `state``summary_zh``needs_human``human_action_required``human_action_reason``next_action``notification.channels``evidence``blockers`。AwoooP truth-chain、platform status-chain、Telegram 首屏、Telegram callback snapshot 與前台 status-chain 全部讀同一份 outcome。approval execution result 改在最終驗證、AOL / KM / incident log 寫入後送出;若缺原始 Telegram message id改送 standalone 群組結果通知並寫 `TELEGRAM_RESULT_SENT`,不再靜默失聯。
- 語意收斂:`OBSERVE` / `NO_ACTION` / diagnostic / parse_failed / unsupported_action 會寫入 `execution_kind``repair_executed=false``repair_attempted=false`。diagnostic-only、verification degraded、execution failed、read-only dry-run、write-observed、blocked、PENDING / WAITING_APPROVAL 都會明確標示人工需求、通知通道與下一步,不再把診斷或觀察顯示成修復完成。
- VerificationAPI `py_compile` passi18n JSON parse passtargeted `ruff --select E9,F401,F821,F841` pass`test_operator_outcome.py` + `test_awooop_truth_chain_service.py` + `test_awooop_operator_timeline_labels.py` + `test_telegram_message_templates.py` + `test_incident_timeline_service.py` -> 159 passedweb `tsc --noEmit` passproduction API URL build pass`git diff --check` pass。
- VerificationAPI `py_compile` passi18n JSON parse passtargeted `ruff --select E9,F401,F821,F841` pass`test_approval_execution_no_action.py` + `test_operator_outcome.py` + `test_awooop_truth_chain_service.py` + `test_awooop_operator_timeline_labels.py` + `test_telegram_message_templates.py` + `test_incident_timeline_service.py` -> 161 passedweb `tsc --noEmit` passproduction API URL build pass`git diff --check` pass。
- 判讀T154c 補的是「operator-facing disposition contract」與「result notification reliability」不是擴權自動修復。新版後新 incident 的批准結果會落到 Telegram / DB / AwoooP 同一份 outcome歷史全量補發需另開 backfill避免一次洗版。
**T152 Ansible runtime readiness surfaced2026-05-24 台北)**