fix(lock): reject platform regressions during relock - #11664
Conversation
📝 WalkthroughWalkthroughLock processing now records structured per-platform outcomes. Before stale lock entries are pruned, unresolved and provenance-failed tasks are checked against prior platform support. Regression cases produce errors, while new unsupported platforms and ambiguous cases remain allowed. ChangesPlatform-aware lock pruning
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Poem
🚥 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 |
Greptile SummaryThe PR prevents relocks from dropping previously locked platform coverage when a replacement version cannot resolve.
Confidence Score: 4/5The PR is not yet safe to merge because cross-version regression matching can still reject a valid relock when one current version has multiple unrelated stale versions. The ambiguity guard only counts current result versions, while the regression check still scans every stale version under the same short name; failed relocks can preserve multiple stale records, allowing an unrelated platform entry to trigger an erroneous command failure. Files Needing Attention: src/cli/lock.rs Important Files Changed
Reviews (3): Last reviewed commit: "fix(lock): preserve existing platform co..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/cli/lock.rs (1)
1389-1427: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winGood coverage for the two documented regression scenarios.
test_platform_regression_rejects_unresolved_version_bumpandtest_platform_regression_allows_new_unsupported_platformcorrectly exercise the "loses previously supported platform" and "never supported this platform" cases described in the PR objective. Consider adding a case whereapply_lock_resultfails (provenance-style,unresolved: false,updated: false) for a platform the stale version supports, to pin down the behavior discussed at lines 1111-1128 once that categorization is confirmed.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/cli/lock.rs` around lines 1389 - 1427, The regression tests cover unresolved version bumps but omit apply_lock_result failures. Add a test alongside test_platform_regression_rejects_unresolved_version_bump that uses unresolved: false and updated: false for a platform listed in stale_versions, then assert platform_regression_errors reports the expected failure and locked-version details.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/cli/lock.rs`:
- Around line 315-320: In the lockfile-target loop in run, replace the immediate
Err return for platform_regressions with accumulation into a function-level
collection and continue processing the next target. After the loop completes,
propagate the aggregated platform-regression messages alongside the existing
all_provenance_errors handling so every lockfile target is processed and written
before reporting failure.
- Around line 1111-1128: Update the LockTaskResult construction for the
provenance-check error path in lockfile::apply_lock_result so it sets
unresolved: true instead of false. Keep the existing success/update handling
unchanged, ensuring provenance failures are included in the platform-regression
check.
---
Nitpick comments:
In `@src/cli/lock.rs`:
- Around line 1389-1427: The regression tests cover unresolved version bumps but
omit apply_lock_result failures. Add a test alongside
test_platform_regression_rejects_unresolved_version_bump that uses unresolved:
false and updated: false for a platform listed in stale_versions, then assert
platform_regression_errors reports the expected failure and locked-version
details.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: f21d6ae5-a9d3-431f-a7a1-699ee7684c4d
📒 Files selected for processing (1)
src/cli/lock.rs
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.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 56d6bc6. Configure here.

Summary
Root cause
A lockfile maintenance run in jdx/usage#773 resolved
github:crate-ci/cargo-release@latestfrom 1.1.2 to 1.1.0. The selected release had no Linux assets, somise lock --bumpskipped those entries, pruned 1.1.2, wrote an incomplete lockfile, and exited successfully. Renovate then committed a lockfile that failed under locked mode.This change treats that loss of previously locked platform coverage as an error while retaining the existing best-effort behavior for newly targeted unsupported platforms.
Validation
mise run formatcargo test cli::lock::testsmise run test:e2e e2e/lockfile/test_lockfile_bump e2e/cli/test_lock_resolution_failureAI-assisted — Tool: Codex; model: unavailable/unavailable; version: unavailable.
Note
Medium Risk
Changes lockfile write semantics and failure modes for
mise lock/--bump, which can block previously succeeding maintenance runs but prevents corrupt lockfiles.Overview
mise locknow fails instead of writing a lockfile when a version bump would drop platform coverage that existed on the version being pruned.Lock resolution results are tracked per tool/version/platform with statuses (Updated, Unresolved, ProvenanceFailed). After resolution,
platform_regression_errorscompares those results to stale versions slated for removal: if the new version cannot be locked for a platform but the old locked version could, the run errors before stale-version pruning or lockfile write for that target. Skips stay best-effort when the tool never had that platform, when the new version already has an entry, or when multiple current versions make the bump ambiguous.Provenance failures are aggregated with platform regressions into a single exit error. Unit tests cover the regression matrix.
Reviewed by Cursor Bugbot for commit ef104a2. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit