Skip to content

fix(aqua): use versions list to install correct version#5371

Merged
jdx merged 12 commits into
jdx:mainfrom
risu729:aqua-version-prefix
Jun 21, 2025
Merged

fix(aqua): use versions list to install correct version#5371
jdx merged 12 commits into
jdx:mainfrom
risu729:aqua-version-prefix

Conversation

@risu729

@risu729 risu729 commented Jun 18, 2025

Copy link
Copy Markdown
Contributor

Fixes #5246.

I need to cache, maybe just the GitHub tag instead of the whole AquaPacakge?

At least, I can install biome@2.0.0 with this fix.

@risu729 risu729 force-pushed the aqua-version-prefix branch from dea2d3f to f21113c Compare June 18, 2025 22:43
@risu729 risu729 force-pushed the aqua-version-prefix branch from 2f0ec65 to fe71a40 Compare June 19, 2025 00:03
@github-actions

Copy link
Copy Markdown

If you are adding a new tool to mise, note the following:

  • New asdf plugins are not accepted
  • Tools may be rejected if they are not notable
  • A test is required in registry.toml

jdx pushed a commit that referenced this pull request Jun 20, 2025
I commented out `biome` test as the latest version `2.0.0` cannot be
installed until this fix will be merged.
#5371
@risu729

risu729 commented Jun 20, 2025

Copy link
Copy Markdown
Contributor Author

I'm thinking about how to cache them, and I've now realised we need to cache them in mise-versions.

However, I think including metadata (e.g. source GitHub tags for the aqua backend) in it requires us to parse, and makes mise slower.

1.9.3
1.9.4
2.0.0

So I'm now thinking of caching parsed Aqua packages. I mean, saving HashMap<String, AquaPackage> (String is a mise-style version, like 2.0.0) both on remote and local cache.

@risu729 risu729 marked this pull request as ready for review June 20, 2025 12:22
@risu729

risu729 commented Jun 20, 2025

Copy link
Copy Markdown
Contributor Author

I think this is now ready to be merged.

However, there are no remote caches for version_tags_cache, so mise install biome always resolves 20 GitHub tags. I don't think it won't be a huge problem, but it might slow down the CLI.
Also, MISE_LIST_ALL_VERSIONS is sometimes required to install old versions because the tag needs to be resolved.
For example, if the tag @biomejs/biome@2.0.0 is not included in the latest stable 20 releases, the same problem with #5246 should appear again.

@risu729 risu729 force-pushed the aqua-version-prefix branch from 027e9f6 to 29bfa42 Compare June 20, 2025 12:31
@risu729

risu729 commented Jun 20, 2025

Copy link
Copy Markdown
Contributor Author

I made a table to compare the behaviour. (Expected behaviours are just my guess)

