Skip to content

fix: wire up silently-ignored search and trace parameters#155

Open
maplenk wants to merge 2 commits intoDeusData:mainfrom
maplenk:fix/search-params-wiring
Open

fix: wire up silently-ignored search and trace parameters#155
maplenk wants to merge 2 commits intoDeusData:mainfrom
maplenk:fix/search-params-wiring

Conversation

@maplenk
Copy link
Copy Markdown

@maplenk maplenk commented Mar 27, 2026

Summary

Five parameters were accepted by the MCP tool schemas but never passed through to the query layer:

  • search_graph: relationship, exclude_entry_points, include_connected — all defined in cbm_search_params_t and the tool schema but never extracted or used
  • trace_call_path: edge_types — defined in the tool schema but hardcoded to {"CALLS"}

This PR wires them up with correct SQL, proper memory management, and defensive hardening.

Changes

search_graph

  • relationship: EXISTS filter on edges table, degree subqueries use the specified edge type (with SQL-injection-safe validation: alphanumeric + underscore, max 64 chars), self-edges excluded from degree counts
  • exclude_entry_points: filters nodes where in_deg=0 AND out_deg>0, preserving dead code (degree=0) while removing true entry points
  • include_connected: populates connected_names via post-query (capped to 50 results, 10 connected names each, respects relationship edge type, excludes self-edges)

trace_call_path

  • edge_types: extracted from JSON array instead of hardcoded {"CALLS"}
  • Explicit empty array [] produces empty traversal (no fallback to CALLS) while preserving response schema (empty callees/callers arrays emitted)

Test plan

  • 8 new integration tests covering all wired-up parameters
  • All 2594 tests pass (existing + new)
  • Build clean on macOS arm64

@maplenk
Copy link
Copy Markdown
Author

maplenk commented Mar 27, 2026

These changes are based on other open PRs. Majorly #151

maplenk and others added 2 commits March 27, 2026 17:45
Five parameters were accepted by the MCP schema but never passed through
to the query layer — relationship, exclude_entry_points, include_connected
on search_graph, and edge_types on trace_call_path. This wires them up
with correct SQL, proper memory management, and defensive hardening.

search_graph:
- relationship: EXISTS filter on edges table (UNION index seeks)
- exclude_entry_points: filters nodes where in_deg=0 AND out_deg>0,
  preserving dead code (degree=0) while removing true entry points
- include_connected: populates connected_names via post-query (capped
  to 50 results, respects relationship edge type, excludes self-edges)
- Degree subqueries now use the relationship edge type when set and
  exclude self-edges for correct recursive function classification

trace_call_path:
- edge_types extracted from JSON array instead of hardcoded {"CALLS"}
- Explicit empty array [] produces empty traversal (no fallback to CALLS)
  while preserving response schema (empty callees/callers arrays emitted)

Hardening: relationship length capped to 64 chars, validated to safe chars
for SQL inlining, calloc for empty-array sentinel.

8 new integration tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maplenk maplenk force-pushed the fix/search-params-wiring branch from 1f86186 to 81718ac Compare March 27, 2026 12:25
@DeusData DeusData added the bug Something isn't working label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants