feat(awooop): 新增 truth-chain 查詢 API
All checks were successful
Code Review / ai-code-review (push) Successful in 10s
CD Pipeline / tests (push) Successful in 1m16s
CD Pipeline / build-and-deploy (push) Successful in 3m29s
CD Pipeline / post-deploy-checks (push) Successful in 1m19s

This commit is contained in:
Your Name
2026-05-12 22:55:36 +08:00
parent 56228dbb79
commit f7c84530d6
7 changed files with 777 additions and 0 deletions

View File

@@ -366,6 +366,8 @@ source_event_received
| T4 Drift fingerprint FSM | Drift 不再每小時新增不可辨識卡;同 fingerprint 更新 repeat_count / status / PR / adopt / rollback / ignore | `awoooi-prod HIGH=1 MEDIUM=30` 同組 12h 只更新同一 truth chain |
| T5 Incident status reconciliation | approval、incident、evidence、execution、timeline 狀態一致NO_ACTION 必須是明確 manual_required 或 resolved(noop) | B6C589 類事件不得再出現 incident investigating + approval approved/resolved + no execution/verification 的矛盾 |
**T0 first implementation2026-05-12 22:50 台北)**:新增 read-only `GET /api/v1/platform/truth-chain/{source_id}`,由 Operator Console auth 保護,聚合 incident / drift / approval / evidence / legacy MCP / AwoooP MCP Gateway / automation_operation_log / KM / timeline / outbound mirror。此 endpoint 只揭露現況與缺口,不改任何 incident、approval、execution 或 Telegram state。
**當前紅線**:在 T0-T2 未完成前,任何「中低風險告警已有 AI 自動修復」都只能逐案查證不能全域宣稱。Telegram 卡片必須誠實顯示 degraded / failed / pending_human而不是只顯示 AI 研判摘要。
---
@@ -1818,6 +1820,24 @@ Phase 6 完成後
---
### 2026-05-12 晚 (台北) — T0 truth-chain read API — 第一版查詢端點落地
**範圍**
- 新增 `services/awooop_truth_chain_service.py`read-only 聚合 incident / drift / approval / evidence / legacy MCP / AwoooP MCP Gateway / automation_operation_log / KM / timeline / outbound mirror。
- 新增 `api/v1/platform/truth_chain.py``GET /api/v1/platform/truth-chain/{source_id}`,沿用 Operator Console auth。
- `api/v1/platform/__init__.py` 掛載 router`test_platform_router_order.py` 補 route 註冊檢查;新增 `_truth_status` 單元測試。
**設計邊界**
- 只讀,不修改 incident、approval、execution、Telegram 或 drift 狀態。
- 若 outbound mirror 在 RLS context 下不可見API 會明確回傳 visibility note不假裝資料存在。
- Ansible 在 truth-chain 中先標示為 `not_used_reason`,直到 T3 declarative executor 有 first-class audit record。
**驗證**
- `python -m py_compile apps/api/src/services/awooop_truth_chain_service.py apps/api/src/api/v1/platform/truth_chain.py` 通過。
- `DATABASE_URL='postgresql+asyncpg://awoooi:awoooi_test_2026@localhost:5432/awoooi_test?ssl=disable' python -m pytest apps/api/tests/test_awooop_truth_chain_service.py apps/api/tests/test_platform_router_order.py apps/api/tests/test_awooop_operator_auth.py`10 passed。
---
### 2026-04-20 晚 (台北) — C1-C4 全流程串接 — Playbook 鏈路保護commit de2d34d
**觸發**:統帥全景盤查 AI 自動化節點後,發現 Playbook 自動修復鏈路有 3 個結構性斷點。