memory: file-lock test "stops refreshing a lock that was broken and re-taken" races its own heartbeat on a slow runner
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- testing
Research direction
Start with src/memory/__tests__/file-lock.test.ts, in the withFileLock test named “stops refreshing a lock that was broken and re-taken while it ran.” Read how the mocked utimes, readFile spy, and real timers coordinate, then make the assertion independent of runner scheduling. Run the focused test with verify:no-test-retries; it is done when it passes reliably without retries on slow CI.
Written by the indexing model from the issue text.
Description
Problem
src/memory/__tests__/file-lock.test.ts > withFileLock > stops refreshing a lock that was broken and re-taken while it ran (#5418) failed on CI with AssertionError: expected 0 to be greater than 0 (Coverage memory, run 44417378815, job 135201148642, on PR #5628's caught-up head). That PR changes only src/git/; the test is unchanged on v2/main, including after #5623.
Cause
The test runs on real timers (staleMs: 200, so a heartbeat every 100 ms). The first heartbeat's utimes is mocked to replace the lock with another owner's and then resolve replacement. The operation then clears the readFile spy and expects, within a 250 ms sleep, at least one read of the lock: the next heartbeat seeing the new token and stopping.
On a loaded runner (the coverage leg is instrumented), the next heartbeat can read the lock before the operation resumes and clears the spy. That read is wiped, the heartbeat stops as intended, and no further read follows, so the count is 0. The behavior under test is correct; the assertion depends on scheduling.
Expected
The test passes regardless of runner speed, with no retry (verify:no-test-retries). For example: drive the heartbeat with fake timers, or count reads from the moment the replacement is made (inside the mocked utimes) instead of clearing after the operation resumes.
- Dominant language
- TypeScript
- Stars
- 92k
- Forks
- 12k
- Avg merge
- 3h 46m
- Merged PRs (30d)
- 206
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/servers
-
`interface-diff` discards the git error when resolving its default base and reports the wrong causeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
modelcontextprotocol/servers#5636 ·
Maintainers usually reply within 1 day
-
documentation server-memory v2
Difficulty 1/5 Under an hour Newbie friendliness 90/100
modelcontextprotocol/servers#5609 · 1 comment ·
Maintainers usually reply within 1 day
-
bug server-memory v2
Difficulty 4/5 3-5 days Newbie friendliness 48/100
modelcontextprotocol/servers#5635 · 1 comment ·
Maintainers usually reply within 1 day
-
bug server-memory v2
Difficulty 5/5 Over a week Newbie friendliness 42/100
modelcontextprotocol/servers#5624 ·
Maintainers usually reply within 1 day
-
enhancement v2
Difficulty 4/5 3-5 days Newbie friendliness 48/100
modelcontextprotocol/servers#5611 ·
Maintainers usually reply within 1 day
All issues in modelcontextprotocol/servers
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
hurttlocker/o8#6535 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
area: backend bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
snapotter-hq/SnapOtter#4856 ·
Maintainers usually reply within 1 day
-
bug follow-up
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
spellshift/realm#2509 ·
Maintainers usually reply within 1 day