refactor(api): Phase 16 R3.4 完整 Repository 層整合

- incident_repository: 新增 get_status(), update_status() 方法
- incidents.py: feedback + debug 端點全面改用 Repository
- 消除所有 Router 層直接 DB 存取 (符合積木化鐵律)
- trust_engine.py: 修復 import 順序 lint 警告
- pre-commit hook: 修正誤判問題 (排除刪除行+註解行)
- LOGBOOK: 更新 Phase 16 完成狀態

驗證結果: 31/31 測試通過

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-03-25 23:47:01 +08:00
parent e0584bc181
commit 2fb011470e
5 changed files with 511 additions and 62 deletions

View File

@@ -19,20 +19,19 @@ Phase 3.2: Progressive Autonomy
import logging
from dataclasses import dataclass, field
from datetime import datetime
# from enum import Enum # Phase 16 R2: 不再需要RiskLevel 改從 models 導入
from typing import Literal
# Phase 16 R2 (2026-03-25): RiskLevel 統一改從 models/approval.py 導入
# 原因: 消除重複定義,統一風險等級來源
# 執行者: Claude Code
# 回滾: 取消註解下方 RiskLevel class 區塊,移除此 import
from src.models.approval import RiskLevel
logger = logging.getLogger(__name__)
# ==================== Types ====================
# Phase 16 R2 (2026-03-25): RiskLevel 統一改從 models/approval.py 導入
# 原因: 消除重複定義,統一風險等級來源
# 執行者: Claude Code
# 回滾: 取消註解下方區塊,移除 import
from src.models.approval import RiskLevel
# --- 以下為舊定義,已封存 (Phase 16 R2) ---
# class RiskLevel(str, Enum):
# """風險等級"""