Repository navigation
fix(github): install versions listed from tags that repeat version_prefix - #13317
Conversation
…efix With `version_prefix = "a-"` configured, the tag `a-a-1.2.3` is listed as `a-1.2.3`, so the listed version still starts with the prefix. On install the candidate tags were `a-1.2.3` and `1.2.3` -- the tag the version was listed from was never tried, so the version mise printed could not be installed. Reconstruct the tag by prefixing the version even when it already starts with the prefix, and strip only one prefix rather than every repetition, so a listed version always round-trips to its own tag. Candidate tags are now built by a pure `tag_candidates` helper and deduplicated, so an empty or self-matching prefix no longer spends two requests on the same tag. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesGitHub tag resolution
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The release-tag resolution update has no identified merge-blocking issue. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Stripping exactly one `version_prefix` dropped a fallback the previous `trim_start_matches` provided: a version written with the prefix repeated, such as `a-a-1.2.3` with `version_prefix = "a-"`, used to fall back to the bare tag `1.2.3` and no longer did. Append the fully-stripped version as a last candidate. Stripping once stays ahead of it, since that is the inverse of how the version was listed, so the round-trip ordering is unchanged and only the lost fallback comes back. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Instruction counts
No instruction-count regression above 1%. Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.
|
A
github:-backed tool whose release tags repeat the configuredversion_prefixlisted versions that could not be installed back.With this config:
and the upstream tag
a-a-1.2.3,mise ls-remoteprintsa-1.2.3— the prefix is stripped once, so the listed version still starts with the prefix. On install, mise reconstructed the tag from that version asa-1.2.3and then1.2.3, and never trieda-a-1.2.3. Every listed version for such a repo failed to install, including whateverlatestresolved to.What changed
version_prefixis configured,prefix + versionis now tried first even when the version already starts with the prefix. That candidate is the only one that names the tag the version was listed from, so a listed version always round-trips to its own tag.trim_start_matchesdid). Nothing that used to resolve stops resolving; the better guess just goes first.tag_candidateshelper and deduplicated, so an empty or self-matching prefix no longer spends two HTTP requests on the same tag.Before,
a-1.2.3withversion_prefix = "a-"produced the candidatesa-1.2.3,1.2.3. It now producesa-a-1.2.3,a-1.2.3,1.2.3.Nothing that resolved before stops resolving — the bare version is still tried, just second. The one behavior change: if a repo publishes both
a-1.2.3anda-a-1.2.3, the version stringa-1.2.3now resolves toa-a-1.2.3. That is the correct reading, sincea-1.2.3is what mise lists for the doubled tag, but someone hand-writing the shorter tag pays one extra 404 and gets the other release. This is documented ontag_candidates.strip_version_prefixis unchanged: it already strips a single prefix, which the install path can now invert. Making it refuse to strip ambiguous tags would change whatls-remoteprints without fixing anything.Validation
Three new unit tests in
src/backend/static_helpers.rsfail on the old logic and pass on the new one — two overtag_candidatesdirectly, and one#[tokio::test]end to end throughtry_with_v_prefix_and_repowhere only the real taga-a-1.2.3resolves. A fourth pins the no-prefix candidate order, andtest_version_prefix_functionalityinsrc/backend/github.rsnow pins the listing side of the round-trip.Unit tests only: the bug is entirely in candidate construction, and an e2e test would need a public repo that actually ships a doubled-prefix tag.
cargo test --bin mise backend::passes (704), andcargo clippy --workspace --all-features --all-targets -- -D warningsis clean.Raised by a review bot on #13308 and deliberately left out of it; that PR only changes an error message, and the version it suggests is the same string mise lists everywhere, so it stays as is.
🤖 Generated with Claude Code
AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: unavailable.
Note
Medium Risk
Changes GitHub release tag resolution order for prefixed versions; mostly fixes broken installs but can prefer a different tag when both short and doubled-prefix releases exist.
Overview
Fixes GitHub backend installs when release tags repeat the configured
version_prefix(e.g. taga-a-1.2.3withversion_prefix = "a-"listed asa-1.2.3). Install no longer stops at wrong reconstructions likea-1.2.3/1.2.3and skips the real tag.Tag lookup is refactored around a new
tag_candidateshelper used bytry_with_v_prefix_and_repo. With a custom prefix,prefix + versionis tried first even when the version already starts with that prefix, so listed versions round-trip to their source tag. Prefix stripping on candidates uses onestrip_prefixstep (matching listing) before a last-resort fulltrim_start_matches. Candidates are deduplicated so empty or redundant prefixes do not double-fetch the same tag.Tests cover repeated-prefix listing/install, candidate ordering, deduplication, and an async resolver path;
strip_version_prefixingithub.rsdocuments the doubled-prefix listing case.Behavior note: if both
a-1.2.3anda-a-1.2.3exist, requestinga-1.2.3now prefers the tag mise would list for the doubled form (a-a-1.2.3).Reviewed by Cursor Bugbot for commit 6cd301a. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
Tests