chore(ai-review): 更新 findings 與 exclusions 解決狀態
CI / AI Code Review (pull_request) Failing after 40s

This commit is contained in:
Jeffery
2026-06-26 14:03:48 +08:00
parent 5e0dc865b2
commit af4bb899e6
2 changed files with 24 additions and 49 deletions
+24
View File
@@ -28,5 +28,29 @@
"role": "Rogue",
"original_finding": "run 函式 maxBuffer 設為 64MBgit diff 內容極大時易引發 OOM,建議改用 stream。",
"reason": "run() 採同步 spawnSync 為刻意設計(所有呼叫端皆同步取用 result.stdout);maxBuffer 為上限保護而非預先配置,僅在輸出達該量時才佔用;傳給 opencode 的 diff 已於 index.js 以 maxDiffChars 截斷。改為 stream 屬大規模架構重構,牽涉設計取捨。"
},
{
"location": "app/lib/git.js:39, 52",
"role": "Mage",
"original_finding": "多次使用 `git config --global` 修改全域設定,可能導致 ~/.gitconfig 無限膨脹、污染環境;safe.directory 使用萬用字元 `*` 過於寬鬆,建議改用 --local。",
"reason": "action 於每次執行皆在全新且即拋的 Docker 容器內運行,~/.gitconfig 不跨執行保留,無「無限膨脹」問題。safe.directory 基於安全考量 git 刻意忽略 repo-local 設定,必須寫在 global/system,無法改用 `--local`;在 owner 不可預期的 CI checkout 工作區使用 `*` 是 runner 的標準做法(如 actions/checkout 亦同)。user.name/email 已使用 --local。"
},
{
"location": "app/index.js:183",
"role": "Assassin",
"original_finding": "錯誤處理中的 maskSecrets 基於字串取代,可能無法處理所有 Token 變體導致敏感資訊洩漏;建議禁止輸出原始錯誤物件。",
"reason": "maskSecrets 以子字串比對取代,能涵蓋 token 出現於錯誤訊息的各處(含 URL 內嵌 `oauth2:<token>@`),實際洩漏向量(http.extraheader 帶入的原始 token)已被遮蔽。URL 編碼/base64 變體不會出現在本專案的錯誤路徑;完全禁止輸出 err.stack 會嚴重損及 CI 除錯能力,取捨上以遮蔽 token 為宜。"
},
{
"location": "app/index.js:7",
"role": "Leo",
"original_finding": "函式 main() 承擔過多責任,違反單一職責原則,建議抽離 ConflictManager 並封裝 Gitea API 互動。",
"reason": "屬主觀重構偏好而非缺陷;程式已分層為 GitGiteaClientOpenCode 三個職責清楚的類別,main() 僅負責編排流程,長度與複雜度可控,無立即重構必要。"
},
{
"location": "app/index.js:37",
"role": "Rogue",
"original_finding": "在 ahead 為 0 時,仍執行昂貴的 diff 採集與分析;建議先執行 countAheadCommits,若 ahead === 0 則直接終止。",
"reason": "現有程式已於 `countAheadCommits` 後立即檢查,`if (ahead === 0) { ...; return; }`index.js:28-32)早於 diff 採集(index.js:36 起)就終止,與建議行為一致,屬誤報。"
}
]