mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-08 08:53:43 +08:00
Land the four residual hardening points from #938 on the current semantic-search design (semantic_limit/offset, the certified top-K fetch loop): - extract_semantic_keywords rejects a semantic_query array that holds a non-string element instead of silently running the string subset; the caller gets the same isError as for a bare-string semantic_query. - run_semantic_query_core fails closed when the vector scan itself fails ("semantic search failed", isError) instead of rendering a store error as zero matches plus the broaden-your-keywords hint. cbm_store_vector_search now tells the two states apart: a store with no node_vectors table (lean index) is CBM_STORE_NOT_FOUND and keeps the empty-page + moderate/full-index hint that main relied on by swallowing the "no such table" prepare failure; a failing scan is CBM_STORE_ERR. - vs_min_cosine_score hoists the keyword norms (once per search) and the node norm (once per node) out of the per-(node, keyword) loop. The integer sums are exact, so every score stays bit-identical. - vs_append_result checks its strdup results, frees the partial row on failure and counts a row only once every copy succeeded, so the caller's free path stays valid. Two reproduce-first tests in the mcp suite fail on main and pass with the change: non-string elements produce the type error, and a forced cbm_cosine_i8 failure produces the fail-closed error for semantic-only and combined calls while a missing node_vectors table still yields the lean-index hint. Refs #915 Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com> Co-authored-by: Dustin Persek <dustin.persek@protonmail.com>