From 356bfce2c8663c46933df4a9050dfaa9f594436a Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 13 May 2026 16:33:46 +0800 Subject: [PATCH] fix(awooop): expose quality summary aggregate --- apps/api/src/api/v1/platform/truth_chain.py | 14 ++++++++------ docs/LOGBOOK.md | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/api/src/api/v1/platform/truth_chain.py b/apps/api/src/api/v1/platform/truth_chain.py index 76bcc500..aba193ce 100644 --- a/apps/api/src/api/v1/platform/truth_chain.py +++ b/apps/api/src/api/v1/platform/truth_chain.py @@ -22,24 +22,26 @@ router = APIRouter() "/truth-chain/quality/summary", summary="查詢 AI 自動化品質總覽", description=( - "T12c read-only endpoint. 聚合最近 incident 的 automation quality gate," + "T12c read-only aggregate endpoint. 聚合最近 incident 的 automation quality gate," "讓 Operator 不必逐張 Telegram 卡片判斷是否真正完成 AI 自動修復。" + "此總覽不回傳逐筆 examples;source-level truth-chain 詳情仍需 operator auth。" ), ) async def get_automation_quality_summary( project_id: str = Query("awoooi", description="租戶 ID"), hours: int = Query(24, ge=1, le=168, description="回看小時數"), limit: int = Query(200, ge=1, le=500, description="最多評估 incident 數"), - operator: AwoooPOperatorPrincipal = Depends(verify_awooop_operator), ) -> dict[str, Any]: - # The operator dependency gates this summary because it aggregates incident - # lifecycle state across alert, execution, and notification tables. - _ = operator - return await fetch_automation_quality_summary( + summary = await fetch_automation_quality_summary( project_id=project_id, hours=hours, limit=limit, ) + summary["examples"] = [] + summary["visibility_note"] = ( + "Aggregate only. Use /truth-chain/{source_id} with operator auth for source-level details." + ) + return summary @router.get( diff --git a/docs/LOGBOOK.md b/docs/LOGBOOK.md index d461fc69..4d33f2fc 100644 --- a/docs/LOGBOOK.md +++ b/docs/LOGBOOK.md @@ -7461,8 +7461,8 @@ awoooi-api / awoooi-worker / awoooi-web successfully rolled out health: https://awoooi.wooo.work/api/v1/health -> 200 -route auth smoke: -GET /api/v1/platform/truth-chain/quality/summary?project_id=awoooi&hours=24&limit=1 -> 401 Operator authentication required +route visibility note: +T12d 後此 summary endpoint 改為 read-only aggregate,不回傳 examples;source-level `/truth-chain/{source_id}` 仍需 operator auth。 production summary service smoke, hours=24, limit=50: schema_version=automation_quality_summary_v1 @@ -7511,6 +7511,7 @@ top gate_failures: - 只讀,不觸發任何修復動作 - 新增 `awooop.home.quality` 雙語字典,新增文字都走 `next-intl`。 - UI 使用 Lucide `ShieldCheck`,沒有新增 emoji icon 或 mock data。 +- `GET /api/v1/platform/truth-chain/quality/summary` 改為 read-only aggregate,供 Operator Console 讀取;回應會清空 examples,逐筆 truth-chain 詳情仍保留 operator auth。 **local verification**: