fix(awooop): expose quality summary aggregate
All checks were successful
Code Review / ai-code-review (push) Successful in 16s
CD Pipeline / tests (push) Successful in 1m7s
CD Pipeline / build-and-deploy (push) Successful in 3m27s
CD Pipeline / post-deploy-checks (push) Successful in 1m32s

This commit is contained in:
Your Name
2026-05-13 16:33:46 +08:00
parent 94fc25dc39
commit 356bfce2c8
2 changed files with 11 additions and 8 deletions

View File

@@ -22,24 +22,26 @@ router = APIRouter()
"/truth-chain/quality/summary", "/truth-chain/quality/summary",
summary="查詢 AI 自動化品質總覽", summary="查詢 AI 自動化品質總覽",
description=( description=(
"T12c read-only endpoint. 聚合最近 incident 的 automation quality gate" "T12c read-only aggregate endpoint. 聚合最近 incident 的 automation quality gate"
"讓 Operator 不必逐張 Telegram 卡片判斷是否真正完成 AI 自動修復。" "讓 Operator 不必逐張 Telegram 卡片判斷是否真正完成 AI 自動修復。"
"此總覽不回傳逐筆 examplessource-level truth-chain 詳情仍需 operator auth。"
), ),
) )
async def get_automation_quality_summary( async def get_automation_quality_summary(
project_id: str = Query("awoooi", description="租戶 ID"), project_id: str = Query("awoooi", description="租戶 ID"),
hours: int = Query(24, ge=1, le=168, description="回看小時數"), hours: int = Query(24, ge=1, le=168, description="回看小時數"),
limit: int = Query(200, ge=1, le=500, description="最多評估 incident 數"), limit: int = Query(200, ge=1, le=500, description="最多評估 incident 數"),
operator: AwoooPOperatorPrincipal = Depends(verify_awooop_operator),
) -> dict[str, Any]: ) -> dict[str, Any]:
# The operator dependency gates this summary because it aggregates incident summary = await fetch_automation_quality_summary(
# lifecycle state across alert, execution, and notification tables.
_ = operator
return await fetch_automation_quality_summary(
project_id=project_id, project_id=project_id,
hours=hours, hours=hours,
limit=limit, 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( @router.get(

View File

@@ -7461,8 +7461,8 @@ awoooi-api / awoooi-worker / awoooi-web successfully rolled out
health: health:
https://awoooi.wooo.work/api/v1/health -> 200 https://awoooi.wooo.work/api/v1/health -> 200
route auth smoke: route visibility note:
GET /api/v1/platform/truth-chain/quality/summary?project_id=awoooi&hours=24&limit=1 -> 401 Operator authentication required T12d 後此 summary endpoint 改為 read-only aggregate不回傳 examplessource-level `/truth-chain/{source_id}` 仍需 operator auth。
production summary service smoke, hours=24, limit=50: production summary service smoke, hours=24, limit=50:
schema_version=automation_quality_summary_v1 schema_version=automation_quality_summary_v1
@@ -7511,6 +7511,7 @@ top gate_failures:
- 只讀,不觸發任何修復動作 - 只讀,不觸發任何修復動作
- 新增 `awooop.home.quality` 雙語字典,新增文字都走 `next-intl` - 新增 `awooop.home.quality` 雙語字典,新增文字都走 `next-intl`
- UI 使用 Lucide `ShieldCheck`,沒有新增 emoji icon 或 mock data。 - 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** **local verification**