Skip to content

fix: tree-sitter fallback runs when scip-java fails at runtime#7

Merged
The127 merged 2 commits into
masterfrom
fix/scip-java-fallback
May 3, 2026
Merged

fix: tree-sitter fallback runs when scip-java fails at runtime#7
The127 merged 2 commits into
masterfrom
fix/scip-java-fallback

Conversation

@nymann
Copy link
Copy Markdown
Collaborator

@nymann nymann commented May 3, 2026

Summary

  • JavaIndexer.run claimed to fall back to tree-sitter import extraction when scip-java was unavailable, but the existing branch only triggered when shutil.which("scip-java") returned None. When scip-java was on PATH but failed at runtime (no Maven/Gradle/sbt/mill descriptor), _run_scip silently returned 0 and the tree-sitter else-branch never ran. The comment said fallback; the code did not.
  • 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), and closes the long-failing tests/unit/test_index_java.py::test_import_reference.

See plans/scip-java-fallback-bug.md for 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.py all pass, including the previously-failing test_import_reference.
  • All other unit tests still pass.
  • Manual: verify on a real Java repo with pom.xml that scip-java still runs as before (not exercised in the local test environment because scip-java's own subprocess requires a working build tool).

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.
…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.
@The127 The127 merged commit 816267a into master May 3, 2026
@The127 The127 deleted the fix/scip-java-fallback branch May 3, 2026 09:20
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.

2 participants