Compare commits

..

4 Commits

Author SHA1 Message Date
jiantw83 c836ec08e4 chore: triage log output suggestions 2026-05-15 15:45:08 +00:00
AI Review Bot acb3604cda chore: update ai-review findings [ai-review-bot][success] 2026-05-15 15:34:01 +00:00
jiantw83 38a3349e4f chore: refine pipeline stage logs 2026-05-15 15:32:43 +00:00
AI Review Bot 4e586158a5 chore: update ai-review findings [ai-review-bot][success] 2026-05-15 15:31:48 +00:00
5 changed files with 32 additions and 6 deletions
+10
View File
@@ -329,5 +329,15 @@
"role": "Leo",
"location": "action.yaml:80",
"suggestion": "在 `runs.env` 區塊中,`GITEA_TOKEN` 只從 `inputs` 取得,而 `GITEA_SERVER_URL` 和 `GITEA_REPOSITORY` 仍保留從 `gitea context` 取得的備用機制,這是刻意設計的差異,不是維護缺陷。"
},
{
"role": "Rex",
"location": "action.yaml:18",
"suggestion": "引入 `GITEA_COMMENT_TOKEN` 是一個很好的實踐,遵循最小權限原則。請確保為此 token 配置的權限確實僅限於發布評論。同時,與 `GITEA_TOKEN` 相似,建議使用者始終從 workflow 的 secrets context 傳遞此 token,以避免硬編碼敏感資料。"
},
{
"role": "Leo",
"location": "app/log.js",
"suggestion": "考慮在日誌訊息中加入時間戳記,這有助於追蹤事件發生的順序,尤其是在長時間運行的程序或需要詳細調試時。可以在每個日誌函式內部自動添加時間戳記。"
}
]
+14
View File
@@ -5,5 +5,19 @@
"location": "action.yaml:18",
"suggestion": "引入 GITEA_COMMENT_TOKEN 是一個很好的實踐,遵循最小權限原則。請確保為此 token 配置的權限確實僅限於發布評論。同時,與 GITEA_TOKEN 類似,建議使用者始終從 workflow 的 secrets context 傳遞此 token,以避免硬編碼敏感資料。",
"is_new": false
},
{
"level": "info",
"role": "Leo",
"location": "app/log.js",
"suggestion": "考慮在日誌訊息中加入時間戳記,這有助於追蹤事件發生的順序,尤其是在長時間運行的程序或需要詳細調試時。可以在每個日誌函式內部自動添加時間戳記。",
"is_new": false
},
{
"level": "info",
"role": "Leo",
"location": "app/log.js:19",
"suggestion": "在 `warn` 函式中使用 `console.warn` 而非 `console.log`。雖然目前功能相同,但 `console.warn` 在某些環境下(例如瀏覽器開發者工具)會以不同的樣式呈現警告訊息,有助於區分不同嚴重程度的日誌。",
"is_new": false
}
]
+5 -1
View File
@@ -185,12 +185,16 @@ describe('commitAndPush', () => {
});
const logs = [];
const originalLog = console.log;
console.log = (...args) => { logs.push(args.join(' ')); };
const originalWarn = console.warn;
const capture = (...args) => { logs.push(args.join(' ')); };
console.log = capture;
console.warn = capture;
try {
await commitAndPush(workspace, repoDir, spawn, sourceRoot);
} finally {
console.log = originalLog;
console.warn = originalWarn;
}
assert.ok(logs.some(line => line.includes('Step7 commit 成功但 push 失敗')));
+1 -1
View File
@@ -15,7 +15,7 @@ export function ok(message) {
}
export function warn(message) {
console.log(` ! ${message}`);
console.warn(` ! ${message}`);
}
export function error(message) {
+2 -4
View File
@@ -76,7 +76,7 @@ async function main() {
}
ok(`Step2 完成: 新 findings 總計 ${newFindings.length}`);
step('Step3', 'Findings 合併');
step('Step3', 'Findings 合併與語意去重');
let repoDir;
try {
repoDir = cloneRepo(WORKSPACE);
@@ -90,11 +90,9 @@ async function main() {
const oldFindings = loadOldFindings(repoDir || WORKSPACE);
const mergedFindings = mergeFindings(oldFindings, newFindings);
ok(`Step3 merged findings total=${mergedFindings.length}`);
step('Step3b', 'AI 語意去重');
const deduped = await deduplicateWithAI(mergedFindings);
const sorted = sortByLevel(deduped);
ok(`Step3b dedup findings total=${sorted.length} (critical=${sorted.filter(f=>f.level==='critical').length} warning=${sorted.filter(f=>f.level==='warning').length} info=${sorted.filter(f=>f.level==='info').length})`);
ok(`Step3 去重完成: ${mergedFindings.length} -> ${sorted.length} (critical=${sorted.filter(f=>f.level==='critical').length} warning=${sorted.filter(f=>f.level==='warning').length} info=${sorted.filter(f=>f.level==='info').length})`);
step('Step4', 'AI 排除問題過濾');
const exclusions = loadExclusions(repoDir || WORKSPACE, repoState);