feat(awooop): mirror AI alert card metadata
This commit is contained in:
@@ -1,3 +1,28 @@
|
||||
## 2026-06-25|AwoooP mirror 事件卡 metadata 讀回基礎
|
||||
|
||||
**背景**:Wazuh Dashboard/API 讀回退化事件卡已能把 raw 429/500 轉成 `ai_automation_alert_card_v1`,但若 AwoooP outbound mirror 只保存一般文字,後續 delivery receipt 與 timeline 仍難以用結構化方式查詢 Wazuh lane / gate。
|
||||
|
||||
**完成**:
|
||||
- `TelegramGateway._outbound_source_envelope()` 會在 normalized 事件卡送出後,補 `ai_automation_alert_card_mirror_v1` metadata。
|
||||
- metadata 僅保存 `event_type`、`lane`、`target`、`gates`、`runtime_write_gate_count=0`、`delivery_receipt_readback_required=true` 與 mirror source。
|
||||
- `source_refs.alert_ids` 與 `source_refs.fingerprints` 會加入事件卡索引,讓 AwoooP timeline / delivery receipt 後續可用 structured ref 查 Wazuh 事件。
|
||||
- 文件同步補上 mirror envelope 規則:不得保存 raw alert、完整 Telegram text、token、內網 URL、主機路徑或 raw Wazuh payload。
|
||||
|
||||
**驗證**:
|
||||
- `DATABASE_URL=postgresql://postgres:postgres@localhost:5432/awoooi_test pytest apps/api/tests/test_telegram_gateway_error_sanitizer.py apps/api/tests/test_telegram_message_templates.py -q`:`79 passed`。
|
||||
- `python3 scripts/security/telegram-alert-readability-guard.py --root .`:`tests=11 ai_lanes=7 host_lanes=6 runtime_gate=0`。
|
||||
- `python3 scripts/security/security-mirror-progress-guard.py --root .`:通過。
|
||||
- `python3 -m py_compile apps/api/src/services/telegram_gateway.py`:通過。
|
||||
- `git diff --check`:通過。
|
||||
|
||||
**完成度同步**:
|
||||
- AwoooP mirror 事件卡 metadata source-side:`100%`。
|
||||
- Wazuh P0-D delivery receipt readiness:`70% -> 82%` source-side、`0%` production receipt。
|
||||
- SOC / Wazuh no-false-green 納管:`52% -> 56%`。
|
||||
- Telegram 實發、AwoooP live outbound readback、IwoooS production live metadata、Wazuh registry 驗收:仍維持 `0%`。
|
||||
|
||||
**邊界**:本輪沒有送 Telegram、沒有新增 runtime route、沒有 DB migration、沒有 Wazuh / host / Nginx / Docker / firewall / secret 寫入,沒有把工作視窗對話放進文件或前端。
|
||||
|
||||
## 2026-06-25|Wazuh Dashboard/API 讀回退化事件卡分支同步
|
||||
|
||||
**背景**:Wazuh 用戶端消失事故仍不能用 Dashboard 畫面當成 registry truth。本段只同步上一段 source-side 事件卡與 no-false-green guard 的 Gitea 分支狀態,避免另一個工作視窗重複修改或以舊分支為準。
|
||||
|
||||
@@ -162,6 +162,7 @@ Live 2026-05-12 evidence shows this gate is not yet green:
|
||||
- `append_incident_update()` 對同一 incident 的相同狀態做 5 分鐘 Redis 去重。
|
||||
- `append_incident_update()` 對相同的「AI 自動修復失敗 / AI 診斷工具失敗」摘要增加 10 分鐘跨 incident 去重;每個 incident 仍會移除原卡危險按鈕,但 Telegram 不再重複 reply 同一個失敗摘要。
|
||||
- `TelegramGateway._send_request()` 對成功送出的 legacy `sendMessage` 增加 AwoooP `awooop_outbound_message` 鏡像。鏡像失敗只記錄 `telegram_outbound_mirror_failed`,不能影響 Telegram 正常送達。
|
||||
- `ai_automation_alert_card_v1` 送出後,AwoooP mirror envelope 需帶 `ai_automation_alert_card_mirror_v1` metadata,至少包含 `event_type`、`lane`、`target`、`gates`、`runtime_write_gate_count=0` 與 `delivery_receipt_readback_required=true`;不得把 raw alert、完整 Telegram text、token、內網 URL、主機路徑或 raw Wazuh payload 放進 envelope。
|
||||
- 成本告警、審批執行結果、自愈 rollback 提案已由 direct Bot API 改走 `TelegramGateway._send_request()`,避免繞過 outbound mirror。
|
||||
- `telegram_gateway.py` 內部歷史直打 `sendMessage` 路徑已收斂;多 Bot `_send_as_bot()` 因需指定 token 保留 direct HTTP,但成功後同樣鏡像到 `awooop_outbound_message`。
|
||||
- 既有 `詳情 / 重診 / 歷史` 按鈕保留,讓 Telegram 保持輕量,細節回到控制台。
|
||||
|
||||
Reference in New Issue
Block a user