Package Version String Expected 2025.6.5 #5371
biome 2.0.0
biome @biomejs/biome@2.0.0 (tag)
biome v2.0.0
biome 2.0.0-beta.5 ❌ (because not stable as in #5371 (comment))
biome @biomejs/biome@2.0.0-beta.5 (tag)
biome v2.0.0-beta.5
biome 1.9.4
biome v1.9.4 (tag without prefix)
biome cli/v1.9.4 (tag) ❌  
delta 0.18.2 (tag)
delta v0.18.2
eza 0.21.4
eza v0.21.4 (tag)

biome@@biomejs/biome@2.0.0 doesn't work, but this is because mise always prepends v prefix.
I think I can fix it in another PR.
https://github.com/risu729/mise/blob/865ffca66463b93d51f55038686c7a08ebfca179/src/backend/aqua.rs#L87

@risu729 risu729 marked this pull request as draft June 20, 2025 13:52
@risu729 risu729 force-pushed the aqua-version-prefix branch from 6cb2791 to 60ff607 Compare June 20, 2025 14:31
@risu729 risu729 marked this pull request as ready for review June 20, 2025 14:37
@jdx jdx merged commit ad6fd5b into jdx:main Jun 21, 2025
27 checks passed
@risu729 risu729 deleted the aqua-version-prefix branch June 21, 2025 12:59
jdx pushed a commit that referenced this pull request Jun 23, 2025
### 🚀 Features

- **(registry)** add wash by [@jtakakura](https://github.com/jtakakura)
in [#5386](#5386)

### 🐛 Bug Fixes

- **(aqua)** parse consecutive pipes in aqua templates by
[@risu729](https://github.com/risu729) in
[#5385](#5385)
- **(aqua)** use versions list to install correct version by
[@risu729](https://github.com/risu729) in
[#5371](#5371)
- **(registry)** talosctl use aqua by
[@mangkoran](https://github.com/mangkoran) in
[#5348](#5348)
- **(registry)** use aqua backend for watchexec by
[@risu729](https://github.com/risu729) in
[#5390](#5390)
- **(shim)** improve resolve_symlink for Windows by
[@qianlongzt](https://github.com/qianlongzt) in
[#5361](#5361)
- add compression-zip-deflate feature on self_update crate for windows
target by [@roele](https://github.com/roele) in
[#5391](#5391)
- suppress hint on 'cargo search mise' command by
[@roele](https://github.com/roele) in
[#5400](#5400)

### 📚 Documentation

- Fix typo in README.md - Install mise by
[@cytsai1008](https://github.com/cytsai1008) in
[#5366](#5366)
- Document trivial task syntax by
[@JayBazuzi](https://github.com/JayBazuzi) in
[#5352](#5352)

### 🧪 Testing

- **(registry)** fix vultr test by
[@risu729](https://github.com/risu729) in
[#5372](#5372)

### 📦️ Dependency Updates

- update autofix-ci/action action to v1.3.2 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#5377](#5377)
- update docker/setup-buildx-action digest to e468171 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#5376](#5376)

### Chore

- update expr-lang crate to v0.3.2 by
[@risu729](https://github.com/risu729) in
[#5364](#5364)
- show curl error by [@jdx](https://github.com/jdx) in
[729aa4a](729aa4a)
- fix latest version fetch by [@jdx](https://github.com/jdx) in
[729aadc](729aadc)
- update vfox.rs crate to v1.0.3 by
[@risu729](https://github.com/risu729) in
[#5393](#5393)
- updated deps by [@jdx](https://github.com/jdx) in
[#5403](#5403)

### Ci

- use cargo info to retrieve latest mise version by
[@risu729](https://github.com/risu729) in
[#5401](#5401)

### New Contributors

- @jtakakura made their first contribution in
[#5386](#5386)
- @JayBazuzi made their first contribution in
[#5352](#5352)
- @cytsai1008 made their first contribution in
[#5366](#5366)
jdx pushed a commit that referenced this pull request Jun 23, 2025
My apologies, #5371 broke the version
order in `ls-remote`.

I misused `BTreeMap`, the key was `String`, not semver, so the versions
were just compared lexicographically.

This PR fixes the regression by using `Vec<(String, String)>` instead of
`BTreeMap`. I can also use `IndexMap`, but it seemed it's only used in
`build.rs` so I guessed it's not preffered.
andreabedini pushed a commit to andreabedini/mise that referenced this pull request Jul 1, 2025
My apologies, jdx#5371 broke the version
order in `ls-remote`.

I misused `BTreeMap`, the key was `String`, not semver, so the versions
were just compared lexicographically.

This PR fixes the regression by using `Vec<(String, String)>` instead of
`BTreeMap`. I can also use `IndexMap`, but it seemed it's only used in
`build.rs` so I guessed it's not preffered.
jdx pushed a commit that referenced this pull request Jul 5, 2025
Fixes the issue I wrote in
#5371 (comment).

The cause of the issue was that mise tried to find the
`version_override` with a v-prefixed version.
For example, even if the input was the full GitHub tag like
`@biomejs/biome@2.0.0-beta.5`, it tried to find the override for
`v@biomejs/biome@2.0.0-beta.5`.
This led to it finding the fallback override, which has `cli/` for the
`version_prefix`.
The simple fix is to find the override without the v-prefix.

However, this would break packages that rely on the v-prefix in the
`version_constraint`.
So, I ended up finding the override that matches either the input
version or the v-prefixed version.
This means it tries to find the first override that matches one of
`v@biomejs/biome@2.0.0-beta.5` or `@biomejs/biome@2.0.0-beta.5` for the
previous example.
In this way, we can correctly find the override for most packages.

Also, this PR removes the retry logic when a GitHub tag is found from
`get_version_tags` or if the input version already has a `v` prefix.
This will allow it to fail fast and also simplify the error log.

Package | Version String | `2025.6.8` | #5474
-- | -- | -- | --
biome | 2.0.0 |✅ | ✅
biome |
[@biomejs/biome@2.0.0](https://github.com/biomejs/biome/releases/tag/%40biomejs%2Fbiome%402.0.0)
(tag) | ❌ | ✅
biome | v2.0.0 | ❌ | ❌
biome | 2.0.0-beta.5 | ❌ | ❌
biome |
[@biomejs/biome@2.0.0-beta.5](https://github.com/biomejs/biome/releases/tag/%40biomejs%2Fbiome%402.0.0-beta.5)
(tag) | ❌ |✅
biome | v2.0.0-beta.5 | ❌ |❌
biome | 1.9.4 | ✅ | ✅
biome | v1.9.4 (tag without prefix) | ✅ | ✅
biome |
[cli/v1.9.4](https://github.com/biomejs/biome/releases/tag/cli%2Fv1.9.4)
(tag) | ❌ | ✅
delta |
[0.18.2](https://github.com/dandavison/delta/releases/tag/0.18.2) (tag)
| ✅ | ✅
delta | v0.18.2 | ❌ |❌
eza | 0.21.4 | ✅ | ✅
eza |
[v0.21.4](https://github.com/eza-community/eza/releases/tag/v0.21.4)
(tag) | ✅ | ✅

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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