fix(format): 剩餘 send_notification raw text 改為 ADR-075 TYPE-X 格式
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 18m11s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 18m11s
- decision_manager.py: 自動修復通知改為 TYPE-2 ├─/└─ 樹狀格式
- gitea_webhook_service.py: Code Review 通知改為 TYPE-1 格式,移除 ═══ border
至此所有 3 個外部 send_notification 呼叫者均符合 ADR-075 格式規範:
1. ai_router.py — TYPE-1 AI Provider 不可用(已於 3ce5025 修復)
2. decision_manager.py — TYPE-2 自動修復完成/失敗(本 commit)
3. gitea_webhook_service.py — TYPE-1 Code Review(本 commit)
2026-04-15 ogt + Claude Sonnet 4.6(亞太): Phase 6 format enforcement
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -865,12 +865,16 @@ async def _push_auto_repair_result(
|
||||
)
|
||||
|
||||
# Fallback: 找不到原訊息 ID(舊告警或 Redis 過期)→ 發新訊息
|
||||
# 2026-04-15 ogt: 改為 ADR-075 TYPE-2 格式(禁止 raw text)
|
||||
if not appended:
|
||||
result_icon = "✅" if success else "❌"
|
||||
result_label = "完成" if success else "失敗"
|
||||
fallback_text = (
|
||||
f"{'✅' if success else '❌'} <b>[自動修復{'完成' if success else '失敗'}]</b> "
|
||||
f"<code>{inc_id}</code>\n"
|
||||
f"對象: <code>{target[:50]}</code>\n"
|
||||
f"{status_line}"
|
||||
f"{result_icon} <b>TYPE-2 | 自動修復{result_label}</b>\n"
|
||||
"──────────────────────\n"
|
||||
f"├─ 事件: <code>{inc_id}</code>\n"
|
||||
f"├─ 對象: <code>{target[:50]}</code>\n"
|
||||
f"└─ {status_line}"
|
||||
)
|
||||
await gateway.send_notification(fallback_text)
|
||||
|
||||
|
||||
@@ -363,36 +363,27 @@ class GiteaWebhookService:
|
||||
else "🔴"
|
||||
)
|
||||
|
||||
# 2026-04-15 ogt: 改為 ADR-075 TYPE-1 格式(禁止 ═══ raw 格式)
|
||||
message_lines = [
|
||||
"═══════════════════════════",
|
||||
"🔍 GITEA CODE REVIEW",
|
||||
"═══════════════════════════",
|
||||
f"📦 {repo}",
|
||||
f"🔀 {target}",
|
||||
f"👤 @{author}",
|
||||
"───────────────────────────",
|
||||
f"{quality_emoji} <b>TYPE-1 | Gitea Code Review</b>",
|
||||
"──────────────────────",
|
||||
f"├─ 倉庫: <code>{repo}</code>",
|
||||
f"├─ 目標: <code>{target}</code>",
|
||||
f"├─ 作者: @{author}",
|
||||
]
|
||||
|
||||
if analysis:
|
||||
message_lines.extend([
|
||||
f"{quality_emoji} 品質分數: {analysis.quality_score:.0f}/100",
|
||||
])
|
||||
message_lines.append(f"├─ 品質分數: {analysis.quality_score:.0f}/100")
|
||||
if analysis.issues:
|
||||
message_lines.append(f"⚠️ 發現 {len(analysis.issues)} 個問題")
|
||||
message_lines.append(f"├─ 問題: {len(analysis.issues)} 個")
|
||||
if analysis.security_concerns:
|
||||
message_lines.append(f"🔐 {len(analysis.security_concerns)} 個安全疑慮")
|
||||
message_lines.extend([
|
||||
"───────────────────────────",
|
||||
"🧠 AI 摘要:",
|
||||
f"「{analysis.summary[:150]}」",
|
||||
])
|
||||
message_lines.append(f"├─ 安全疑慮: {len(analysis.security_concerns)} 個")
|
||||
message_lines.append(f"├─ AI 摘要: 「{analysis.summary[:150]}」")
|
||||
else:
|
||||
message_lines.append("❌ AI 分析失敗")
|
||||
message_lines.append("├─ AI 分析失敗")
|
||||
|
||||
message_lines.extend([
|
||||
"───────────────────────────",
|
||||
f"🔗 {url}",
|
||||
f"📋 Review ID: {review_id}",
|
||||
f"└─ <a href=\"{url}\">Review #{review_id}</a>",
|
||||
])
|
||||
|
||||
message = "\n".join(message_lines)
|
||||
|
||||
Reference in New Issue
Block a user