Skip to content

fix(cli): find get -v versions beyond the metadata's 100 newest - #2472

Merged
netomi merged 4 commits into
eclipse-openvsx:mainfrom
trivikr:cli-find-versions-beyond-newest
Dec 1, 2026
Merged

netomi merged 4 commits into
eclipse-openvsx:mainfrom
trivikr:cli-find-versions-beyond-newest

Conversation

@trivikr

@trivikr trivikr commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

ovsx get -v only looked for matches in the metadata's allVersions, which the server caps at the 100 highest versions (MAX_VERSIONS in RepositoryService). Older versions failed with "no published version matching" even though the registry serves them. For example, Vue.volar has 170 versions and allVersions stops at 1.8.13, so ovsx get Vue.volar -v 1.8.0 failed while /api/Vue/volar/1.8.0 returns 200.

When allVersions has no match, get now pages through /api/{namespace}/{name}[/{target}]/versions, 100 entries per page. It lists each version once with its metadata URL, so get picks the highest match with semver.maxSatisfying and fetches it from that URL. A constraint that matches in allVersions sends 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

$ npx ovsx get Vue.volar -v 1.8.0
❌  Extension Vue.volar has no published version matching '1.8.0'

After

$ ./bin/ovsx get Vue.volar -v 1.8.0
Downloading Vue.volar-1.8.0 to ...

@netomi netomi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Errors turn into a false "no published version matching" (inline below).
  2. /versions instead of /version-references. /api/{namespace}/{extension}[/{target}]/versions was added in the same commit as version-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 the allVersions branch does. It needs a small getVersions in registry.ts.

Nits:

  • The paging loop is close to the one in show.ts; with both on the same endpoint it could live in registry.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.

Comment thread cli/src/get.ts Resolved
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.
@trivikr
trivikr force-pushed the cli-find-versions-beyond-newest branch from 233c5a9 to 74863d6 Compare November 27, 2026 19:32
@trivikr

trivikr commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Agreed on 2: switched to /versions with a getVersions in registry.ts in 74863d6

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 netomi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@netomi
netomi merged commit f76417b into eclipse-openvsx:main Dec 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants