Skip to content

Commit fa12eae

Browse files
cliffhallclaude
andcommitted
test(memory): make the #4827 mode test umask-independent; add index.ts header
Pick the hardened mode so it always differs from a new file's mode, so the characterization holds under a restrictive umask such as 077. Add the purpose header AGENTS.md asks of a substantially rewritten source file. Part of #4854 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent b2610cb commit fa12eae

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎src/memory/__tests__/persistence.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,14 @@ describe("memory persistence over the protocol", () => {
273273
return (await fs.stat(file)).mode & 0o777;
274274
}
275275

276-
it("replaces a 0600 graph file's mode with a new file's mode", async () => {
276+
it("replaces a hardened graph file's mode with a new file's mode", async () => {
277277
const { client } = await open();
278278
await call(client, "create_entities", { entities: [alice] });
279-
await fs.chmod(filePath, 0o600);
279+
// 0600 as in the issue, unless the umask already makes new files 0600;
280+
// the original mode must differ from a new file's for the loss to show.
280281
const expected = await newFileMode();
281-
expect(expected).not.toBe(0o600);
282+
const original = expected === 0o600 ? 0o640 : 0o600;
283+
await fs.chmod(filePath, original);
282284

283285
await call(client, "create_entities", { entities: [bob] });
284286

‎src/memory/index.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env node
22

3+
// The memory server: a knowledge graph of entities, relations and
4+
// observations, persisted as JSONL and served over MCP as nine tools and one
5+
// subscribable resource. createServer() builds a server over a graph file so
6+
// tests can run it in-process; main() connects it to stdio, and runs only
7+
// when this file is the process entry point, so importing it starts nothing.
8+
39
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
410
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
511
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";

0 commit comments

Comments
 (0)