Repository navigation
fix(cli): find get -v versions beyond the metadata's 100 newest - #2472
Conversation
netomi
left a comment
There was a problem hiding this comment.
Thanks, the fallback fixes a real gap and only kicks in when allVersions has no match, so the common path is unchanged. Tests pass on top of current main; cli/CHANGELOG.md conflicts with main and needs a rebase.
Two things before this goes in:
- Errors turn into a false "no published version matching" (inline below).
/versionsinstead of/version-references./api/{namespace}/{extension}[/{target}]/versionswas added in the same commit asversion-references(334730c), so it is available wherever the latter is. It returns one entry per version with its URL (the server counts distinct versions), rather than one per version and target platform. That removes the deduplication, divides the number of requests by the number of platforms (an extension with 10 platforms and 300 versions needs 3 requests instead of 30), and the match can be fetched from the returned URL like theallVersionsbranch does. It needs a smallgetVersionsinregistry.ts.
Nits:
- The paging loop is close to the one in
show.ts; with both on the same endpoint it could live inregistry.ts. - A constraint that matches nothing now pages through every version before failing. Fine, just noting it for large extensions.
- Missing tests: a registry without the endpoint (same error as before) and a page that fails mid-way.
Metadata allVersions lists at most the 100 highest versions, so get -v failed for older versions the registry still serves. When allVersions has no match, page through version-references and pick the highest matching version from there.
A failed page of version references ended the lookup with what had been collected, so a timeout or server error reported "no published version matching" for a version that exists. Only a 404 on the first page now means the endpoint is unavailable; other failures are rethrown.
/versions lists each version once with its URL, while version-references lists one entry per version and target platform. Paging it needs fewer requests on multi-platform extensions (7 instead of 41 for redhat.java) and no deduplication, and the match is fetched from its returned URL.
233c5a9 to
74863d6
Compare
|
Agreed on 2: switched to That leaves show as the only user of version-references, so the paging loops no longer share an endpoint and stay where they are. |
findMatchingVersion is async now, so a throw already becomes a rejection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
netomi
left a comment
There was a problem hiding this comment.
Thanks, both points are addressed: only a 404 on the first page falls back to the old message, and /versions removes the deduplication. Tests, lint and tsc pass, and the build finds Vue.volar 1.8.0 on open-vsx.org.
I pushed 39c0812 to drop the now redundant try/catch around the allVersions fetch and updated the description to describe /versions.
ovsx get -vonly looked for matches in the metadata'sallVersions, which the server caps at the 100 highest versions (MAX_VERSIONSinRepositoryService). Older versions failed with "no published version matching" even though the registry serves them. For example,Vue.volarhas 170 versions andallVersionsstops at1.8.13, soovsx get Vue.volar -v 1.8.0failed while/api/Vue/volar/1.8.0returns 200.When
allVersionshas no match,getnow pages through/api/{namespace}/{name}[/{target}]/versions, 100 entries per page. It lists each version once with its metadata URL, sogetpicks the highest match withsemver.maxSatisfyingand fetches it from that URL. A constraint that matches inallVersionssends no extra requests. A registry without the endpoint (404 on the first page) returns the same error as before; any other failure, on any page, is reported instead of "no published version matching".Testing
Before
After