Skip invalid tree-sitter queries in repo map generation#4920
Open
biefan wants to merge 1 commit intoAider-AI:mainfrom
Open
Skip invalid tree-sitter queries in repo map generation#4920biefan wants to merge 1 commit intoAider-AI:mainfrom
biefan wants to merge 1 commit intoAider-AI:mainfrom
Conversation
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.
Summary
Prevent repo map generation from crashing when a tree-sitter tag query cannot be compiled for a file.
Problem
RepoMap.get_tags_raw()currently letstree_sitter.QueryErrorbubble out ofQuery(language, query_scm). When a.scmquery and the installed parser are out of sync, a single file can crash repo map generation for the entire run.Root cause
get_tags_raw()already treats parser initialization failures as file-level skips, but query compilation failures were not handled the same way. That meant an invalid query was not isolated to the file that triggered it.Fix
QueryErroraround query compilation/capture executionQuery(...)to fail and verifiesget_repo_map()still returns a repo map instead of crashingValidation
./.venv311/bin/python -m pytest tests/basic/test_repomap.py -q./.venv311/bin/python -m flake8 aider/repomap.py tests/basic/test_repomap.pyFixes #4919.