From d11239fd95df403234e5a87f517294941f6d01b4 Mon Sep 17 00:00:00 2001 From: ese111 <79190824+ese111@users.noreply.github.com> Date: Sat, 14 Nov 2026 18:04:58 +0900 Subject: [PATCH] fix(plugin): accept all review attachment mode (#9590) --- packages/plugin/src/server/provider.test.ts | 66 +++++++++++++++++++++ packages/plugin/src/server/provider.ts | 4 +- 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 packages/plugin/src/server/provider.test.ts diff --git a/packages/plugin/src/server/provider.test.ts b/packages/plugin/src/server/provider.test.ts new file mode 100644 index 000000000..7020c9a52 --- /dev/null +++ b/packages/plugin/src/server/provider.test.ts @@ -0,0 +1,66 @@ +import { describe, expect, it } from "vitest"; +import { ProviderInputSchema, type ProviderInput } from "./provider.js"; + +type ReviewMode = "uncommitted" | "base" | "all"; +type Delivery = "auto" | "steer"; + +const contextLine = { + oldLineNumber: null, + newLineNumber: 12, + type: "add", + content: "const value = 1;", +} as const; + +function reviewPrompt(mode: ReviewMode, delivery: Delivery): ProviderInput { + return { + type: "session.prompt", + sessionId: "session-1", + prompt: { + clientMessageId: "message-1", + delivery, + input: { + type: "message", + content: [ + { + type: "review", + mimeType: "application/paseo-review", + cwd: "/workspace", + mode, + baseRef: "main", + comments: [ + { + filePath: "src/index.ts", + side: "new", + lineNumber: 12, + body: "Please review this change.", + context: { + hunkHeader: "@@ -10,2 +10,3 @@", + targetLine: contextLine, + lines: [{ ...contextLine, type: "context", oldLineNumber: 11 }, contextLine], + }, + }, + ], + }, + ], + }, + }, + }; +} + +describe("Provider review attachments", () => { + it.each(["uncommitted", "base", "all"] as const)( + "preserves mode %s on an ordinary prompt", + (mode) => { + const input = reviewPrompt(mode, "auto"); + expect(ProviderInputSchema.parse(input)).toEqual(input); + }, + ); + + it.each(["uncommitted", "base", "all"] as const)( + "preserves mode %s on a steering prompt", + (mode) => { + const input = reviewPrompt(mode, "steer"); + expect(ProviderInputSchema.parse(input)).toEqual(input); + }, + ); +}); diff --git a/packages/plugin/src/server/provider.ts b/packages/plugin/src/server/provider.ts index 5b9511f1f..b928f5d16 100644 --- a/packages/plugin/src/server/provider.ts +++ b/packages/plugin/src/server/provider.ts @@ -213,7 +213,7 @@ interface ProviderReviewAttachment { type: "review"; mimeType: "application/paseo-review"; cwd: string; - mode: "uncommitted" | "base"; + mode: "uncommitted" | "base" | "all"; baseRef?: string | null; comments: Array<{ filePath: string; @@ -881,7 +881,7 @@ const providerContentSchema: z.ZodType = z.union([ type: z.literal("review"), mimeType: z.literal("application/paseo-review"), cwd: z.string(), - mode: z.enum(["uncommitted", "base"]), + mode: z.enum(["uncommitted", "base", "all"]), baseRef: z.string().nullable().optional(), comments: z.array( z