Skip to content

fix(upgrade): handle lone v prefix in --bump latest queries#10130

Merged
jdx merged 2 commits into
jdx:mainfrom
zeitlinger:fix/v-prefix-bump-query
May 29, 2026
Merged

fix(upgrade): handle lone v prefix in --bump latest queries#10130
jdx merged 2 commits into
jdx:mainfrom
zeitlinger:fix/v-prefix-bump-query

Conversation

@zeitlinger

Copy link
Copy Markdown
Contributor

Summary

  • fix mise upgrade --bump / mise outdated --bump when a tool is pinned with a lone leading v prefix
  • treat v/V as version syntax rather than a backend or vendor prefix when building the latest-version query
  • add a regression e2e test covering shfmt = "v3.12.0"

Root cause

--bump splits 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 query v3.

The aqua backend normalizes tags like v3.13.1 to bare versions like 3.13.1, so querying for v3 returned no match and emitted no latest version found even though the tool was up to date.

Validation

  • cargo test test_prefixed_latest_query
  • manual repro with a built binary before/after the fix using:
    • [tools] shfmt = "v3.13.1"
    • mise up -lvn shfmt

Notes

I also added an e2e regression test, but I could not run the full mise run test:e2e e2e/core/test_v_prefix_bump_query task locally because the environment failed while installing npm:prettier@3 through aube with a permission error under ~/.local/share/aube/....

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>

@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 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.

@zeitlinger zeitlinger marked this pull request as ready for review May 29, 2026 07:19
@greptile-apps

greptile-apps Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes mise upgrade --bump / mise outdated --bump for tools pinned with a leading v prefix (e.g. shfmt = "v3.12.0"). The root cause was that prefixed_latest_query emitted a fuzzy query like v3, which aqua backends couldn't resolve because they normalise tags to bare versions like 3.13.1.

  • prefixed_latest_query now short-circuits for a lone v/V prefix (returning None) so the backend receives an unconstrained latest-version query instead of an unresolvable v3 prefix query.
  • The strip_prefix fallbacks in the bump calculation are changed from unwrap_or_default() (→ "") to unwrap_or(&oi.latest), so a bare-version response like "3.13.1" is correctly combined with the stored prefix to produce "v3.13.1".
  • A regression e2e test is added alongside new unit tests in outdated_info.rs.

Confidence Score: 5/5

Safe 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

Filename Overview
src/toolset/outdated_info.rs Two-part fix: prefixed_latest_query now returns None for a lone v/V prefix so backends with bare-version tags (like aqua) receive an unconstrained latest query; strip_prefix fallbacks changed from unwrap_or_default() (empty string) to unwrap_or(&oi.latest) so bare-version responses like '3.13.1' are correctly combined with the stored v prefix to produce 'v3.13.1'. Both fixes are logically correct and well-tested.
e2e/core/test_v_prefix_bump_query New regression test for the v-prefix bump fix. The assert_contains assertion hardcodes v3.13.1, which will break in CI as soon as shfmt releases a newer version.

Reviews (2): Last reviewed commit: "fix(upgrade): preserve bare latest versi..." | Re-trigger Greptile

Comment thread e2e/core/test_v_prefix_bump_query
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger

Copy link
Copy Markdown
Contributor Author

Addressing the Greptile finding and lint failure:

  • preserve the full bare latest version when the configured prefix is a lone v/V and the backend returns 3.13.1
  • extend the regression coverage to assert the dry-run bump target is v3.13.1
  • fix the new e2e test formatting so shfmt passes

Validated with targeted unit tests plus a manual repro using the built binary.

@jdx jdx merged commit e776a0f into jdx:main May 29, 2026
32 checks passed
@jdx

jdx commented May 29, 2026

Copy link
Copy Markdown
Owner

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

@zeitlinger

Copy link
Copy Markdown
Contributor Author

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.

@zeitlinger zeitlinger deleted the fix/v-prefix-bump-query branch May 29, 2026 17:57
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