chore(test): prove the short-lock scenario through a tool call

Open
#285 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
go
Domain
testing-qa

Research direction

Start with the existing tests in internal/graphstore/open_lock_test.go and internal/mcp/held_store_test.go, then read openLockRetrySleep in internal/graphstore/pebble_store.go and setRetrySleep in internal/graphstore/retry_test.go. The main work is exporting the retry seam through a graphstore subpackage such as locktest. Done means a new internal/mcp test holds the lock with locktest.HoldStoreLock, releases it during a codegraph_explore call, and asserts IsError is false and the text contains Alpha, with no timers.

Written by the indexing model from the issue text.

Description

area:mcp chore priority:low
What kind of chore?

Test infrastructure.

What needs doing?

The spec scenario "A short lock" is in openspec/specs/mcp-server/spec.md. It belongs to the requirement "A briefly locked store does not fail or hang a call."

That scenario is proven only at the graphstore.Open level. No test shows a tool call that returns a result without isError after the lock is released during the retry.

Existing coverage:

  • TestOpenConvergesWhenHolderCloses in internal/graphstore/open_lock_test.go:26 covers a release between two retry attempts.
  • TestToolCallOnHeldStore in internal/mcp/held_store_test.go:38 covers a long lock and expects isError.
  • TestToolCallWhileProcessHasStoreOpen in internal/mcp/held_store_test.go:15 does not hold a foreign lock.

Add a test in internal/mcp that holds the store lock with locktest.HoldStoreLock. The test must release the lock during a codegraph_explore call, then assert that IsError is false and that the text contains Alpha.

The blocker is the retry seam. openLockRetrySleep (internal/graphstore/pebble_store.go:106) is unexported, and setRetrySleep (internal/graphstore/retry_test.go:17) works only inside package graphstore. Package mcp cannot release the lock from inside the retry.

Expose the seam to other packages through an exported test helper in a graphstore subpackage such as locktest. The test must not use a timer, because the house rule forbids sleeps and wall-clock waits in tests.

Source: review note tes-1 in openspec/changes/archive/2026-11-11-shared-store-handle/review.md:33, from PR #282.

Why now?

PR #282 added the shared store handle that this scenario depends on. The review of that PR flagged this gap as tes-1. Without the test, a regression in how a tool call handles a briefly held lock can pass the suite.

Does this touch anything load-bearing?
  • None of these
Before submitting
  • I searched existing issues and this is not a duplicate
Dominant language
Go
Stars
0
Forks
0
Avg merge
5h 16m
Merged PRs (30d)
107

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from seanb4t/codegraph-go

All issues in seanb4t/codegraph-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.