fix: use actual rule kind from aspect output instead of heuristic name matching#23
Merged
monkey666-cr merged 2 commits intoMay 21, 2026
Conversation
…e matching
The `infer_target_kind` function used `contains("_import")` to detect
`java_import` targets, which falsely matched any target whose name
contained "import" (e.g., `funds_csv_importer`). Misclassified targets
were routed to `compute_for_import` which returns only the target's own
JARs without BFS traversal, causing all imports in affected source files
to show "cannot be resolved" in the IDE.
Replace the heuristic with a graph-based lookup: store the actual Bazel
rule kind string from aspect output in `DependencyGraph.target_kinds`
during `populate_from_aspects`, and look it up via `get_target_kind()`
during classpath computation. Targets without stored kind data fall back
to `Unknown`, which routes to `compute_for_library` (the safe default).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix rustfmt formatting in set_target_kind method - Regenerate package-lock.json with official npm registry (was using npmmirror.com which times out from GitHub Actions runners) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
infer_target_kind()usedlabel.contains("_import")to classify targets asjava_import, causing false positives for targets likefunds_csv_importerwhose names contain "import" but are actuallyjava_libraryrulesDependencyGraph.target_kinds, then look it up during classpath computation instead of guessing from the label nameChanges
graph.rstarget_kinds: HashMap<String, String>field,set_target_kind/get_target_kindmethods, populate kind during aspect ingestionclasspath.rsinfer_target_kind(label)calls withgraph.get_target_kind(label), removed the heuristic function and its testslib.rsinfer_target_kindfrom public re-exportsjni_exports.rsgraph.get_target_kind()inside the graph lockTest plan
get_target_kind(java_library, java_import, unknown, unrecognized)funds_csv_importertarget now correctly gets transitive depscargo test --workspace— all 113 tests passcargo clippy --workspace— cleancargo build -p bazel-jdt-core --release— builds successfully🤖 Generated with Claude Code