Skip to content

test(memory): pin a save's behavior when the graph file path is a symlink - #5705

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/chore/5644-memory-symlink-graph-path-tests
Nov 30, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/chore/5644-memory-symlink-graph-path-tests

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #5644

Description

Adds characterization tests for a memory graph file path that is itself a symlink, in a new file, src/memory/__tests__/graph-path-symlink.test.ts. They pin two current behaviors, driven through an SDK Client over the in-memory transport (the shared helpers.ts harness):

  1. Reads follow the link: a graph written at the link's target is read back through the link path by read_graph, and the link stays in place pointing at the same target.
  2. A save replaces the link, not its target: after create_entities through the link path, the path is a regular file holding the whole graph (old and new, also when read by a fresh server), and the link's former target is byte-for-byte unchanged. The atomic rename lands on the path itself.

No behavior change. The tests pin what the server does today and do not endorse it; whether a save should write through the link is a separate decision (the triage comment on the issue notes it may deserve one).

Adapted from the tests proposed in the issue by @reservoir-cmyk, with thanks: protocol-level through connect/call rather than KnowledgeGraphManager directly, using makeTempGraph for the temp directory, a purpose header, and the suite's existing describe.skipIf(process.platform === "win32") guard for symlink creation (as in persistence.test.ts). It also checks the link's readlink after a read and that a fresh server reads the replaced file back.

Server Details

  • Server: memory
  • Changes: tests only (__tests__/graph-path-symlink.test.ts). No tools, resources, prompts, configuration or docs change.

Motivation and Context

The README sets MEMORY_FILE_PATH to an absolute path and promises atomic saves by rename, but nothing pinned what happens when that path is a symlink, a routine setup for pointing the file at another volume. See #5644.

How Has This Been Tested?

Test-only change with no client-observable surface, so the evidence is a targeted probe: the new suite against the current v2/main code.

$ npx vitest run --root src/memory __tests__/graph-path-symlink.test.ts
 Test Files  1 passed (1)
      Tests  2 passed (2)

npm run local:gate exited 0 on the pushed head (it includes the memory suite and its per-file coverage gate).

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

(Tests only.)

Checklist

  • I have read the MCP Protocol Documentation (not applicable: no protocol surface changes)
  • My changes follow MCP security best practices (not applicable: tests only)
  • I have updated the server's README accordingly (not applicable: no documented behavior changes)
  • I have added a changeset (npm run changeset) if this changes what a TypeScript server publishes (not applicable: tests are not published)
  • I have tested this with an LLM client (not applicable: no server-facing change; targeted probe above)
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling (not applicable: tests only)
  • I have documented all environment variables and configuration options (not applicable: none added)

🤖 Generated with Claude Code

Reads follow the link to its target; a save's atomic rename replaces the
link itself with a regular file holding the whole graph, and the link's
former target is left byte-for-byte unchanged. Characterization only, no
behavior change. POSIX only, like the other symlink tests in the suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
@cliffhall cliffhall added the v2 label Nov 30, 2026
@changeset-bot

changeset-bot Bot commented Nov 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d104316

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

memory: MCP interface diff

Base: c0075947ac6b (Merge pull request #5682 from modelcontextprotocol/v2/chore/5681-python-calver-2026.11.27)
Head: the build in this checkout, at 389b930ce028 (Merge d104316 into c007594)

Diffed because it was named (--server).

✅ No interface changes detected.

Tools Prompts Resources Resource templates
Base 9 0 1 0
Head 9 0 1 0

Updated by this run for d104316e8e3b70402c60a395d076097a6aed8551.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the graph-path symlink characterization tests.

No open issues 🎉

What changed in this PR

Adds characterization tests for the memory server’s existing graph-path symlink behavior, addressing #5644 without changing production code.

Changes:

  • Verifies that reads follow the symlink and leave it pointing at the same target.
  • Verifies that saves replace the symlink with a regular file containing both entities, leave the former target unchanged, and remain readable by a fresh server.
  • Uses the shared protocol-level test harness and skips Windows, matching existing symlink tests.
File Description
src/​memory/​__tests__/​graph-path-symlink.test.ts Adds two tests pinning read and save behavior when the graph path is a symlink.

Review effort: Balanced

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot round 1: clean (no findings, no suppressed comments). The review loop stops on this first clean round; nothing was changed in response.

@cliffhall
cliffhall merged commit 73ee092 into v2/main Nov 30, 2026
48 checks passed
@cliffhall
cliffhall deleted the v2/chore/5644-memory-symlink-graph-path-tests branch November 30, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

memory: add tests for the graph file path being a symlink (reads follow it; a write replaces the link, not its target)

2 participants