diff --git a/src/queue/processors.ts b/src/queue/processors.ts index 509b2c717..c0ebb5c27 100644 --- a/src/queue/processors.ts +++ b/src/queue/processors.ts @@ -3817,6 +3817,7 @@ export async function runAiReviewForAdvisory( headSha: args.advisory.headSha, baseSha: args.pr.baseSha ?? null, title: args.pr.title, + body: args.pr.body ?? undefined, author: args.author, githubToken: isReesGithubTokenForwardingEnabled(env) ? await resolveReviewEnrichmentGithubToken( diff --git a/src/review/enrichment-wire.ts b/src/review/enrichment-wire.ts index e0bb183e9..938235dbb 100644 --- a/src/review/enrichment-wire.ts +++ b/src/review/enrichment-wire.ts @@ -135,13 +135,21 @@ function headShaPrefix(headSha: string | null | undefined): string | undefined { return text ? text.slice(0, 12) : undefined; } +export interface EnrichmentLinkedIssue { + number: number; + title?: string; + body?: string; +} + interface EnrichmentInput { repoFullName: string; prNumber: number; headSha: string | null; baseSha?: string | null; title?: string | undefined; + body?: string | undefined; author?: string | null | undefined; + linkedIssue?: EnrichmentLinkedIssue | undefined; githubToken?: string | undefined; files: PullRequestFileRecord[]; diff: string; @@ -232,7 +240,9 @@ export async function buildReviewEnrichment( headSha: input.headSha, baseSha: input.baseSha ?? null, title: input.title, + ...(input.body ? { body: input.body } : {}), author: input.author ?? undefined, + ...(input.linkedIssue ? { linkedIssue: input.linkedIssue } : {}), ...(input.githubToken ? { githubToken: input.githubToken } : {}), files: input.files.map((file) => ({ path: file.path, diff --git a/test/unit/enrichment-wire.test.ts b/test/unit/enrichment-wire.test.ts index 0e5ea5c19..33c85db7c 100644 --- a/test/unit/enrichment-wire.test.ts +++ b/test/unit/enrichment-wire.test.ts @@ -83,6 +83,7 @@ describe("buildReviewEnrichment", () => { { ...input, baseSha: "baseabc", + body: "Fixes #12", author: "alice", githubToken: "gh-read-token", }, @@ -106,6 +107,7 @@ describe("buildReviewEnrichment", () => { const body = JSON.parse(calls[0]!.init.body as string); expect(body.repoFullName).toBe("o/r"); expect(body.baseSha).toBe("baseabc"); + expect(body.body).toBe("Fixes #12"); expect(body.author).toBe("alice"); expect(body.githubToken).toBe("gh-read-token"); expect(body.analyzers).toBeUndefined(); diff --git a/test/unit/enrichment-wiring.test.ts b/test/unit/enrichment-wiring.test.ts index fc6d020a4..28aeb81d4 100644 --- a/test/unit/enrichment-wiring.test.ts +++ b/test/unit/enrichment-wiring.test.ts @@ -92,6 +92,7 @@ describe("review-enrichment wired into the processors review (flag GITTENSORY_RE analyzers?: string[]; baseSha?: string | null; author?: string; + body?: string; githubToken?: string; }; } = {}; @@ -105,6 +106,7 @@ describe("review-enrichment wired into the processors review (flag GITTENSORY_RE analyzers?: string[]; baseSha?: string | null; author?: string; + body?: string; githubToken?: string; }; return new Response( @@ -141,6 +143,7 @@ describe("review-enrichment wired into the processors review (flag GITTENSORY_RE ]); expect(reesRequest.body?.baseSha).toBe("base7"); expect(reesRequest.body?.author).toBe("alice"); + expect(reesRequest.body?.body).toBe("Implements the thing."); expect(reesRequest.body?.githubToken).toBe("public-read-token"); // The brief's content flows into the user prompt, but the system prompt carries our FIXED // enrichment suffix — the REES-supplied systemSuffix is untrusted and is never spliced in. diff --git a/vitest.config.ts b/vitest.config.ts index 55616f191..4bfc37706 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -26,7 +26,7 @@ export default defineConfig({ ...(junitPath ? { outputFile: { junit: junitPath } } : {}), coverage: { provider: "v8", - include: ["src/**/*.ts"], + include: ["src/**/*.ts", "review-enrichment/src/analyzers/codeowners.ts"], exclude: ["src/env.d.ts", "apps/**"], // Emit lcov for Codecov to compute patch (changed-lines) coverage. reporter: ["text", "lcov"],