fix: tree-sitter fallback runs when scip-java fails at runtime#7
Merged
Conversation
JavaIndexer.run claimed to fall back to tree-sitter when scip-java
wasn't available, but the existing branch only triggered when
shutil.which("scip-java") returned None. When scip-java was on PATH
but failed at runtime (e.g., no Maven/Gradle/sbt/mill descriptor),
_run_scip silently returned 0 and the tree-sitter else-branch never
ran — see plans/scip-java-fallback-bug.md.
Predict scip-java's runtime requirement cheaply: only invoke it when
the repo root has one of the build descriptors it understands. If
either the binary is missing OR no descriptor is present, fall
through to the tree-sitter import extractor.
Side benefits:
- Saves ~400ms per init for Java repos without a build tool
(the failing scip-java subprocess is no longer invoked).
- Closes the long-standing
tests/unit/test_index_java.py::test_import_reference failure.
5 tasks
57a1a2c to
270c496
Compare
…untime same bug as the java fix: shutil.which() returning truthy is not enough, scip-go panics without go.mod and scip-python errors without a python project descriptor. gate the scip path on the build descriptor's presence so the tree-sitter fallback actually runs.
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
JavaIndexer.runclaimed to fall back to tree-sitter import extraction when scip-java was unavailable, but the existing branch only triggered whenshutil.which("scip-java")returned None. When scip-java was on PATH but failed at runtime (no Maven/Gradle/sbt/mill descriptor),_run_scipsilently returned 0 and the tree-sitter else-branch never ran. The comment said fallback; the code did not.tests/unit/test_index_java.py::test_import_reference.See
plans/scip-java-fallback-bug.mdfor the full investigation, including how the bug surfaced (autoresearch trial; rejected the "skip scip-java" optimization with more refs than golden, exposing the missing fallback).Test plan
tests/unit/test_index_java.pyall pass, including the previously-failingtest_import_reference.pom.xmlthat scip-java still runs as before (not exercised in the local test environment because scip-java's own subprocess requires a working build tool).