Repository navigation
feat(external-systems): link Java/Kotlin imports to Maven coordinates - #4601
Aman-goel-04 wants to merge 3 commits into
Conversation
|
Thanks @Aman-goel-04. Whole-segment longest-prefix matching that only links when a manifest declares the exact coordinate is the precision-first shape we want. Two bot findings in |
|
🔍 1 thing to check
✅ Health of changed files: 10.0 (unchanged) 👀 Suggested reviewers @RaghavChamadiya 📊 See the full report for this PR Settings and updatesBlast radius, every caller of the contracts it changes, and health before and after. No sign-in. |
|
Thanks for reviewing, done, tests added too. CI should be green now. Pls go ahead w the merge once it's green. |
|
Please go ahead with the merge! |
Summary
group:artifactthey come from, sorepowise report inventoryno longer reports "N declared package(s), 0 imported through the import graph" on JVM repos. The linker only tried the import path and its first dotted segment, which can never equal agroup:artifactdeclared name.group:artifacttable (external_systems/jvm_packages.py, about 100 common artifacts: Guava, Jackson, Gson, Commons, JUnit 4/5, Mockito, Spring, SLF4J/Logback, Jakarta, kotlinx, etc.). It matches the longest prefix on whole dotted segments.declaration_name_candidatesoffers the mapped names right after the whole name and ahead of the generic first-segment fallback.com.google.common.truth->truth, notguava). An empty tuple fences a prefix off entirely (e.g.com.google.gson.protobuf, which is not in the gson jar).maven:group:artifactquery form (parse_query).Related Issues
Closes #4489
Test Plan
pytest)ruff check .)npm run build); n/a, no frontend changesNew tests in
tests/unit/analysis/test_external_systems_links.py(29 pass in that file):com.google.common.collectresolves to a declaredcom.google.guava:guavaorg.junit.Test->junit:junit,org.junit.jupiter.api.Test->junit-jupiter-api)org.junitx.Foostays unlinked)requests.adaptersstill resolves torequests, and its candidates are unchangedtruth,guava-testlib) are not linked to guavacom.google.gson.protobuf*) stays unlinked even whengsonis declaredRepro from the issue (google/gson,
repowise init --yes --no-prose, thenrepowise report inventory --format markdown):Before:
12 component(s); 15 declared package(s), 0 imported through the import graphAfter:
12 component(s); 15 declared package(s), 4 imported through the import graphLinked external nodes after the fix, by declared package:
com.google.guava:guavacom.google.guava:guava-testlibcom.google.protobuf:protobuf-javajunit:junitcom.fasterxml.jackson.core:jackson-databindcom.google.errorprone:error_prone_annotationscom.google.truth:truthcom.google.truth.extensions:truth-proto-extensionorg.junit.jupiter:junit-jupiterImports from packages the repo does not declare (jackson-core, caliper, test-parameter-injector) stay unlinked, as do gson's own generated protobuf classes.
Notes for reviewers
repowise initto pick them up.repowise reindexdoes not rebuild them.~/.m2or Gradle cache, which the issue lists as an optional addition. Gradle declarations will link once feat(inventory): read Gradle build scripts into the declared package store #4488 lands, provided they use thegroup:artifactname form.Checklist