Skip to content

fix(mcp): bump INDEX_VERSION, improve empty search UX, reduce call noise#2

Merged
sdsrss merged 2 commits intomainfrom
fix/index-version-and-search-ux
Mar 17, 2026
Merged

fix(mcp): bump INDEX_VERSION, improve empty search UX, reduce call noise#2
sdsrss merged 2 commits intomainfrom
fix/index-version-and-search-ux

Conversation

@sdsrss
Copy link
Copy Markdown
Owner

@sdsrss sdsrss commented Mar 17, 2026

Summary

  • INDEX_VERSION 2→3: Forces full rebuild for users with stale indexes that were missing cross-file call edges (e.g., run_serve → handle_message was lost because incremental index doesn't re-process unchanged files after indexer logic improvements)
  • Empty search feedback: semantic_code_search now returns {results: [], message, hint} instead of bare [], giving callers actionable guidance when no matches are found
  • Call noise reduction: Added flush, close, read, write to CROSS_FILE_CALL_NOISE to prevent false positive edges like stdout.flush()metrics::flush()
  • Regression test: New test for Rust method call extraction in try expressions and match scrutinees

Test plan

  • All 167 tests pass (cargo test --no-default-features)
  • Release build succeeds (cargo build --release)
  • E2E verified: empty search returns structured message
  • E2E verified: get_call_graph("handle_message", callers) shows run_serve (depth 1) and main (depth 2)
  • E2E verified: run_serve → flush false positive eliminated
  • E2E verified: dependency_graph("src/main.rs") correctly shows server.rs dependency

🤖 Generated with Claude Code

sdsrss and others added 2 commits March 17, 2026 12:16
- Bump INDEX_VERSION 2→3 to force full rebuild for stale indexes that
  were missing cross-file call edges (e.g., run_serve→handle_message)
- Return structured {results, message, hint} instead of bare [] when
  semantic_code_search finds no matches, so callers get actionable feedback
- Add flush/close/read/write to CROSS_FILE_CALL_NOISE to prevent false
  positive edges like stdout.flush() → metrics::flush()
- Add regression test for Rust method call extraction in try/match contexts
- Update integration test for new empty-results response format

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sdsrss sdsrss merged commit eef1a89 into main Mar 17, 2026
1 check failed
@sdsrss sdsrss deleted the fix/index-version-and-search-ux branch March 17, 2026 04:22
sdsrss added a commit that referenced this pull request Apr 20, 2026
Three changes driven by real-usage-data review of this repo's
own `.code-graph/usage.jsonl`:

1. `code-graph-mcp stats` — new CLI subcommand that aggregates
   JSONL session metrics (per-tool counts, search totals, index
   activity). Running on this repo's 153-session, 570-call history
   surfaced the rebuild_index error pattern motivating change #2.
   Flags: `--last N`, `--json`. 5 new unit tests on the pure
   `aggregate_usage_jsonl` helper.

2. `rebuild_index` MCP tool: embedding-busy rejection now returns
   `Ok({status:"busy", retry_after_ms:2000})` instead of `Err`,
   matching `run_incremental_with_cache_restore`'s precedent and
   keeping the usage-metrics `err` counter from inflating on
   legitimate retry signals. **Contract change** — SDK clients
   must now distinguish busy success payloads from JSON-RPC errors;
   JSON-RPC errors on this tool now indicate real failures only.

3. `plugin_code_graph_mcp.md` template: CLI `search` (FTS5-only)
   and MCP `semantic_code_search` (RRF hybrid of FTS5 + vector)
   are no longer conflated — the core-7 decision table and CLI
   cheat sheet now state the difference explicitly. Adopted
   memory files auto-refresh on next SessionStart (v0.11.0+).

Clippy 1.95 parity verified pre-push:
`cargo +1.95.0 clippy --no-default-features -- -D warnings` ✓
`cargo +1.95.0 clippy --all-targets -- -D warnings`          ✓

235/235 lib tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant