Repository navigation
fix(paths): return repository-relative paths for local sources - #133
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # REQUIREMENTS.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A folder can be a local source (a row in
indexed_paths). For a local source, the index keeps the absolute disk path of each file. Git sources keeprepo://relative/path.Some tools returned the stored path without the source root:
find_symbol,get_file_outline,trace_path,find_routes, andfind_api_callersreturned the absolute disk path (for exampleC:/Development/TEMP/claude/debug-eval/hub-prefix/server/X.cs).diagnose_issuereturned the disk path without its drive (for exampleDevelopment/TEMP/claude/debug-eval/hub-prefix/server/X.cs).read_fileandgrep_codetake the path relative to the source root (server/X.cs). Thus an agent had to change each path by hand.Fix
app/services/source_paths.pywith theLocalSourceRootsclass. It reads theindexed_pathsroots once for each tool call. It removes the root from a stored absolute path. It removes therepo://prefix from a stored Git path. When local sources are nested, the longest root applies. The comparison ignores letter case and the slash type.find_symbol,get_file_outline,find_routes,find_api_callers,trace_path, anddiagnose_issue(resolved frames, callers, callees, matched routes, and matched symbols).diagnostics.py, change only the lines that make the outputfilevalues. The frame and symbol matching does not change.search_codealready used the relativerel_pathfrom the vector payload. It does not change.docs/mcp-tools-and-resources.md.Tests
tests/test_local_source_relative_paths.py. The test puts a local source with Windows paths and a Git source into a SQLite database. It makes sure that each tool returnsserver/...paths for the local source andsrc/...paths for the Git source.origin/main.🤖 Generated with Claude Code