fix(governance): normalize knowledge degradation payloads
This commit is contained in:
@@ -294,6 +294,38 @@ def test_governance_alert_card_formats_knowledge_degradation() -> None:
|
||||
assert "欄位快覽" not in card
|
||||
|
||||
|
||||
def test_governance_alert_card_accepts_legacy_knowledge_degradation_payload() -> None:
|
||||
card = format_governance_alert_card(
|
||||
"knowledge_degradation",
|
||||
{
|
||||
"status": "warning",
|
||||
"stale_count": 1425,
|
||||
"total": 1856,
|
||||
"stale_ratio": 0.768,
|
||||
"threshold": 0.2,
|
||||
"stale_days": 7,
|
||||
"remediation": [
|
||||
"啟動 KM 反查與自動補齊流程",
|
||||
"關鍵服務告警自動同步到 KM 任務",
|
||||
],
|
||||
"next_step": "run_kb_growth_healthcheck",
|
||||
"automatable_work": [
|
||||
"每日檢查 ANTI_PATTERN 更新結果",
|
||||
"安排至少 2 位 owner 對 stale 條目做快速人工審核",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
assert "1425 / 1856 筆 KM" in card
|
||||
assert "陳舊 KM:1425" in card
|
||||
assert "總 KM:1856" in card
|
||||
assert "陳舊比例:76\\.8%" in card
|
||||
assert "▶️ 下一步:run\\_kb\\_growth\\_healthcheck" in card
|
||||
assert "每日檢查 ANTI\\_PATTERN 更新結果" in card
|
||||
assert "📎 *補充欄位*" not in card
|
||||
assert "? / ?" not in card
|
||||
|
||||
|
||||
def test_governance_alert_card_limits_fallback_fields() -> None:
|
||||
card = format_governance_alert_card(
|
||||
"custom_signal",
|
||||
|
||||
Reference in New Issue
Block a user