From fe97772c47c3b93029f386c4db5cb99bfde032ad Mon Sep 17 00:00:00 2001 From: ghost <49853598+JSONbored@users.noreply.github.com> Date: Tue, 7 Jul 2026 01:12:42 -0700 Subject: [PATCH] fix(review): wire category tally into unified comments --- src/review/unified-comment-bridge.ts | 1 + src/review/unified-comment.ts | 2 ++ test/unit/finding-category-collapsible.test.ts | 9 ++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/review/unified-comment-bridge.ts b/src/review/unified-comment-bridge.ts index 7b1126180c..441c71a579 100644 --- a/src/review/unified-comment-bridge.ts +++ b/src/review/unified-comment-bridge.ts @@ -666,6 +666,7 @@ export function buildUnifiedCommentBody(args: UnifiedCommentBridgeArgs): string ...(args.merged !== undefined ? { merged: args.merged } : {}), ...(args.reviewEffort !== undefined ? { reviewEffort: args.reviewEffort } : {}), ...(args.maxFindingsCaps !== undefined ? { maxFindingsCaps: args.maxFindingsCaps } : {}), + ...(args.findingCategories !== undefined ? { inlineFindings: args.findingCategories } : {}), }); // The gate already produced 0/1 reviewer notes from a synthesis of the model pair; reflect the caller's // actual reviewer count (for the chip + the "N reviewers, synthesized" evidence) without re-deriving it. diff --git a/src/review/unified-comment.ts b/src/review/unified-comment.ts index 6fb6ea2b2a..7a1ab184f0 100644 --- a/src/review/unified-comment.ts +++ b/src/review/unified-comment.ts @@ -701,6 +701,7 @@ export function buildUnifiedReviewInput(opts: { reviewEffort?: { band: 1 | 2 | 3 | 4 | 5; minutes: number }; maxFindingsCaps?: { blockers: number | null; nits: number | null }; linkedIssueSatisfaction?: { status: "addressed" | "partial" | "unaddressed"; rationale: string }; + inlineFindings?: ReadonlyArray<{ category?: UnifiedFindingCategory | undefined }>; }): UnifiedReviewInput { const ex = extractReviewSummary(opts.reviews); const changedFiles = typeof opts.changedFiles === "number" ? opts.changedFiles : opts.changedFiles.length; @@ -720,6 +721,7 @@ export function buildUnifiedReviewInput(opts: { ...(opts.reviewEffort !== undefined ? { reviewEffort: opts.reviewEffort } : {}), ...(opts.maxFindingsCaps !== undefined ? { maxFindingsCaps: opts.maxFindingsCaps } : {}), ...(opts.linkedIssueSatisfaction !== undefined ? { linkedIssueSatisfaction: opts.linkedIssueSatisfaction } : {}), + ...(opts.inlineFindings !== undefined ? { inlineFindings: opts.inlineFindings } : {}), }; } diff --git a/test/unit/finding-category-collapsible.test.ts b/test/unit/finding-category-collapsible.test.ts index 7fffcd3a4c..257dbe60af 100644 --- a/test/unit/finding-category-collapsible.test.ts +++ b/test/unit/finding-category-collapsible.test.ts @@ -86,19 +86,22 @@ describe("buildUnifiedCommentBody findingCategories wiring (#1958)", () => { footerMarkdown: footer, }; - it("appends the Finding categories section when findingCategories is present + non-empty", () => { + it("appends both category summaries when findingCategories is present + non-empty", () => { const body = buildUnifiedCommentBody({ ...base, findingCategories: findings }); + expect(body).toContain("**Findings by category:** 1 security"); expect(body).toContain("Finding categories"); expect(body).toContain("| Security | 1 |"); }); - it("does NOT add a Finding categories section when findingCategories is absent (flag-OFF parity)", () => { + it("does NOT add category summaries when findingCategories is absent (flag-OFF parity)", () => { const body = buildUnifiedCommentBody(base); + expect(body).not.toContain("Findings by category"); expect(body).not.toContain("Finding categories"); }); - it("does NOT add a Finding categories section when findingCategories is empty", () => { + it("does NOT add category summaries when findingCategories is empty", () => { const body = buildUnifiedCommentBody({ ...base, findingCategories: [] }); + expect(body).not.toContain("Findings by category"); expect(body).not.toContain("Finding categories"); });