Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";

import {
extractCloudFileContent,
extractCloudToolChangedFiles,
type ParsedToolCall,
} from "./cloudToolChanges";

Expand Down Expand Up @@ -34,6 +35,35 @@ function makeToolCalls(
return new Map(calls.map((tc, i) => [tc.toolCallId || `tc-${i}`, tc]));
}

describe("extractCloudToolChangedFiles", () => {
it("excludes plan files from changed files", () => {
const calls = makeToolCalls(
toolCall({
toolCallId: "tc-plan",
kind: "write",
locations: [
{
path: "/home/user/.claude/plans/breezy-squishing-twilight.md",
},
],
content: diffContent(
"/home/user/.claude/plans/breezy-squishing-twilight.md",
"# Plan\n\nDo stuff",
),
}),
toolCall({
toolCallId: "tc-real",
kind: "edit",
locations: [{ path: "src/app.ts" }],
content: diffContent("src/app.ts", "new code", "old code"),
}),
);
const result = extractCloudToolChangedFiles(calls);
expect(result).toHaveLength(1);
expect(result[0].path).toBe("src/app.ts");
});
});
Comment on lines 36 to +65
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Prefer parameterised tests

The test only exercises a single plan-path pattern. Per the project's convention, parameterised tests are preferred. Adding cases such as a relative .claude/plans/ path, a delete-kind plan file, and a claude/plans/ path without the leading dot (which should NOT be excluded) would give much stronger confidence in the filter's correctness.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/task-detail/utils/cloudToolChanges.test.ts
Line: 36-65

Comment:
**Prefer parameterised tests**

The test only exercises a single plan-path pattern. Per the project's convention, parameterised tests are preferred. Adding cases such as a relative `.claude/plans/` path, a `delete`-kind plan file, and a `claude/plans/` path *without* the leading dot (which should NOT be excluded) would give much stronger confidence in the filter's correctness.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


describe("extractCloudFileContent", () => {
it("returns untouched for an empty tool calls map", () => {
const result = extractCloudFileContent(new Map(), "src/app.ts");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export function extractCloudToolChangedFiles(
const path =
diff?.path ?? (kind === "move" ? destinationPath : locationPath);
if (!path) continue;
if (path.includes(".claude/plans/")) continue;

let file: ChangedFile;
if (kind === "move") {
Expand Down
Loading