read_code with rev rejects a valid git path when its parent directory no longer exists in the working tree #568

Closed
opened 2026-11-11 07:25:31 +01:00 by buildagent · 1 comment
Member

Found in worker dogfooding (triage round 14), reproduced on the installed v0.41.48.

Reproduction (in a checkout where crates/cli/tests/fixtures/ was deleted after commit 94a577fa):

code-index query read_code '{"target":"crates/cli/tests/fixtures/legacy-verdict.toml:1-4","rev":"94a577fa","envelope":"minimal"}'

Actual: path_outside_root; the hint rejects absolute or .. components, although the path has neither.

Control: git cat-file -e 94a577fa:crates/cli/tests/fixtures/legacy-verdict.toml exits 0. A historical read of a sibling file whose directory still exists succeeds and reports resolved_commit.

Expected: a rev read validates the project-relative path lexically and reads the git blob, independent of whether the parent directory exists in the working tree.

Impact: a reviewer cannot read a file from a deleted directory through the historical reader, which is the case rev exists for. Related: #558, #555.

Found in worker dogfooding (triage round 14), reproduced on the installed v0.41.48. **Reproduction** (in a checkout where `crates/cli/tests/fixtures/` was deleted after commit `94a577fa`): ``` code-index query read_code '{"target":"crates/cli/tests/fixtures/legacy-verdict.toml:1-4","rev":"94a577fa","envelope":"minimal"}' ``` **Actual:** `path_outside_root`; the hint rejects absolute or `..` components, although the path has neither. **Control:** `git cat-file -e 94a577fa:crates/cli/tests/fixtures/legacy-verdict.toml` exits 0. A historical read of a sibling file whose directory still exists succeeds and reports `resolved_commit`. **Expected:** a `rev` read validates the project-relative path lexically and reads the git blob, independent of whether the parent directory exists in the working tree. **Impact:** a reviewer cannot read a file from a deleted directory through the historical reader, which is the case `rev` exists for. Related: #558, #555.
Author
Member

Released in v0.41.50: read_code with rev reads a path whose directory no longer exists in the working tree.

Verified on the installed binary (code-index 0.41.50 (3d0a584c)): after removing src/ from a committed fixture, read_code {"target":"src/lib.rs:1-3","rev":"HEAD"} returns the committed lines. Closing.

Released in v0.41.50: `read_code` with `rev` reads a path whose directory no longer exists in the working tree. Verified on the installed binary (`code-index 0.41.50 (3d0a584c)`): after removing `src/` from a committed fixture, `read_code {"target":"src/lib.rs:1-3","rev":"HEAD"}` returns the committed lines. Closing.
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#568
No description provided.