Problem
codedb ls nonexistent/dir prints no entries and exits 0 — indistinguishable from a real-but-empty directory. An index only knows a directory through the files under it, so an empty listing for a non-empty prefix always means the path is not indexed; the tool should say so, and the CLI bridge should exit non-zero (finishCli already keys on the error: prefix). From the 2026-06-10 re-audit error-UX sweep.
Failing Test
A test in src/test_mcp.zig (named after this issue number once assigned): codedb_ls path:"nonexistent/dir" must emit error: no indexed files under 'nonexistent/dir' while path:"src" still lists entries. Verified failing on release/0.2.5825: 108/109 ('no entries').
Expected
Empty listing + non-empty prefix → error: no indexed files under '<path>' — check the path (codedb_tree shows the layout); empty prefix (project root with zero files) keeps no entries.
Fix
One branch in handleLs (src/mcp.zig).
Problem
codedb ls nonexistent/dirprintsno entriesand exits 0 — indistinguishable from a real-but-empty directory. An index only knows a directory through the files under it, so an empty listing for a non-empty prefix always means the path is not indexed; the tool should say so, and the CLI bridge should exit non-zero (finishCli already keys on theerror:prefix). From the 2026-06-10 re-audit error-UX sweep.Failing Test
A test in
src/test_mcp.zig(named after this issue number once assigned):codedb_ls path:"nonexistent/dir"must emiterror: no indexed files under 'nonexistent/dir'whilepath:"src"still lists entries. Verified failing on release/0.2.5825: 108/109 ('no entries').Expected
Empty listing + non-empty prefix →
error: no indexed files under '<path>' — check the path (codedb_tree shows the layout); empty prefix (project root with zero files) keepsno entries.Fix
One branch in
handleLs(src/mcp.zig).