test: cover review edge cases and repair paths
This commit is contained in:
+6
-6
@@ -28,35 +28,35 @@ export function saveFindings(workspace, findings) {
|
||||
/**
|
||||
* 發布所有舊問題 comment(一次發布,依等級排序)
|
||||
*/
|
||||
export async function postOldFindingsComment(findings) {
|
||||
export async function postOldFindingsComment(findings, postFn = postComment) {
|
||||
const old = findings.filter(f => !f.is_new);
|
||||
if (old.length === 0) {
|
||||
console.log(' 無舊問題,跳過');
|
||||
return;
|
||||
}
|
||||
const body = `## 📋 舊有未解決問題(${old.length} 筆)\n\n${buildTable(old)}`;
|
||||
await postComment(body);
|
||||
await postFn(body);
|
||||
console.log(` ✅ 舊問題 comment 發布 (${old.length} 筆)`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 發布新問題中非 critical 的 comment(一次發布)
|
||||
*/
|
||||
export async function postNewNonCriticalComment(findings) {
|
||||
export async function postNewNonCriticalComment(findings, postFn = postComment) {
|
||||
const items = findings.filter(f => f.is_new && f.level !== 'critical');
|
||||
if (items.length === 0) {
|
||||
console.log(' 無新的非嚴重問題,跳過');
|
||||
return;
|
||||
}
|
||||
const body = `## 🔍 新發現問題(${items.length} 筆)\n\n${buildTable(items)}`;
|
||||
await postComment(body);
|
||||
await postFn(body);
|
||||
console.log(` ✅ 新問題(非嚴重)comment 發布 (${items.length} 筆)`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 每個新 critical 問題各發一個 comment
|
||||
*/
|
||||
export async function postNewCriticalComments(findings) {
|
||||
export async function postNewCriticalComments(findings, postFn = postComment) {
|
||||
const criticals = findings.filter(f => f.is_new && f.level === 'critical');
|
||||
if (criticals.length === 0) {
|
||||
console.log(' 無新的嚴重問題,跳過');
|
||||
@@ -64,7 +64,7 @@ export async function postNewCriticalComments(findings) {
|
||||
}
|
||||
for (const f of criticals) {
|
||||
const body = `## 🚨 嚴重問題\n\n${buildTable([f])}`;
|
||||
await postComment(body);
|
||||
await postFn(body);
|
||||
console.log(` ✅ 嚴重問題 comment 發布: [${f.role}] ${f.location}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user