Populate Version#integrity for maven via .jar.sha1 sidecar - #1670
Conversation
Maven Central publishes a .sha1 sidecar next to each artifact; fetch <artifact>-<version>.jar.sha1 and map it to integrity as sha1-<hex>. Returns nil for pom-only artifacts (no jar). Refs ecosyste-ms#1630. Verified: stored integrity for dev.zio:zio-aws-autoscaling_3 5.17.225.2 matches an independent sha1 of the downloaded .jar (16d2a89f...); a full sync populated 507/507 versions of that package.
|
A couple of issues to flag before this can go in: 1. Tests are broken. Five existing maven tests now error with stub_request(:get, "https://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.11.0/maven-compiler-plugin-3.11.0.jar.sha1")
.to_return(status: 200, body: "abc123...")CI didn't run on this PR (fork from first-time contributor needs approval), which is why this wasn't caught. 2. No positive test for the new code. 3. Same rescue concern as #1669 — broad |
Per review on ecosyste-ms#1669: The .jar.sha1 fetch only does a network request (no JSON parse), so catch Faraday::Error, matching maven.rb:165 / :559.
Per review (ecosyste-ms#1670): - setup stubs .jar.sha1 with a 404 default so the existing versions_metadata tests no longer error on the new request - add a positive test (known sha1 -> sha1-<hex>) and a negative test (pom-only / 404 -> nil)
|
Thanks:
|
andrew
left a comment
There was a problem hiding this comment.
Thanks for the follow-ups. Setup stub catches the previously-failing requests (43 runs, 0 errors locally), and the two new version_integrity tests exercise both the happy path and the 404 case. LGTM.
Maven Central publishes a .sha1 sidecar next to each artifact; fetch
-.jar.sha1 and map it to integrity as sha1-.
Returns nil for pom-only artifacts (no jar). Refs #1630.
Verified: stored integrity for dev.zio:zio-aws-autoscaling_3 5.17.225.2
matches an independent sha1 of the downloaded .jar (16d2a89f...); a full
sync populated 507/507 versions of that package.