fix: handle non-semver cached versions in plugin installer#12265
Open
bsreeram08 wants to merge 3 commits intoanomalyco:devfrom
Open
fix: handle non-semver cached versions in plugin installer#12265bsreeram08 wants to merge 3 commits intoanomalyco:devfrom
bsreeram08 wants to merge 3 commits intoanomalyco:devfrom
Conversation
When a plugin is configured without a version (e.g. 'opencode-gemini-auth' instead of 'opencode-gemini-auth@1.3.8'), the version defaults to 'latest'. This caused semver.order() to throw 'Invalid SemVer: latest' because 'latest' is not a valid semver string. Two fixes: 1. Guard isOutdated() against non-semver cached versions by checking the format before passing to semver.order(), treating them as outdated so the package gets re-installed with a proper version 2. Prevent 'latest' from being persisted as a cached version in the dependency map, so subsequent runs don't encounter the invalid string 3. Validate cached versions before checking if outdated, removing corrupted cache entries Also adds comprehensive tests to verify the fix works correctly. Fixes anomalyco#12143
Contributor
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
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.
When a plugin is configured without a version (e.g. 'opencode-gemini-auth' instead of 'opencode-gemini-auth@1.3.8'), the version defaults to 'latest'. This caused semver.order() to throw 'Invalid SemVer: latest' because 'latest' is not a valid semver string.
Two fixes:
Also adds comprehensive tests to verify the fix works correctly.
Fixes #12143
What does this PR do?
Please provide a description of the issue (if there is one), the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the pr.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?