Skip to content

fix(mcp): resolve repository-relative chunk reads - #208

Merged
scbrown merged 1 commit into
mainfrom
gennaro/read-chunk-paths-1ph10
Oct 22, 2026
Merged

scbrown merged 1 commit into
mainfrom
gennaro/read-chunk-paths-1ph10

Conversation

@scbrown

@scbrown scbrown commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

An indexed search result returns a repository and a repository-relative path, but chunk reads previously resolved that path against the workspace root. A valid result could therefore fail to read unless the caller constructed a workspace prefix.

Add optional repo to the MCP and HTTP read contracts, preserve it in remote forwarding, and share one filesystem resolver. Explicit repositories refuse traversal and symlink escapes. Without repo, existing workspace paths retain precedence; otherwise a unique relative match resolves and ambiguity refuses with the matching repository names. Missing and unknown paths return corrective guidance. This does not reindex or expand the index.

Private before/after control: indexed alpha/src/example.rs advertises file_path=src/example.rs; the old workspace-only reader cannot resolve it, while the new real private Lance index -> MCP find_refs -> read_chunk control returns the requested content with omitted or explicit repository. Unknown repositories still refuse. Nine resolver controls and remote parameter compatibility cover the failure boundaries.

Validation: just check passed with the required knowledge feature; full just test passed (1,422 tests, five ignored). The targeted path selection passed 11 tests. The HOME guard finished clean across 157 watched paths and five resources. An additional falsifier reproduced a workspace/repository basename collision; configured child repositories now take precedence while single-repository roots retain their fallback. The integration test lives in its own module to preserve the large-file ceilings.

Rollback: revert the merged source change through the normal lane; release or installation remains separate. No branch binary installation, service restart, or index rebuild is part of this proposal.

@scbrown
scbrown merged commit e3296e0 into main Oct 22, 2026
6 checks passed
@scbrown
scbrown deleted the gennaro/read-chunk-paths-1ph10 branch October 22, 2026 07:15
@scbrown
scbrown restored the gennaro/read-chunk-paths-1ph10 branch October 22, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant