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

未关闭
#285 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
go
领域
testing-qa

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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
主要语言
Go
星标
0
派生
0
平均合并
7 小时 42 分钟
30 天内合并 PR
111

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

seanb4t/codegraph-go 的其他 Issue

查看 seanb4t/codegraph-go 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。