Skip to content

test(memory): pin the neighbouring faces of three pinned invariants - #5701

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/chore/5645-memory-sibling-face-tests
Nov 30, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/chore/5645-memory-sibling-face-tests

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #5645

Description

Adds src/memory/__tests__/sibling-faces.test.ts: three characterization tests that re-measure invariants already pinned on one face of the memory server on their neighbouring face. All three pass on the current implementation; no behavior changes.

  1. delete_relations exact match rejects a space-padded type. Deleting knows or knows reports Deleted 0 of 1 relations. The rest matched nothing. and the relation survives; the exact knows then deletes it. (The different-type case is pinned in tools.test.ts; the whitespace case was not.)
  2. Identity is case-sensitive while search is case-insensitive. Test and test coexist as distinct entities, and search_nodes for test or TEST returns both. The docs are silent on the asymmetry, so this is characterization.
  3. observationCount agrees with delete_observations on the next read. After deleting one of three observations, read_graph with observationLimit: 0 returns observationCount: 2 and no observations, and an unlimited read returns the two that remain.

The issue's proposed tests drove KnowledgeGraphManager directly; these are adapted to the repo's conventions: a purpose header, and protocol-level, driving the tools through an SDK Client over an in-memory transport with the shared helpers.ts harness (connect, makeTempGraph, call). The manager's deletedCount is asserted through the count the tool reports in its message.

Every request names each item once, so the tests do not depend on how the write tools treat repeated items in one request (#5655, #5653), nor on how the write methods are implemented internally (#5693).

Credit: the cases and the proposed tests are by @reservoir-cmyk in #5645.

Server Details

  • Server: memory
  • Changed: tests only (src/memory/__tests__/sibling-faces.test.ts)

Motivation and Context

See #5645: each invariant was pinned on one face and unpinned on the sibling face, where the same shape of accident could recur.

How Has This Been Tested?

No client-observable surface changes, so the evidence is a targeted probe:

  • npx vitest run __tests__/sibling-faces.test.ts in src/memory: 3 passed.
  • Planted defect: changing deleteRelations to compare against delRelation.relationType.trim() makes the first test fail (1 failed | 2 passed); restoring the source makes it pass again.
  • npm run local:gate exits 0.

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

(Test-only change.)

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follow MCP security best practices
  • I have updated the server's README accordingly (not applicable: no tool, resource, prompt or configuration changed)
  • 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: test-only, no server-facing change)
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling (not applicable: test-only)
  • I have documented all environment variables and configuration options (not applicable: none added)

🤖 Generated with Claude Code

Adds protocol-level characterization tests for the sibling faces of
rules already pinned elsewhere: delete_relations' exact match also
rejects a space-padded relation type; entity identity is case-sensitive
while search_nodes is case-insensitive; and observationCount agrees with
delete_observations on the next read. Each request names every item
once. Test-only; no behavior change.

Proposed by @reservoir-cmyk in #5645.

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: c268819

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 82579af503da (Merge c268819 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 c26881969a089cef0489c4e9180228cb44f24c2a.

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 added memory-server characterization tests.

No open issues 🎉

What changed in this PR

Adds three protocol-level characterization tests for the memory server, addressing #5645 without changing production behavior. The tests use the shared SDK client harness and isolated temporary graphs.

Changes:

  • Verifies that relation types with leading or trailing spaces do not match an exact-match deletion.
  • Confirms that case-distinct entity names coexist while case-insensitive searches return both.
  • Checks that observation counts and full reads reflect a preceding observation deletion.
File Description
src/​memory/​__tests__/​sibling-faces.test.ts Adds the three characterization tests using the shared in-memory transport harness.

Review effort: Balanced

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot round 1: clean (no findings, no inline comments, no suppressed comments). Under pr-flow step 9 the loop stops on the first clean round, so no further round is requested.

@cliffhall
cliffhall merged commit 692f0f6 into v2/main Nov 30, 2026
48 checks passed
@cliffhall
cliffhall deleted the v2/chore/5645-memory-sibling-face-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 neighbouring faces of pinned invariants (exact-match delete vs. whitespace, case asymmetry, observationCount)

2 participants