Skip to content

test: add coverage for server/tools/* and index_service pipeline flow#85

Merged
GoodbyePlanet merged 1 commit into
mainfrom
test/tools-and-index-service-coverage-78
Jul 6, 2026
Merged

test: add coverage for server/tools/* and index_service pipeline flow#85
GoodbyePlanet merged 1 commit into
mainfrom
test/tools-and-index-service-coverage-78

Conversation

@GoodbyePlanet

Copy link
Copy Markdown
Owner

Summary

Closes #78 (partially — see scope note below).

  • server/tools/*.py (search.py, admin.py, index.py, history.py) had zero tests. Added tests/tools/ with a small helper (tests/tools/conftest.py) that extracts registered @mcp.tool() functions from a throwaway FastMCP instance so each tool can be exercised directly without going through MCP's request/response plumbing.
  • tests/test_pipeline.py only had a single regression test for index_service (parser failure preserving existing entries). Added tests for the incremental-skip path, force override, stale-entry cleanup, no-symbols-in-file cleanup, embedding-failure preservation, and delete-before-upsert ordering.

Notable coverage

  • search_code, find_symbol — result formatting and empty-result messaging.
  • find_usages — self-match exclusion, snippet windowing, and a test documenting a known limitation called out in the issue: self-matches are filtered out after the limit-bounded fetch, so results can undercount when the fetched window is dominated by self-matches. This is left as-is (test only, no behavior change) since the issue asked for coverage, not a fix.
  • get_code_context — the svc.root path-reconstruction logic (search.py:196-197), the Qdrant-vs-text-search fallback for locating a symbol, and the GitHub-fetch error path.
  • admin.py / index.py / history.py — success and error-message formatting for all six tools.
  • index_service — incremental skip, force reindex, stale cleanup, empty-symbol cleanup, embedding failure, and delete-before-upsert call ordering.

Scope note

Issue #78's body also calls out gaps in openai/jina/ollama embedding retry paths and github_source's rate-limit retry / >1MB blob fallback. Those aren't addressed here — this PR scopes to the issue title (server/tools/* and the index_service pipeline flow). Happy to open a follow-up issue for the remaining embedding/github_source gaps if useful.

Test plan

  • uv run pytest — 254 passed
  • uv run pytest tests/tools tests/test_pipeline.py -q — 48 new tests, all passing
  • ruff format clean

🤖 Generated with Claude Code

server/tools/*.py had zero tests, and index_service only had a single
parser-failure regression test. Adds tests for search_code, find_symbol,
find_usages (including the path reconstruction in get_code_context and the
limit/self-match interaction in find_usages), admin, index, and history
tools by extracting registered @mcp.tool() functions from a throwaway
FastMCP instance. Also covers index_service's incremental skip, force
override, stale-entry cleanup, no-symbols cleanup, embedding-failure
preservation, and delete-before-upsert ordering.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@GoodbyePlanet GoodbyePlanet merged commit 4c1bdd1 into main Jul 6, 2026
2 checks passed
@GoodbyePlanet GoodbyePlanet deleted the test/tools-and-index-service-coverage-78 branch July 6, 2026 07:25
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.

No tests for server/tools/* or the pipeline index_service flow

1 participant