fix: Make plugin test resolve latest version#2246
Closed
maciektr wants to merge 4 commits into
Closed
Conversation
Stratus3D
reviewed
Apr 24, 2026
| query := strings.TrimPrefix(toolVersion, "latest") | ||
| query = strings.TrimPrefix(query, ":") | ||
| resolved, err := versions.Latest(plugin, query) | ||
| if err != nil || resolved == "" { |
Member
There was a problem hiding this comment.
This || resolved == "" check should not be needed.
There was a problem hiding this comment.
Pull request overview
This PR fixes asdf plugin test so that when --asdf-tool-version=latest (or latest:<query>) is provided, it resolves to an actual version (via the plugin’s latest-stable/list-all callbacks) instead of passing the literal string latest through to installation.
Changes:
- Resolve
--asdf-tool-version latest/latest:<query>inplugin testusinginternal/versions.Latest. - Add a Bats test covering the
latestresolution behavior. - Update the dummy plugin fixture to fail if it is asked to install a literal
latestversion, ensuring the test meaningfully validates the fix.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
internal/cli/cli.go |
Adds latest/latest:<query> resolution logic in pluginTestCommand before installing. |
test/plugin_test_command.bats |
Adds a regression test asserting plugin test succeeds when --asdf-tool-version latest is provided. |
test/fixtures/dummy_plugin/bin/install |
Makes the dummy plugin installation fail on literal latest to catch regressions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
If
--asdf-tool-version=latestis passed toplugin test, it should resolve the version correctly, instead of passinglatestdirectly.This change mimics the one of the old bash plugin:
asdf/lib/commands/command-plugin-test.bash
Lines 129 to 138 in 31e8c93
It also adds a test case to ensure correct behaviour of the changed code.
Fixes: #2193
Other Information