Files
codebase-memory-mcp/tests
Andrew Hundt 719cdfe57f mcp: fix 6 bugs + token optimization + empty DB reindex + 4 TDD tests
Bugs fixed:
- _hidden_tools dispatch: returns tool list instead of "unknown tool" error
- trace_call_path: accepts project paths via expand_project_param (DRY
  resolve_project_store helper shared with search_code_graph)
- Resources scoping: codebase://schema/architecture/status now reflect the
  most-recently-queried project (active_project_name) instead of always
  returning the empty session CWD project
- compact default: search/trace default to compact=true via new
  cbm_mcp_get_bool_arg_default() — omits redundant name field
- PageRank precision: add_pagerank_val() writes raw JSON via %.4g format
  (e.g. 4.755e-05) instead of 17-digit doubles, no float round-trip
- Empty DB skip: maybe_auto_index now checks db_has_content() (SELECT 1
  FROM nodes LIMIT 1) instead of just stat(). Empty DBs trigger reindex.

New features:
- db_is_stale(): compares DB mtime vs git HEAD commit time, with
  configurable max_age_seconds (reindex_stale_seconds config key)
- reindex_on_startup config: when true + stale DB, triggers reindex at
  server start. Default false for large project safety.

DRY refactors:
- resolve_project_store(): extracted from handle_search_graph, reused by
  handle_trace_call_path. Handles expand_project_param + DB selection +
  prefix collision avoidance + auto-index on first use.

Tests (2193 → 2197):
- hidden_tools_returns_info_not_error
- compact_defaults_to_true
- pagerank_output_has_limited_precision
- empty_db_not_treated_as_indexed

Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
2026-03-23 05:49:38 -04:00
..