fix(upgrade): handle lone v prefix in --bump latest queries#10130
Conversation
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
There was a problem hiding this comment.
Code Review
This pull request addresses an issue where mise upgrade --bump fails to resolve the latest release for tools pinned with a leading 'v' or 'V' prefix (such as 'v3.12.0') when the backend uses normalized bare versions (such as '3.13.1'). The prefixed_latest_query function in src/toolset/outdated_info.rs has been updated to treat a lone 'v' or 'V' as version syntax rather than a backend prefix. Unit tests and an integration test have been added to verify this behavior. There are no review comments, and I have no feedback to provide.
Greptile SummaryThis PR fixes
Confidence Score: 5/5Safe to merge — both code changes are correct and well-unit-tested; the only concern is a fragile version string in the e2e test. The core logic changes are straightforward and correct: returning None for a lone v/V prefix avoids sending an unresolvable query to aqua, and the unwrap_or(&oi.latest) fallback ensures bare-version responses are handled correctly. The new unit tests cover both cases. The only weakness is the hardcoded v3.13.1 in the e2e regression test, which will become a false failure once shfmt ships a newer release — but that does not affect correctness of the production code. e2e/core/test_v_prefix_bump_query — the hardcoded shfmt version in the assertion will cause spurious CI failures once shfmt releases a newer version. Important Files Changed
Reviews (2): Last reviewed commit: "fix(upgrade): preserve bare latest versi..." | Re-trigger Greptile |
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
|
Addressing the Greptile finding and lint failure:
Validated with targeted unit tests plus a manual repro using the built binary. |
|
to be clear, putting "v" prefixes in mise.toml is not a supported use-case, I went ahead and merged this because it's a minor fix but generally speaking you should not be doing that |
got it - maybe is should print a warning to tell users to migrate? or at least in doctor. |
Summary
mise upgrade --bump/mise outdated --bumpwhen a tool is pinned with a lone leadingvprefixv/Vas version syntax rather than a backend or vendor prefix when building the latest-version queryshfmt = "v3.12.0"Root cause
--bumpsplits the configured version into a prefix and numeric portion before asking the backend for the latest matching version.For a pin like
v3.13.1, that produced the fuzzy queryv3.The aqua backend normalizes tags like
v3.13.1to bare versions like3.13.1, so querying forv3returned no match and emittedno latest version foundeven though the tool was up to date.Validation
cargo test test_prefixed_latest_query[tools] shfmt = "v3.13.1"mise up -lvn shfmtNotes
I also added an e2e regression test, but I could not run the full
mise run test:e2e e2e/core/test_v_prefix_bump_querytask locally because the environment failed while installingnpm:prettier@3throughaubewith a permission error under~/.local/share/aube/....