Problem
Two compounding defects in handleQuery (src/mcp.zig):
- The
filter op only reads ext and glob params. Any other key — e.g. the natural pattern — leaves both null, so every file passes through silently. No error, no hint. Live repro: [{op:find,query:"index.zig"},{op:filter,pattern:"src/index.zig"},{op:limit,n:3}] → stage trace 1: filter (50 files).
find prints its full result list eagerly when it executes, and the final file-set print is gated on out.items.len == 0 — so in find → filter → limit pipelines the rendered output is find's pre-transform list (all 50 files), while limit only shows up in the stage tail. The output contradicts the pipeline.
Failing Test
test "issue-558: codedb_query filter must filter (or error) — never silently pass every file" in src/test_query.zig (branch fix/issue-558-query-filter):
- pipeline
find auth → filter pattern=*.py → limit 10 must list src/auth.py and must NOT list src/auth.ts/docs/auth.md
- pipeline
find auth → filter match=*.py (no recognized param) must emit error: filter needs
Verified failing on release/0.2.5825: 65/66 tests passed (1 failed) — fails at the auth.ts leak.
Expected
filter accepts pattern as an alias for glob (with the same bare-pattern **/ auto-promotion codedb_search applies to path_glob)
filter with no recognized param errors listing valid params
- a pipeline's rendered output reflects the post-transform file set:
find defers its listing when it is not the last step
Fix
src/mcp.zig handleQuery: read glob orelse pattern, error via finishQueryWithFailure when ext+glob+pattern all missing, auto-promote bare globs, and print find's list only when it is the final step (the existing tail print at the end of the pipeline already renders the final set when nothing else printed). Document filter params in the codedb_query inputSchema.
Problem
Two compounding defects in
handleQuery(src/mcp.zig):filterop only readsextandglobparams. Any other key — e.g. the naturalpattern— leaves both null, so every file passes through silently. No error, no hint. Live repro:[{op:find,query:"index.zig"},{op:filter,pattern:"src/index.zig"},{op:limit,n:3}]→ stage trace1: filter (50 files).findprints its full result list eagerly when it executes, and the final file-set print is gated onout.items.len == 0— so infind → filter → limitpipelines the rendered output is find's pre-transform list (all 50 files), whilelimitonly shows up in the stage tail. The output contradicts the pipeline.Failing Test
test "issue-558: codedb_query filter must filter (or error) — never silently pass every file"insrc/test_query.zig(branchfix/issue-558-query-filter):find auth → filter pattern=*.py → limit 10must listsrc/auth.pyand must NOT listsrc/auth.ts/docs/auth.mdfind auth → filter match=*.py(no recognized param) must emiterror: filter needsVerified failing on release/0.2.5825:
65/66 tests passed (1 failed)— fails at theauth.tsleak.Expected
filteracceptspatternas an alias forglob(with the same bare-pattern**/auto-promotion codedb_search applies to path_glob)filterwith no recognized param errors listing valid paramsfinddefers its listing when it is not the last stepFix
src/mcp.zig
handleQuery: readglob orelse pattern, error viafinishQueryWithFailurewhen ext+glob+pattern all missing, auto-promote bare globs, and print find's list only when it is the final step (the existing tail print at the end of the pipeline already renders the final set when nothing else printed). Document filter params in the codedb_query inputSchema.