fix(UX): 下架 28 個鬼魂分類按鈕 + ADR-079 Phase 5 補完計畫
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled

統帥 2026-04-14 20:00 完整 audit 揭露:
_CATEGORY_BUTTONS 28 個按鈕全死 3 天(從 2026-04-11 commit 325b3851)
- callback_data 格式全錯(3-part 不符 parser 4-part/2-part)
- grep apps/api/src 無任何 dispatch handler
- 統帥今天真踩到:點「查程序」沒反應 → 信任破壞

首席架構師裁示 (C 分級):
A. 立刻下架(本 commit):_CATEGORY_BUTTONS = {} fallback 通用按鈕
B. Phase 5 完整化(ADR-079 規劃,3-5 天,另 Sprint 實作)

保留通用按鈕(全 ):
- 批准 / 拒絕 / 靜默(4-part nonce)
- 詳情 / 歷史 / 重診(2-part info)

新增防禦性文件:
- ADR-079 — Phase 5 工作分解 + 每按鈕 checklist
- feedback_no_ghost_buttons.md(memory)— 鬼魂按鈕鐵律

設計原則永久入檔: 寧可沒按鈕,不可有死按鈕

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-14 20:19:25 +08:00
parent 094aa957b2
commit 10e3043ce8
2 changed files with 96 additions and 59 deletions

View File

@@ -1376,65 +1376,16 @@ class TelegramGateway:
alert_category: 告警類別 (ADR-071-E: 決定 TYPE-3 按鈕組合)
notification_type: 通知類型 (TYPE-1/2/3/4/4D)
"""
# TYPE-3 動態操作按鈕 (ADR-071-E)
# ADR-075: 統一用 kubernetes移除舊 k8s_workload新增 storage/external_site/alertchain_health/flywheel_health
_CATEGORY_BUTTONS: dict[str, list[tuple[str, str]]] = {
"kubernetes": [
("🔄 重啟", f"action:restart:{incident_id}"),
("📈 擴容", f"action:scale_up:{incident_id}"),
("📉 縮容", f"action:scale_down:{incident_id}"),
("⏪ 回滾", f"action:rollback:{incident_id}"),
],
"database": [
("🛑 終止慢查詢", f"action:kill_slow_query:{incident_id}"),
("🔄 清連線池", f"action:clear_conn_pool:{incident_id}"),
],
"host_resource": [
("🔍 查程序", f"action:check_process:{incident_id}"),
("🔄 重啟服務", f"action:restart_service:{incident_id}"),
("🗑 清 Log", f"action:clear_log:{incident_id}"),
],
"network": [
("🔄 重載 Nginx", f"action:reload_nginx:{incident_id}"),
("🔌 查 Port", f"action:check_port:{incident_id}"),
],
"devops_tool": [
("🔄 重啟服務", f"action:restart_service:{incident_id}"),
("📋 查 Log", f"action:check_log:{incident_id}"),
],
"storage": [
("🔄 重啟 MinIO", f"action:restart_service:{incident_id}"),
("📋 查 Log", f"action:check_log:{incident_id}"),
],
"external_site": [
("🔍 查健康狀態", f"action:check_health:{incident_id}"),
("📋 查 Log", f"action:check_log:{incident_id}"),
],
# ADR-075 新增分類按鈕 (2026-04-12 ogt)
"secops": [
("🚫 隔離資源", f"secops_isolate:{incident_id}"),
("⛔ 封鎖來源 IP", f"secops_block_ip:{incident_id}"),
("🔄 強制驅逐", f"secops_evict:{incident_id}"),
("✅ 確認授權", f"secops_authorize:{incident_id}"),
],
"business": [
("⏸️ 暫停 1h", f"action:pause_1h:{incident_id}"),
("🔍 查 SignOz", f"action:open_signoz:{incident_id}"),
("❌ 忽略", f"action:ignore:{incident_id}"),
],
"flywheel_health": [
("🔄 觸發診斷", f"flywheel_diagnose:{incident_id}"),
("📊 飛輪面板", f"action:open_flywheel:{incident_id}"),
("🔕 靜默", f"action:silence:{incident_id}"),
],
# alertchain_health → TYPE-8M → send_meta_alert不走此字典
"ai_system": [
("🔀 切換 Provider", f"action:switch_provider:{incident_id}"),
],
"ssl_cert": [
("🔐 更新憑證", f"action:renew_cert:{incident_id}"),
],
}
# 2026-04-14 Claude Sonnet 4.6 首席架構師裁示:
# 原 _CATEGORY_BUTTONS (28 個分類按鈕) 全部下架 — 信任 > 功能
# 盤查證據(統帥 2026-04-14 20:00 完整 audit:
# - callback_data 格式全錯 (3-part action:xxx:id 不符合 parser 4-part nonce / 2-part info)
# - 後端 0 個 handlergrep apps/api/src 無任何 dispatch elif 分支)
# - 從 2026-04-11 commit 325b3851 起死了 3 天
# - 統帥今天真踩到:點「查程序」沒反應 → 信任破壞
# 正式下架改用通用按鈕 (approve/reject/silence/detail/history/reanalyze)
# 補完計畫MASTER 藍圖 Phase 5「分類按鈕完整化」(另立 ADR)
_CATEGORY_BUTTONS: dict[str, list[tuple[str, str]]] = {} # 臨時空fallback 通用按鈕
# 產生 Nonce (防重放,用於寫操作)
approve_nonce = self._security.generate_callback_nonce(approval_id, "approve")