mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-28 07:03:20 +08:00
Previous behavior: - handle_get_architecture() built the PageRank key_functions query with only pr.project = ?1, so a JSON request scoped to apps/hoa returned GlobalKeyFunction from scripts/helpers.py. Changes: - Pass path_scoped into build_key_functions_sql() in src/mcp/mcp.c:1903 and add exact-file-or-descendant predicates bound as ?2 and ?3 at src/mcp/mcp.c:6983-6987. - Preserve unscoped first-response and codebase://architecture queries by passing path_scoped=false. - Extend tool_get_architecture_path_scoping in tests/test_mcp.c:4421-4494 with higher-ranked out-of-scope and lower-ranked in-scope functions. Resource and complexity: - The scope pattern is stack-owned and copied with SQLITE_TRANSIENT; the existing sqlite3_finalize() and free(kf_sql_heap) paths remain unchanged. - The predicate narrows scoped PageRank rows and adds no thread, worker, heap-owner, or shared-state lifecycle. Verification: - Red: focused ASan/UBSan test failed at tests/test_mcp.c:4494 because GlobalKeyFunction was present. - Green: focused ASan/UBSan test passed 1/1; MCP ASan/UBSan suite passed 222/222. - make -f Makefile.cbm lint-source-safety passed both source-safety checks. - git clang-format --diff HEAD reported no changed-line formatting edits. Signed-off-by: Andrew Hundt <ATHundt@gmail.com>