Skip to content

test(memory): count a real Windows refusal of the lock put-back as a retry - #5684

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/chore/5683-memory-restore-count-test
Nov 27, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/chore/5683-memory-restore-count-test

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #5683

Description

The memory lock test "keeps putting a live lock back while Windows refuses to replace the lock created in the gap" injects two EPERM refusals of the put-back, then lets the third attempt reach the real fs.rename, and asserted exactly three attempts. On a real Windows runner that real rename can also be refused while the test's third writer has the lock open, which restoreLock retries as designed, so the count is sometimes 4. The assertion is now >= 3: the injected refusals were retried and the put-back landed. The test's other assertions (the third writer never ran, the successor's lock is back, nothing is left aside) are unchanged.

Server Details

  • Server: memory
  • Changed: one assertion and its comment in src/memory/__tests__/file-lock.test.ts. No source change.

Motivation and Context

It failed Test memory (Windows) on the dispatched TypeScript run for the v2.6.0 CalVer PR #5682, which touches no TypeScript: https://github.com/modelcontextprotocol/servers/actions/runs/45967890810/job/140400944527 (expected 4 to be 3). Found during the v2.6.0 release (#5681). Analysis in #5683.

How Has This Been Tested?

  • npm test -w src/memory -- __tests__/file-lock.test.ts locally (macOS): 57 / 57 pass. The Windows path this test models only really races on a Windows host, so this PR's CI Test memory (Windows) job is the evidence that matters.
  • Prettier check on the changed file passes.
  • npm run local:gate was skipped at the maintainer's direction: a one-assertion test change whose meaningful run is Windows CI.
  • No client evidence: the change has no client-observable surface.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue) — in a test
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation (not applicable: no protocol surface changes)
  • My changes follow MCP security best practices (not applicable: test only)
  • I have updated the server's README accordingly (not applicable: nothing user-facing changed)
  • I have added a changeset if this changes what a TypeScript server publishes (not applicable: a test publishes nothing)
  • I have tested this with an LLM client (not applicable: test only)
  • 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

…retry, not a failure

The put-back test injected two EPERM refusals and asserted exactly three
attempts, but on a real Windows host the third, real rename can be refused
too while the third writer holds the lock open, and restoreLock retries it.
Assert three as the floor.

Closes #5683

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

changeset-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 53afb97

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: ee4f57cfa374 (Merge pull request #5633 from modelcontextprotocol/changeset-release/v2/main)
Head: the build in this checkout, at 71b3f45021f3 (Merge 53afb97 into ee4f57c)

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 53afb97437da20225756908b0de1f1d4de766724.

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 remain for the test-only adjustment accommodating additional Windows lock-restoration attempts.

No open issues 🎉

What changed in this PR

Addresses #5683 by correcting an intermittent Windows failure in the memory server’s lock-restoration test. The change allows additional real rename refusals while preserving the existing lock-safety assertions.

Changes:

  • Requires at least three restoration attempts instead of exactly three.
  • Explains why Windows may require extra attempts. No production code changes.
File Description
src/​memory/​__tests__/​file-lock.test.ts Relaxes the attempt-count assertion and documents the Windows rename race.

Review effort: Balanced

@cliffhall
cliffhall merged commit 5de8459 into v2/main Nov 27, 2026
48 checks passed
@cliffhall
cliffhall deleted the v2/chore/5683-memory-restore-count-test branch November 27, 2026 08:58
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: "keeps putting a live lock back while Windows refuses…" counts a real Windows refusal as an extra put-back and fails intermittently

2 participants