fix(awooop): strengthen outbound truth references
All checks were successful
Code Review / ai-code-review (push) Successful in 10s
CD Pipeline / tests (push) Successful in 1m12s
CD Pipeline / build-and-deploy (push) Successful in 3m33s
CD Pipeline / post-deploy-checks (push) Successful in 1m15s

This commit is contained in:
Your Name
2026-05-13 12:04:26 +08:00
parent 7d506b785d
commit 7fa9f743dd
6 changed files with 102 additions and 2 deletions

View File

@@ -7251,3 +7251,57 @@ scope=write
- T11 已部署Operator Run Detail 與 Telegram detail formatter 都已能呈現 MCP Gateway 摘要。
- 這次沒有發送真實 Telegram 測試訊息,避免洗版;改以 production pod 直接呼叫 detail formatter 驗證。
- 目前整體進度更新:約 68%。
### 2026-05-13 — AwoooP truth-chain T12aTelegram outbound 可回放關聯強化local green
**production live audit 摘要**
```text
24h:
incidents=150
approval_records=102
alert_operation_log=682
timeline_events=154
incident_evidence=130
auto_repair_executions=10
knowledge_entries=42
legacy_mcp_audit_log=1265
awooop_mcp_gateway_audit=1365
awooop_outbound_message=420
outbound_quality:
total=420 redacted=226 envelope=420 envelope_schema=226 with_run=420 sent_at=0
incident_join_quality:
total=150 with_aol=100 with_evidence=102 with_legacy_mcp=102 with_timeline=102 with_approval=102 with_auto_repair=10
Sentry / SignOz durable event tables:
none found by information_schema table_name ILIKE '%sentry%' OR '%signoz%'
```
**判讀**
- MCP / SignOz 能力已有實際使用,且 legacy MCP bridge 已寫入 AwoooP Gateway audit。
- 仍不能宣稱完整 AI 自動修復24h incident 150 筆中只有 10 筆有 `auto_repair_executions`
- Telegram outbound mirror 有資料,但 `sent_at=0` 是真缺口source envelope 也缺少 structured source refstruth-chain 只能靠 `content_preview ILIKE` 猜關聯。
**變更**
- `record_outbound_message()``send_status='sent'` 時寫入 `sent_at=NOW()`
- Telegram outbound `source_envelope` 新增 `source_refs.incident_ids``source_refs.code_refs`,保留 redaction-friendly 關聯錨點。
- truth-chain outbound 查詢支援 structured `source_refs`,不只靠 preview 文字搜尋。
**local verification**
```text
DATABASE_URL=postgresql+asyncpg://u:p@localhost:5432/db python -m pytest tests/test_telegram_gateway_error_sanitizer.py tests/test_channel_hub_grouped_alert_events.py tests/test_awooop_truth_chain_service.py tests/test_telegram_adr050.py -q
51 passed
python -m ruff check --select F821 src/services/channel_hub.py src/services/telegram_gateway.py src/services/awooop_truth_chain_service.py tests/test_telegram_gateway_error_sanitizer.py tests/test_channel_hub_grouped_alert_events.py tests/test_telegram_adr050.py
All checks passed
python -m py_compile src/services/channel_hub.py src/services/telegram_gateway.py src/services/awooop_truth_chain_service.py tests/test_telegram_gateway_error_sanitizer.py tests/test_channel_hub_grouped_alert_events.py tests/test_telegram_adr050.py
OK
```
**目前整體進度**:約 69%。