Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(rust): include toolchain install options in lock identity#9988

Merged
jdx merged 2 commits into
jdx:mainfrom
risu729:fix/rust-toolchain-lock-options
May 31, 2026
Merged

fix(rust): include toolchain install options in lock identity#9988
jdx merged 2 commits into
jdx:mainfrom
risu729:fix/rust-toolchain-lock-options

Conversation

@risu729

@risu729 risu729 commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • include rustup profile, components, and targets in lock identity
  • read those values from both tool options and rust-toolchain.toml
  • sort component and target lists before recording them for stable identity

Classification

Actual lock/install identity fix.

Rust installs are not just a channel/version. profile, components, and targets change the toolchain contents that rustup installs, and there is no locked artifact URL in mise.lock that fully represents those extra installed components or cross targets. A lock entry for stable with only the default profile is not equivalent to one that also installs clippy, rustfmt, or additional targets.

Verification

  • cargo fmt --check
  • cargo test rust_lockfile_options

Summary by CodeRabbit

  • New Features

    • Added lockfile option mappings support for Rust toolchain installations, enabling configuration of profile, components, and targets from toolchain settings or backend options.
  • Tests

    • Extended test coverage for lockfile options handling in both standard and idiomatic configuration modes.

@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 introduces ToolOptionSource::InstallManifest to the tool option resolution hierarchy, ensuring that options from install manifests are correctly prioritized. It also implements resolve_lockfile_options for the Rust plugin, allowing it to derive installation parameters such as profiles, components, and targets from idiomatic version files like rust-toolchain.toml. Review feedback suggests sorting the components and targets to maintain deterministic lockfile identities and identifies a redundant conditional check in the Rust plugin's option resolution logic that can be simplified.

Comment thread src/plugins/core/rust.rs
Comment thread src/plugins/core/rust.rs Outdated
@greptile-apps

greptile-apps Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a gap in the Rust lockfile identity by overriding resolve_lockfile_options on RustPlugin. Without this, two rust entries with different profile, components, or targets could share the same lockfile key despite producing different installations.

  • lockfile_options on RustOptions reuses the existing install_args resolution logic (idiomatic file takes precedence over tool options) and serialises the effective profile/components/targets into a canonical BTreeMap with components and targets sorted.
  • The new resolve_lockfile_options implementation parallels how other core backends (Python, Node, Ruby, etc.) expose their install-affecting options to the lock subsystem.
  • Two new unit tests verify the install-arg passthrough and the idiomatic-override behaviour.

Confidence Score: 5/5

Safe to merge — the change is additive and confined to how lockfile identity options are collected for the Rust backend.

The new resolve_lockfile_options override reuses the well-tested install_args resolution path and does not alter any installation or version-resolution logic. The only observable effect is that the lockfile now captures profile/components/targets, which is strictly more correct than the previous empty map. Sorting before joining ensures canonical representation so differently-ordered component lists produce the same lockfile key.

No files require special attention.

Important Files Changed

Filename Overview
src/plugins/core/rust.rs Adds lockfile_options to RustOptions and overrides resolve_lockfile_options on RustPlugin so that effective profile/components/targets (resolved from both tool options and rust-toolchain.toml, with the idiomatic file taking precedence) are included in the lockfile identity. Components and targets are canonically sorted before joining. Two new unit tests cover both the install-arg passthrough and idiomatic-override paths.

Reviews (4): Last reviewed commit: "fix(rust): stabilize toolchain lock opti..." | Re-trigger Greptile

Comment thread src/plugins/core/rust.rs Outdated
@risu729

risu729 commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

CI note: lint/test-ci are failing because cargo deny check now detects RUSTSEC-2026-0145 for astral-tokio-tar 0.6.1 via rattler_package_streaming. This appears unrelated to this PR: the current main branch is failing the same cargo-deny advisory in the test workflow, and test-ci only failed because lint failed.

This comment was generated by an AI coding assistant.

@risu729 risu729 force-pushed the fix/rust-toolchain-lock-options branch from 4f3ef20 to 816c8e9 Compare May 31, 2026 08:14
@risu729 risu729 marked this pull request as ready for review May 31, 2026 16:24
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 573f4634-6f07-4600-b970-94ce0f5cb121

📥 Commits

Reviewing files that changed from the base of the PR and between a0dd654 and 816c8e9.

📒 Files selected for processing (1)
  • src/plugins/core/rust.rs

📝 Walkthrough

Walkthrough

The Rust plugin now supports resolving lockfile option mappings for toolchain installations. A new lockfile_options helper derives profile, components, and targets from idiomatic toolchain configs or backend options, while a corresponding Backend::resolve_lockfile_options method integrates this into the plugin's backend interface.

Changes

Lockfile options feature for Rust toolchain

Layer / File(s) Summary
Type imports and dependencies
src/plugins/core/rust.rs
Module imports expanded to include PlatformTarget and ToolRequest, enabling new backend method signatures.
Lockfile options computation helper
src/plugins/core/rust.rs
RustOptions::lockfile_options converts resolved install arguments into a BTreeMap by extracting and formatting profile, sorted comma-joined components, and sorted comma-joined targets.
Backend integration and validation
src/plugins/core/rust.rs
RustPlugin's Backend::resolve_lockfile_options parses an idiomatic version file from ToolRequest::source(), computes options via the helper, and returns the map; unit tests validate both backend-only and idiomatic-override modes with profile and component precedence.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A Rust plugin now blooms with lockfile grace,
Computing options from their rightful place,
Profile and components in sorted array,
Idiomatic toolchains show the way!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: extending lock identity to include toolchain install options (profile, components, targets) from the raw_summary and pr_objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@jdx jdx merged commit 7054518 into jdx:main May 31, 2026
33 checks passed
@risu729 risu729 deleted the fix/rust-toolchain-lock-options branch May 31, 2026 18:02
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