feat(ai-review comment): 行內 comment 只標註新問題,舊問題僅計入統計

This commit is contained in:
Jeffery
2026-06-23 13:51:36 +08:00
parent 8e7c859026
commit f170c36fc8
+4 -3
View File
@@ -109,8 +109,9 @@ function toReviewComment(f) {
/** /**
* 發布單一 Gitea review * 發布單一 Gitea review
* - summaryFindings 只用來統計本文數字 * - summaryFindings 只用來統計本文數字(含新舊問題)
* - commentFindings 用來產生 review comments,並依嚴重等級排序 * - commentFindings 用來產生 review comments,並依嚴重等級排序
* 只為新問題加上行內標註,舊問題(is_new === false)僅計入統計、不再重複標註檔案與行數
*/ */
export async function postFindingsReview(findings, deps = {}) { export async function postFindingsReview(findings, deps = {}) {
const { const {
@@ -120,7 +121,7 @@ export async function postFindingsReview(findings, deps = {}) {
usageSection = '', usageSection = '',
} = deps; } = deps;
const sortedComments = [...commentFindings].sort(bySeverity); const sortedComments = [...commentFindings].sort(bySeverity);
const comments = sortedComments.map(toReviewComment).filter(Boolean); const comments = sortedComments.filter(f => f.is_new !== false).map(toReviewComment).filter(Boolean);
const body = buildReviewSummary(summaryFindings, usageSection); const body = buildReviewSummary(summaryFindings, usageSection);
await postReview({ body, comments }); await postReview({ body, comments });
ok(`review 發布: summary=${summaryFindings.length} total=${sortedComments.length} commentable=${comments.length}`); ok(`review 發布: summary=${summaryFindings.length} total=${sortedComments.length} commentable=${comments.length}`);