Skip to content
1 change: 1 addition & 0 deletions src/queue/processors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions src/review/enrichment-wire.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions test/unit/enrichment-wire.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ describe("buildReviewEnrichment", () => {
{
...input,
baseSha: "baseabc",
body: "Fixes #12",
author: "alice",
githubToken: "gh-read-token",
},
Expand All @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions test/unit/enrichment-wiring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
} = {};
Expand All @@ -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(
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
Loading