Skip to content

fix(aqua): resolve bin paths for prefixed v tags#9759

Merged
jdx merged 3 commits into
jdx:mainfrom
risu729:fix/aqua-bin-path-version-candidates
May 9, 2026
Merged

fix(aqua): resolve bin paths for prefixed v tags#9759
jdx merged 3 commits into
jdx:mainfrom
risu729:fix/aqua-bin-path-version-candidates

Conversation

@risu729

@risu729 risu729 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep Aqua list_bin_paths() local-only while allowing file path templates to try both canonical and prefixed-v tag-shaped versions.
  • Use the already-resolved install version when creating Aqua file links during install.
  • Add unit coverage for version-prefix packages whose actual tags include an extra v after the prefix, such as tool-v1.2.3 for canonical 1.2.3.

Why

PR #5562 aligned list_bin_paths() with install-time version resolution by sharing the full resolver, but it was reverted in #5574 after the hyperfine check showed a serious slowdown.

The slowdown came from putting remote resolution on the PATH/bin-path path: the shared resolver could fetch GitHub tags/releases, probe URLs/HEADs, and build fallback errors even when list_bin_paths() only needed local installed file paths.

This keeps the fix local-only. list_bin_paths() still reads registry metadata and installed files through the existing cache, but does not call get_version_tags(), get_url(), github_release_*, or HTTP.head(). Install already has the resolved tag/version, so it passes that directly into file-link creation instead of recomputing from the canonical version.

Tests

  • /home/risu/.cargo/bin/cargo test -p mise test_version_candidates
  • /home/risu/.cargo/bin/cargo test -p mise test_srcs_
  • /home/risu/.cargo/bin/cargo test -p mise backend::aqua::tests
  • git diff --check

@greptile-apps

greptile-apps Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes binary-path resolution for Aqua packages whose git tags include an extra v after a non-v-ending prefix (e.g., canonical 1.2.3 maps to tag tool-v1.2.3). It does so locally, without the remote-fetch overhead that caused the revert of #5562.

  • version_candidates(): new helper that emits one or two candidates — the prefix-applied form and, when the prefix doesn't already end in v, a second form with v inserted after the prefix. Deduplication via .unique() prevents redundant file-link generation.
  • Install path: passes the already-resolved tag (v) to srcs_for_platform directly, so only the exact installed path is generated (no speculative candidates needed at install time).
  • list_bin_paths path: still goes through the srcs wrapper with tv.version; the two candidates produced by version_candidates let the p.exists() filter naturally select whichever layout was actually unpacked on disk.

Confidence Score: 5/5

Safe to merge — the change is local-only, never triggers remote I/O, and the existing existence-filter in list_bin_paths naturally discards whichever candidate paths don't match the installed layout.

The logic is narrow and well-tested: version_candidates covers all reachable cases (no prefix, prefix ending in v, prefix not ending in v, version already including the prefix), the unit tests exercise both the canonical and pre-resolved-tag call paths, and deduplication guards against redundant links. No existing invariants are broken.

No files require special attention.

Important Files Changed

Filename Overview
src/backend/aqua.rs Introduces version_candidates() to generate both plain and v-prefixed tag variants for file path resolution; install now passes the already-resolved tag instead of the canonical version, and list_bin_paths inherits the multi-candidate logic to find whichever path actually exists on disk.

Reviews (3): Last reviewed commit: "Merge branch 'main' into fix/aqua-bin-pa..." | Re-trigger Greptile

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request refactors version handling in the AquaBackend by introducing a version_candidates helper to generate potential version strings, including those with 'v' prefixes. Feedback identifies a logic flaw where already-prefixed versions might skip the 'v' variant, potentially causing installation failures, and suggests optimizing performance by moving the candidate generation outside the file iteration loop.

Comment thread src/backend/aqua.rs
Comment thread src/backend/aqua.rs Outdated
@risu729

This comment was marked as outdated.

@risu729 risu729 marked this pull request as ready for review May 9, 2026 20:44
@jdx jdx merged commit 5be16cf into jdx:main May 9, 2026
33 checks passed
@risu729 risu729 deleted the fix/aqua-bin-path-version-candidates branch May 10, 2026 05:25
mise-en-dev added a commit that referenced this pull request May 10, 2026
### 🚀 Features

- add --inactive option to outdated and upgrade commands for inactive
tools by @roele in [#9640](#9640)

### 🐛 Bug Fixes

- **(aqua)** resolve bin paths for prefixed v tags by @risu729 in
[#9759](#9759)
- **(bun)** create bunx alongside bun.exe on Windows install by
@JamBalaya56562 in [#9732](#9732)
- **(dotnet)** use shared prerelease tool option by @risu729 in
[#9720](#9720)
- **(node)** use matching node in npm shim by @jdx in
[#9749](#9749)
- **(task)** resolve bash deterministically on Windows to avoid WSL
launcher by @JamBalaya56562 in
[#9750](#9750)

### 📚 Documentation

- **(secrets)** clarify age strict mode default by @risu729 in
[#9737](#9737)
- **(tasks)** add bash shebang to conditional-dependencies example by
@JamBalaya56562 in [#9747](#9747)
- update backend tool option docs by @risu729 in
[#9738](#9738)

### 📦 Registry

- remove tools with zero users by @jdx in
[#9725](#9725)
- add scalafmt
([github:scalameta/scalafmt](https://github.com/scalameta/scalafmt)) by
@pokir in [#9757](#9757)
- remove flarectl by @risu729 in
[#9756](#9756)

### Chore

- **(release)** strip pre-existing sponsor block before appending
canonical one by @jdx in [#9745](#9745)

### New Contributors

- @pokir made their first contribution in
[#9757](#9757)
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