read_code: a caller-typed missing path range falsely claims the file exists in the index #469

Closed
opened 2026-10-25 12:28:16 +01:00 by buildagent · 2 comments
Member

Dogfooded with the official v0.41.20 binaries and a healthy indexed checkout. read_code("crates/guest/svelte/src/gen-kinds.rs:1-30") returns file_not_readable with the affirmative hint “The file exists in the index but couldn't be read from disk”. That file does not exist: index_coverage returns path_not_found, and list_files for the exact path returns an empty population. This was a caller-typed path typo, not a deleted indexed file.

server.rs currently selects its missing-file hint with whole_file, although the nearby span_from_index flag already distinguishes an index-derived symbol target from an arbitrary caller-supplied path. Adding :1-30 must not turn an unknown path into proof of indexed existence. Preserve the existing refusal and root-routing disclosure; select the stale-index explanation only when the path genuinely came from an indexed symbol. Verify bare-path and path-range typo controls alongside indexed-symbol deletion and ignored-file refusal. This is a diagnostic correctness issue; no source was served or exclusion bypassed.

Dogfooded with the official v0.41.20 binaries and a healthy indexed checkout. `read_code("crates/guest/svelte/src/gen-kinds.rs:1-30")` returns `file_not_readable` with the affirmative hint “The file exists in the index but couldn't be read from disk”. That file does not exist: `index_coverage` returns `path_not_found`, and `list_files` for the exact path returns an empty population. This was a caller-typed path typo, not a deleted indexed file. `server.rs` currently selects its missing-file hint with `whole_file`, although the nearby `span_from_index` flag already distinguishes an index-derived symbol target from an arbitrary caller-supplied path. Adding `:1-30` must not turn an unknown path into proof of indexed existence. Preserve the existing refusal and root-routing disclosure; select the stale-index explanation only when the path genuinely came from an indexed symbol. Verify bare-path and path-range typo controls alongside indexed-symbol deletion and ignored-file refusal. This is a diagnostic correctness issue; no source was served or exclusion bypassed.
Author
Member

The fix is included in PR#468's combined final head23a9d61c. The new path-range regression fails the old condition. The repaired snapshot and daemon legs pass; a separate indexed-symbol deletion control retains the genuine stale-source explanation. Making every missing-file hint neutral fails that control, and exact restoration passes all four routing tests. Source-listing/trust suites and strict MCP Clippy pass. Final-head CI is running; this is not yet merged or released.

The fix is included in PR#468's combined final head23a9d61c. The new path-range regression fails the old condition. The repaired snapshot and daemon legs pass; a separate indexed-symbol deletion control retains the genuine stale-source explanation. Making every missing-file hint neutral fails that control, and exact restoration passes all four routing tests. Source-listing/trust suites and strict MCP Clippy pass. Final-head CI is running; this is not yet merged or released.
Author
Member

Verified on the actual published 0.41.21 MCP binary: missing.js and missing.js:1-5 return the same neutral file_not_readable hint with list_files/index_coverage guidance; neither asserts indexed existence. An indexed symbol whose source is deleted after snapshot initialization still returns the specific stale-index hint. Receipt: /tmp/cosi-04121-missing-path-proof/report.json.

Verified on the actual published [0.41.21](https://git.h-dv.de/h-dv/code-index/releases/tag/v0.41.21) MCP binary: missing.js and missing.js:1-5 return the same neutral file_not_readable hint with list_files/index_coverage guidance; neither asserts indexed existence. An indexed symbol whose source is deleted after snapshot initialization still returns the specific stale-index hint. Receipt: /tmp/cosi-04121-missing-path-proof/report.json.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
h-dv/code-index#469
No description provided.