maven: decode the version from the Solr v field on core=gav responses - #82
Merged
andrew merged 2 commits intoSep 4, 2026
Merged
Conversation
…ion" FetchVersions and FetchPackage query the Maven Central search API with core=gav, where each document is one groupId:artifactId:version and the version is in the "v" field. searchDoc.Version was tagged json:"latestVersion" - a field that only exists on the default (non-gav) core, where a document aggregates an artifact - so every FetchVersions result came back with Number == "". The existing tests encode a searchDoc struct into the mock response and decode it with the same struct, so the field name never mattered; added TestFetchVersionsParsesRealSolrGavShape which feeds the raw JSON the API actually returns. Before (against real Solr): guava -> n=150, all Number == "" After: guava -> n=150, Number populated, contains "33.0.0-jre" Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
frankreyesgarcia
force-pushed
the
fix/maven-gav-version-parsing
branch
from
September 4, 2026 08:52
38f96cb to
f30fd24
Compare
|
@andrew |
frankreyesgarcia
added a commit
to frankreyesgarcia/yul
that referenced
this pull request
Sep 9, 2026
RegistryExistenceChecker (git-pkgs/enrichment's registries client, which
queries Maven Central's Solr search index) can return found/not-found
inconsistently for the same coordinate shortly after a version is
published - observed as a real false positive ("hallucinated version")
against a genuinely published release while benchmarking yul against real
projects. Existence now retries a registries.ErrNotFound, and separately a
queried version missing from an otherwise-real version list, once (300ms
backoff) before trusting either as a real miss.
Bumped github.com/git-pkgs/registries to v0.9.1, which includes upstream
PR git-pkgs/registries#82 fixing a related (but distinct) bug: versions
v0.8.1 and earlier decoded the wrong JSON field for Maven's core=gav Solr
response shape, so every returned version came back as an empty string.
Removed the old fixture-based hallucination benchmark (README/fixtures/
run.sh) - it fed crafted payloads straight to the yul binary and never
touched a real registry, so it couldn't have caught either bug.
Co-Authored-By: Claude Sonnet 5 <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.
Fixes #49.
FetchVersionsandFetchPackagequery Maven Central withcore=gav, where each result document carries the concrete version inv:{"g":"org.apache.maven","a":"maven-core","v":"3.9.11","timestamp":1757293341000}searchDoc.Versionwas taggedjson:"latestVersion"— a field that only exists on the default (non-gav) core, where a document aggregates an artifact. Decoding a realcore=gavresponse therefore leftVersionempty, soFetchVersionsreturned entries with blankNumber, andFetchPackage/FetchMaintainersresolved the effective POM against an empty version.The existing tests encode a
searchDocstruct into the mock response and decode it with the same struct, so the wrong field name round-tripped and was never exercised.Change
searchDoc.Version→json:"v".TestFetchVersionsParsesRealSolrGavShapefeeds the raw JSON the search API actually returns and asserts non-empty versions throughFetchVersions.Before / after (against real Maven Central)
Full
go test ./...passes.🤖 Generated with Claude Code