You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR mksglu#365 fixes `ctx_index` to resolve a relative `path` argument against
the detected project directory instead of the MCP server cwd, but ships
without a regression test — the author attempted one (commit b659944)
and reverted it (commit 60e6091) when blocked locally by Node 24 +
better-sqlite3.
Mirrors the existing `executeFile: projectRoot path resolution` pattern
(server.test.ts:598) by spawning a fresh MCP server per case and driving
ctx_index over real JSON-RPC.
Three cases in `describe("ctx_index: projectRoot path resolution (mksglu#365)")`:
- `relative path resolves against CLAUDE_PROJECT_DIR, not server cwd` —
index a relative path under a temp project dir, then ctx_search for a
unique marker to confirm content really came from that dir.
- `absolute path bypasses project-dir resolution` — point CLAUDE_PROJECT_DIR
at a non-existent dir and confirm an absolute path still indexes.
- `relative path label preserves user input (not resolved absolute)` —
asserts the ContentStore label is the user-typed relative path, not
the resolved absolute path; keeps `ctx_search(source: "<rel-path>")`
working as users expect.
Adds an `awaitRpc` helper because the MCP server processes JSON-RPC
requests concurrently — a piggybacked search would otherwise race the
index and hit the empty-store guard. Sends each request and waits for
its response before moving on.
Tests:
- npx vitest run tests/core/server.test.ts -t "ctx_index: projectRoot" → 3/3 pass
- npm test → 1812 pass, 24 skipped, 0 regressions vs PR's baseline
(the 2 pre-existing cli.test.ts ABI failures are unrelated to this PR
and exist on its base branch already)
- npm run typecheck → clean
0 commit comments