Skip to content

Commit 802c225

Browse files
cliffhallclaude
andcommitted
test(filesystem): mark the tests that pin known bugs
The filesystem suites are characterization tests: they assert what the server does today so the SDK v2 migration can prove it changed nothing. Some of those assertions pin behavior that is wrong. Each such test now carries a uniform marker directly above it (or above its describe when every test in the block pins the same bug): // KNOWN BUG #N: pins current (wrong) behavior; the fix changes this assertion. or, where no issue is filed yet: // KNOWN BUG (no issue): <what is wrong>; the fix changes this assertion. `git grep "KNOWN BUG"` now lists exactly the bug-pinning tests. Regression guards for fixed bugs, documented design (#3602, roots replace the command-line directories per the README), enhancement requests (#3402) and tests that show the server already behaves correctly (#4206, #4207) are left unmarked. Comments only; no assertion changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 3a63f52 commit 802c225

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎src/filesystem/__tests__/server-paths.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ describe("Unicode normalization", () => {
269269
},
270270
);
271271

272+
// KNOWN BUG #1970: pins current (wrong) behavior; the fix changes this assertion.
272273
// #1970: when the allowed directory's own name is NFD, an NFC spelling of
273274
// it fails the allow-list prefix check (a string comparison) before the
274275
// Unicode walk starts, on any file system.

‎src/filesystem/__tests__/server-roots.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// the command-line directories after initialize, how roots/list_changed
33
// updates them, and what happens when roots are invalid, fail or are not
44
// offered. Driven by a real Client that answers the server's roots/list
5-
// requests over the in-memory transport. Known bugs are pinned with their
6-
// issue numbers (#3602, #3204).
5+
// requests over the in-memory transport. Pins #3204 as a known bug, and
6+
// #3602's roots-replace-the-command-line behavior as the README documents it.
77

88
import fs from "fs/promises";
99
import path from "path";
@@ -157,6 +157,7 @@ describe("initial roots", () => {
157157
expect(await allowedDirectoriesOf(client)).toEqual([cliDir]);
158158
});
159159

160+
// KNOWN BUG #3204: pins current (wrong) behavior; the fix changes this assertion.
160161
// #3204: the server does not wait for the initial roots before serving
161162
// tool calls. A call that arrives while roots/list is outstanding is
162163
// checked against the command-line directories (here, none).
@@ -246,6 +247,7 @@ describe("a client without the roots capability", () => {
246247
);
247248
});
248249

250+
// KNOWN BUG (no issue): with no directories and no Roots, the initialization error the README promises is swallowed and the session stays up with nothing allowed; the fix changes this assertion.
249251
// With no directories from either source, oninitialized throws. The SDK
250252
// routes a notification handler's rejection to the server's onerror, which
251253
// the server leaves unset, so the error is invisible to the client: the

‎src/filesystem/__tests__/server-tools.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ describe("server identity and tool list", () => {
149149
});
150150
});
151151

152+
// KNOWN BUG #4841: pins current (wrong) behavior; the fix changes this assertion.
152153
// #4841: every schema declares the draft-07 dialect, from the SDK's default
153154
// zod-to-JSON-Schema target. Strict 2020-12 validators reject it.
154155
it("declares the draft-07 $schema on every input and output schema (#4841)", async () => {
@@ -495,6 +496,7 @@ describe("write_file", () => {
495496
);
496497
});
497498

499+
// KNOWN BUG #4512: pins current (wrong) behavior; the fix changes this assertion.
498500
// #4512: an overwrite goes through a temp file and a rename, so the file
499501
// gets a new inode (and loses its birthtime and hard links) every time.
500502
it("replaces the inode on overwrite, keeping the permission bits (#4512)", async () => {
@@ -509,6 +511,7 @@ describe("write_file", () => {
509511
expect(after.mode & 0o777).toBe(0o640);
510512
});
511513

514+
// KNOWN BUG #4512: pins current (wrong) behavior; the fix changes this assertion.
512515
it("severs a hard link on overwrite (#4512)", async () => {
513516
const file = path.join(dir, "linked.txt");
514517
const hardLink = path.join(dir, "hardlink.txt");
@@ -528,6 +531,7 @@ describe("write_file", () => {
528531
expect((await fs.lstat(link)).isSymbolicLink()).toBe(true);
529532
});
530533

534+
// KNOWN BUG #3199: pins current (wrong) behavior; the fix changes this assertion.
531535
// #3199: on Windows a rename over a locked file fails with EPERM. The
532536
// server reports it and removes its temp file; it does not fall back to an
533537
// in-place write. The rename is mocked, so this runs on every platform.
@@ -687,6 +691,7 @@ describe("edit_file", () => {
687691
expect(text.endsWith("`````\n\n")).toBe(true);
688692
});
689693

694+
// KNOWN BUG (no issue): any edit silently converts a CRLF file's line endings to LF; the fix changes this assertion.
690695
// The CRLF in the file is normalized away by any edit, dry run aside.
691696
it("rewrites a CRLF file with LF line endings", async () => {
692697
await fs.writeFile(file, "a\r\nb\r\n");
@@ -701,6 +706,7 @@ describe("edit_file", () => {
701706
// with leading and trailing whitespace trimmed, and reindents the
702707
// replacement. These pin its current reindentation rules.
703708
describe("whitespace-tolerant matcher (#2034)", () => {
709+
// KNOWN BUG (no issue): lines after the first lose the file's indentation when oldText's line has none; the fix changes this assertion.
704710
it("matches lines whose indentation differs from oldText", async () => {
705711
await call(client, "edit_file", {
706712
path: file,
@@ -718,6 +724,7 @@ describe("edit_file", () => {
718724
);
719725
});
720726

727+
// KNOWN BUG (no issue): a replacement line whose oldText line has no indent ignores the file's indentation; the fix changes this assertion.
721728
it("keeps relative indentation when both old and new lines are indented", async () => {
722729
await fs.writeFile(file, " if (a) {\n b();\n }\n");
723730
await call(client, "edit_file", {
@@ -764,6 +771,7 @@ describe("edit_file", () => {
764771
});
765772
});
766773

774+
// KNOWN BUG #4512: pins current (wrong) behavior; the fix changes this assertion.
767775
it("replaces the inode on edit, keeping the permission bits (#4512)", async () => {
768776
await fs.chmod(file, 0o600);
769777
const before = await fs.stat(file);
@@ -776,6 +784,7 @@ describe("edit_file", () => {
776784
expect(after.mode & 0o777).toBe(0o600);
777785
});
778786

787+
// KNOWN BUG #3199: pins current (wrong) behavior; the fix changes this assertion.
779788
it("reports a failed rename and removes the temp file (#3199)", async () => {
780789
vi.spyOn(fs, "rename").mockRejectedValueOnce(new Error("EPERM rename"));
781790
vi.spyOn(fs, "unlink").mockRejectedValueOnce(new Error("EPERM unlink"));

‎src/filesystem/__tests__/win32.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ describe("isPathWithinAllowedDirectories on win32", () => {
8585
).toBe(true);
8686
});
8787

88+
// KNOWN BUG #3527: pins current (wrong) behavior; the fix changes this assertion.
8889
// #3527: path.resolve keeps a UNC root's trailing backslash, and the prefix
8990
// check appends another, so nothing below the share matches.
9091
it("refuses a subdirectory of a UNC share allowed directory (#3527)", () => {

0 commit comments

Comments
 (0)