Skip to content

fix(ruby): lock resolved install options#9992

Merged
jdx merged 12 commits into
jdx:mainfrom
risu729:fix/ruby-build-lock-options
Jun 5, 2026
Merged

fix(ruby): lock resolved install options#9992
jdx merged 12 commits into
jdx:mainfrom
risu729:fix/ruby-build-lock-options

Conversation

@risu729

@risu729 risu729 commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • include resolved Ruby install options in lock identity, including defaults such as compile mode, installer choice, the active build repo, and precompiled URL
  • include source-build options and patch inputs that can change compiled output or fallback output
  • add backend-level regression coverage for precompiled, experimental-default, resolved-default, source-build, fallback, and ruby-install paths

Rationale

Lock option values are part of the artifact identity. Recording resolved defaults keeps existing lockfiles stable if mise defaults change later, including Ruby's planned move toward precompiled binaries by default.

Classification

Mixed actual lock/install identity and stale-lock invalidation fix.

Actual identity: source-build settings such as installer choice, build repositories, build options, and patch inputs can change the compiled Ruby tree for the same version. Those inputs are not represented by a locked artifact URL.

Stale-lock invalidation: precompiled URL/platform selector settings mostly choose the binary artifact URL/checksum. Once the lock entry is selected, the locked URL identifies the binary, but the selector still belongs in the exact-options key so changing precompiled source or platform settings does not reuse an older lock entry.

Verification

  • cargo fmt --check
  • git diff --check
  • cargo test ruby_lockfile_options
  • GitHub Actions test workflow on 0d98b51f1 passed, including unit tests, lint, e2e shards, Windows, and test-ci
  • GitHub Actions hyperfine, registry, and release workflows on 0d98b51f1 passed or skipped only expected matrix jobs

Summary by CodeRabbit

  • Improvements

    • Ruby lockfile resolution now honors explicit precompiled OS/arch overrides, consistently derives precompiled vs source-build behavior from settings, always includes install/build options and optional patch application, and injects precompiled download info when precompiled mode is used; Windows targets return an empty result.
  • Tests

    • Added deterministic tests and scaffolding covering explicit precompiled, source-build (with opts/patches), experimental/default behaviors, non-current targets, fallback cases, and override-driven precompiled URL resolution.

@greptile-apps

greptile-apps Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extends the Ruby lock identity to include resolved install options — compile mode, installer choice, build repositories, build flags, patch sources, and precompiled URL/platform selectors — so that changing any of these settings (including mise's own defaults) correctly invalidates the lockfile rather than silently reusing a stale entry.

  • resolve_lockfile_options is rewritten to always emit compile, ruby_install, the active installer's repo and opts, optional patches, and (when in precompiled mode) the precompiled URL and platform overrides. Windows targets return an empty map since they use RubyInstaller2.
  • precompiled_platform_for_target gains the same user-override (precompiled_arch + precompiled_os) check already present in precompiled_platform, so cross-platform lockfile resolution honours explicit arch/OS overrides.
  • New unit tests cover explicit precompiled, explicit source-build, experimental default, default precompiled, non-current target, Windows, fallback, and ruby-install paths.

Confidence Score: 5/5

Safe to merge; the change is self-contained to Ruby lockfile option resolution with no effect on install paths or other backends.

All code paths are covered by the new test suite, the Windows early-return is clean, and the logic correctly mirrors should_try_precompiled semantics. No data loss or behavioral regression risk — worst case is a one-time lock invalidation for existing Ruby lockfiles, which is the stated intent of the PR.

No files require special attention.

Important Files Changed

Filename Overview
src/plugins/core/ruby.rs Adds resolved install options (compile mode, installer, build repos, precompiled URL/platform overrides, patches) to the Ruby lock identity; early-returns empty map for Windows targets; adds precompiled_arch/os override lookup to precompiled_platform_for_target; backs all paths with comprehensive unit tests

Reviews (12): Last reviewed commit: "Merge branch 'main' into fix/ruby-build-..." | Re-trigger Greptile

Comment thread src/plugins/core/ruby.rs Outdated
Comment thread src/plugins/core/ruby.rs Outdated

@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 track and apply tool options from installation manifests, updating BackendArg and configuration resolution logic accordingly. The Ruby plugin's lockfile options were refactored into ruby_lockfile_options to include a broader set of settings such as compilation flags, installer repositories, and precompiled binary metadata. Feedback suggests simplifying a match block in the Ruby plugin using a more idiomatic if let pattern to improve readability.

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

This comment was marked as outdated.

@risu729 risu729 force-pushed the fix/ruby-build-lock-options branch from 556e50e to 7fb77b1 Compare May 31, 2026 08:19
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Worried about impact? Review this PR in Change Stack to explore blast radius before you approve or request changes.

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: 3d5b4361-93ab-4683-8e2c-04a729aa52fc

📥 Commits

Reviewing files that changed from the base of the PR and between 5f413d9 and aba7d53.

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

📝 Walkthrough

Walkthrough

precompiled_platform_for_target now honors Settings overrides; resolve_lockfile_options returns an empty map for windows or deterministically builds options from Settings (compile, installer, repo/opts, apply_patches, precompiled_url/arch/os); tests add deterministic Settings scaffolding and exact-map assertions.

Changes

Ruby Lockfile Options Resolution

Layer / File(s) Summary
Core option-building and platform override logic
src/plugins/core/ruby.rs
precompiled_platform_for_target uses settings.ruby.precompiled_arch/precompiled_os when both are set; resolve_lockfile_options returns empty map for windows, sets compile from try_precompiled, always includes ruby_install, inserts either ruby_install_repo/ruby_install_opts or ruby_build_repo/ruby_build_opts, optionally includes apply_patches, and when try_precompiled is true includes precompiled_url plus optional precompiled_arch/precompiled_os.
Deterministic Settings test harness and unit tests
src/plugins/core/ruby.rs
Adds global mutex and SettingsResetGuard, default repo and precompiled URL constants, helper functions to resolve lockfile options for current or explicit PlatformTarget, and unit tests asserting exact BTreeMap<String,String> outputs across precompiled, source-build, ruby-install, non-current target, windows, and override scenarios.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I nibble on options, neat and spry,

Compile or prebuilt under sky,
Keys and repos all lined in rows,
Tests hop in to guard what grows,
A tiny rabbit cheers: "All goes!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% 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 'fix(ruby): lock resolved install options' is directly related to the main change: recording resolved Ruby install options (compile mode, installer choice, build repository, precompiled URL, and patches) in lock identity to prevent lockfile instability.
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.

@risu729 risu729 changed the title fix(ruby): include build source options in lock identity fix(ruby): lock resolved install options Jun 1, 2026
@risu729 risu729 marked this pull request as ready for review June 2, 2026 08:59

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/plugins/core/ruby.rs (1)

1175-1179: ⚡ Quick win

Avoid poisoning the shared test mutex.

A single panic while holding TEST_SETTINGS_LOCK will poison the mutex and make later tests fail during setup instead of surfacing the original assertion failure.

Suggested change
-        let lock = TEST_SETTINGS_LOCK.lock().unwrap();
+        let lock = TEST_SETTINGS_LOCK
+            .lock()
+            .unwrap_or_else(|poisoned| poisoned.into_inner());
🤖 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/plugins/core/ruby.rs` around lines 1175 - 1179, The TEST_SETTINGS_LOCK
acquisition can poison the mutex if a panic occurs while held; change the lock
call to recover from poisoning by using
TEST_SETTINGS_LOCK.lock().unwrap_or_else(|poison| poison.into_inner()) so the
guard still obtains the inner mutex guard, then proceed to call
SettingsPartial::empty, configure_settings, Settings::reset and create the
SettingsResetGuard as before; this ensures a poisoned mutex won't make
subsequent test setup fail.
🤖 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/plugins/core/ruby.rs`:
- Around line 1305-1325: The tests in
test_ruby_lockfile_options_include_experimental_precompiled_default incorrectly
assume precompiled-by-default; update the test cases that call
resolve_ruby_lockfile_options so they mirror the runtime gating used by
should_try_precompiled() and install_version_: for the “experimental default”
variant explicitly set settings.experimental = true (so precompiled behavior is
enabled), and for the “resolved defaults” variant either set
settings.ruby.compile = Some(false) to opt into precompiled behavior or else
change the expected BTreeMap to the current (non-precompiled) defaults; locate
these changes around the test function
test_ruby_lockfile_options_include_experimental_precompiled_default and the
sibling test referenced at lines 1329-1346 and adjust expectations to match the
presence or absence of settings.experimental and settings.ruby.compile.
- Around line 1031-1056: When building the options map for non-current targets
(i.e. where is_current_platform is false) ensure you still insert the resolved
source-build defaults so lockfile identity is complete: always set "compile" to
(!try_precompiled).to_string(), set "ruby_install" to
ruby.ruby_install.to_string(), and populate the installer-specific keys by
reading ruby.ruby_install_opts/ruby.ruby_install_repo when ruby.ruby_install is
true or ruby.ruby_build_opts/ruby.ruby_build_repo when false; also insert
"apply_patches" from ruby.apply_patches when present. Update the code around
opts insertion (the block that currently runs only under if is_current_platform)
to perform these same inserts for non-current targets so the options-map
includes compile, installer choice, repo, build opts, and patches for both
current and non-current platforms.

---

Nitpick comments:
In `@src/plugins/core/ruby.rs`:
- Around line 1175-1179: The TEST_SETTINGS_LOCK acquisition can poison the mutex
if a panic occurs while held; change the lock call to recover from poisoning by
using TEST_SETTINGS_LOCK.lock().unwrap_or_else(|poison| poison.into_inner()) so
the guard still obtains the inner mutex guard, then proceed to call
SettingsPartial::empty, configure_settings, Settings::reset and create the
SettingsResetGuard as before; this ensures a poisoned mutex won't make
subsequent test setup fail.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a2d20b8e-0413-45d2-88f4-54d5eff4391c

📥 Commits

Reviewing files that changed from the base of the PR and between 5cdba15 and 0d98b51.

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

Comment thread src/plugins/core/ruby.rs Outdated
Comment thread src/plugins/core/ruby.rs
@risu729 risu729 marked this pull request as draft June 2, 2026 09:12
@risu729 risu729 marked this pull request as ready for review June 5, 2026 16:06

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/plugins/core/ruby.rs (1)

1019-1063: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Skip Ruby build/precompiled options for Windows targets.

Line 1074 already routes Windows through RubyInstaller2, so compile, installer choice, repos, patches, and precompiled selectors here do not affect the Windows artifact. Persisting them in the options map will make Windows lock entries miss exact-match reuse when unrelated Ruby build settings change.

Proposed fix
 fn resolve_lockfile_options(
     &self,
     _request: &ToolRequest,
-    _target: &PlatformTarget,
+    target: &PlatformTarget,
 ) -> BTreeMap<String, String> {
+    if target.os_name() == "windows" {
+        return BTreeMap::new();
+    }
+
     let mut opts = BTreeMap::new();
     let settings = Settings::get();
     let ruby = &settings.ruby;
🤖 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/plugins/core/ruby.rs` around lines 1019 - 1063, In
resolve_lockfile_options, skip adding Ruby build/precompiled related keys when
the target is Windows: detect Windows from the _target/PlatformTarget and if
Windows, return opts without inserting "compile", "ruby_install",
"ruby_install_opts", "ruby_install_repo", "ruby_build_opts", "ruby_build_repo",
"apply_patches", "precompiled_url", "precompiled_arch", or "precompiled_os";
leave other non-build keys as-is. Use the existing _target/PlatformTarget check
(e.g., is_windows or target.os == "windows") before using ruby, try_precompiled,
and inserting into opts so Windows lock entries aren’t affected by unrelated
build settings.
🧹 Nitpick comments (1)
src/plugins/core/ruby.rs (1)

1025-1028: ⚡ Quick win

Reuse should_try_precompiled() here.

This reimplements the same gating used by install_version_() and resolve_lock_info(). With the planned 2026.8.0 default flip already called out in should_try_precompiled(), this copy can drift and make lock options disagree with runtime resolution.

Proposed refactor
         let mut opts = BTreeMap::new();
         let settings = Settings::get();
         let ruby = &settings.ruby;
-        let try_precompiled =
-            ruby.compile == Some(false) || (settings.experimental && ruby.compile.is_none());
+        let try_precompiled = self.should_try_precompiled();
🤖 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/plugins/core/ruby.rs` around lines 1025 - 1028, The code recomputes the
precompiled gating logic (using Settings::get(), ruby, and try_precompiled)
instead of reusing the existing should_try_precompiled() helper, which risks
drift with install_version_() and resolve_lock_info(); replace the inline logic
with a call to should_try_precompiled() (or otherwise delegate to that helper)
where try_precompiled is used so the same central decision is used across
resolve_lock_info(), install_version_(), and this code path, ensuring consistent
behavior with the planned default flip.
🤖 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.

Outside diff comments:
In `@src/plugins/core/ruby.rs`:
- Around line 1019-1063: In resolve_lockfile_options, skip adding Ruby
build/precompiled related keys when the target is Windows: detect Windows from
the _target/PlatformTarget and if Windows, return opts without inserting
"compile", "ruby_install", "ruby_install_opts", "ruby_install_repo",
"ruby_build_opts", "ruby_build_repo", "apply_patches", "precompiled_url",
"precompiled_arch", or "precompiled_os"; leave other non-build keys as-is. Use
the existing _target/PlatformTarget check (e.g., is_windows or target.os ==
"windows") before using ruby, try_precompiled, and inserting into opts so
Windows lock entries aren’t affected by unrelated build settings.

---

Nitpick comments:
In `@src/plugins/core/ruby.rs`:
- Around line 1025-1028: The code recomputes the precompiled gating logic (using
Settings::get(), ruby, and try_precompiled) instead of reusing the existing
should_try_precompiled() helper, which risks drift with install_version_() and
resolve_lock_info(); replace the inline logic with a call to
should_try_precompiled() (or otherwise delegate to that helper) where
try_precompiled is used so the same central decision is used across
resolve_lock_info(), install_version_(), and this code path, ensuring consistent
behavior with the planned default flip.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 661bcca8-fe49-4392-9a49-8281d463d61a

📥 Commits

Reviewing files that changed from the base of the PR and between 0d98b51 and f9ef572.

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

@risu729 risu729 marked this pull request as draft June 5, 2026 16:46
@risu729 risu729 marked this pull request as ready for review June 5, 2026 17:04

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/plugins/core/ruby.rs (1)

1059-1066: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Honor precompiled arch/os overrides when resolving lock info.

This now records precompiled_arch / precompiled_os in the lock identity, but resolve_lock_info() still resolves the artifact URL from precompiled_platform_for_target(target), which ignores those overrides and only uses the target’s native arch/OS. With overrides set, the lock entry can say arm64/linux in options while PlatformInfo.url still points at the target’s default platform, so the lockfile becomes internally inconsistent.

Suggested fix
 fn precompiled_platform_for_target(&self, target: &PlatformTarget) -> Option<String> {
+    let settings = Settings::get();
+    if let (Some(arch), Some(os)) = (
+        settings.ruby.precompiled_arch.as_deref(),
+        settings.ruby.precompiled_os.as_deref(),
+    ) {
+        return Some(format!("{}_{}", arch, os));
+    }
+
     match target.os_name() {
         "macos" => {
             match target.arch_name() {
                 "arm64" | "aarch64" => Some("macos".to_string()),
                 _ => None,

A regression test alongside the existing precompiled-options tests would catch this mismatch.

🤖 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/plugins/core/ruby.rs` around lines 1059 - 1066, The lock identity records
precompiled_arch/precompiled_os in opts but resolve_lock_info() still uses
precompiled_platform_for_target(target) which ignores those overrides, causing
inconsistent PlatformInfo.url; fix by making resolve_lock_info() consult opts
for "precompiled_arch" and "precompiled_os" (or add a new helper like
precompiled_platform_for_target_with_overrides(target, opts)) and use those
override values when computing the precompiled platform and artifact URL (ensure
you reference resolve_lock_info, precompiled_platform_for_target, and the opts
keys "precompiled_arch"/"precompiled_os"); add a regression test similar to the
existing precompiled-options tests that sets these overrides and asserts the
lockfile's PlatformInfo.url matches the opts-specified platform.
🤖 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.

Outside diff comments:
In `@src/plugins/core/ruby.rs`:
- Around line 1059-1066: The lock identity records
precompiled_arch/precompiled_os in opts but resolve_lock_info() still uses
precompiled_platform_for_target(target) which ignores those overrides, causing
inconsistent PlatformInfo.url; fix by making resolve_lock_info() consult opts
for "precompiled_arch" and "precompiled_os" (or add a new helper like
precompiled_platform_for_target_with_overrides(target, opts)) and use those
override values when computing the precompiled platform and artifact URL (ensure
you reference resolve_lock_info, precompiled_platform_for_target, and the opts
keys "precompiled_arch"/"precompiled_os"); add a regression test similar to the
existing precompiled-options tests that sets these overrides and asserts the
lockfile's PlatformInfo.url matches the opts-specified platform.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a8f02e84-372a-4039-987b-16af0a010b4c

📥 Commits

Reviewing files that changed from the base of the PR and between f9ef572 and 5f413d9.

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

@risu729 risu729 marked this pull request as draft June 5, 2026 17:44
@risu729

risu729 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

This comment was generated by an AI coding assistant.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get the PR diff
gh pr view 9992 --repo jdx/mise --json files,additions,deletions,changedFiles

# Get the diff
gh pr diff 9992 --repo jdx/mise

Length of output: 15642


🏁 Script executed:

#!/bin/bash
# Check how apply_patches is used in the codebase - does it apply to ruby-install or only ruby-build?
rg -n "apply_patches" src/plugins/core/ruby.rs -C3

Length of output: 3562


🏁 Script executed:

#!/bin/bash
# Check where apply_patches / --patch is used - is it in the ruby-build path only or also ruby-install?
rg -n "ruby_install\|apply_patches\|--patch\|fetch_patch" src/plugins/core/ruby.rs -C2 | head -120

Length of output: 457


🏁 Script executed:

#!/bin/bash
rg -n "apply_patches|ruby_install|patch" src/plugins/core/ruby.rs | head -80

Length of output: 4860



@risu729: I've reviewed the changes in src/plugins/core/ruby.rs. The implementation is sound and the test scaffolding is excellent. Here's my assessment:


✅ What's done well

resolve_lockfile_options refactor

  • Removing is_current_platform branching is the right call — lock identity should be consistent regardless of which machine writes the lock.
  • The Windows short-circuit is appropriate and well-commented. RubyInstaller2 is a completely different install path so recording empty options there is correct.
  • apply_patches placed outside the ruby_install branch is intentional and correct — I verified fetch_patch_sources() (and the --patch flag) is consumed in both install_args_ruby_build (line 317) and install_args_ruby_install (lines 331–333).

precompiled_platform_for_target override

  • Requiring both precompiled_arch and precompiled_os to activate the override (rather than one or the other) is a reasonable guard. If only one is set it silently falls through to the target-derived defaults, which is intuitive.

Test scaffolding

  • The TEST_SETTINGS_LOCK mutex + SettingsResetGuard drop guard is the correct pattern for tests that mutate global settings. Poisoned-lock recovery via unwrap_or_else(|e| e.into_inner()) is also good practice.
  • Coverage across precompiled, source-build, fallback, ruby-install, non-current-target, and Windows paths is comprehensive.

🔍 Minor observations

Lockfile compatibility (intentional breaking change)
This PR always writes compile, ruby_install, and the repo URL keys — fields that were never written before. Existing lockfiles will therefore be seen as outdated on first run after upgrade, causing all Ruby installs to be re-resolved. This is presumably the intent (and the correct one per the stated goal of avoiding stale locks when mise defaults change), but it warrants a mention in the changelog or upgrade notes so users aren't surprised.

Missing test: ruby_install=true + apply_patches
test_ruby_lockfile_options_include_ruby_install_inputs doesn't exercise the case where both ruby_install=true and apply_patches are set. Since both backends consume patches, a variant like the following would close that gap:

#[test]
fn test_ruby_lockfile_options_include_ruby_install_inputs_with_patches() {
    let opts = resolve_ruby_lockfile_options(|settings| {
        settings.ruby.compile = Some(true);
        settings.ruby.ruby_install = Some(true);
        settings.ruby.apply_patches = Some("https://example.com/ruby.patch".to_string());
    });

    assert_eq!(
        opts,
        BTreeMap::from([
            ("apply_patches".to_string(), "https://example.com/ruby.patch".to_string()),
            ("compile".to_string(), "true".to_string()),
            ("ruby_install".to_string(), "true".to_string()),
            ("ruby_install_repo".to_string(), DEFAULT_RUBY_INSTALL_REPO.to_string()),
        ])
    );
}

CI failures
The lint/test-ci failures due to RUSTSEC-2026-0145 in astral-tokio-tar 0.6.1 (via rattler_package_streaming) are confirmed unrelated to this PR — the same advisory is failing on main. This can safely be ignored for the purposes of reviewing this PR.


Overall this is a clean, well-reasoned change that correctly captures Ruby's artifact identity inputs. The observations above are minor. The extra test is optional but would add useful coverage.

This comment was generated by an AI coding assistant.


🧠 Learnings used
Learnt from: CR
Repo: jdx/mise PR: 0
File: .cursor/rules/development.mdc:0-0
Timestamp: 2026-05-31T15:11:40.047Z
Learning: Applies to **/*.rs : Run `mise run lint-fix` to automatically fix linting issues and stage changes with `git add` before committing

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-31T15:12:12.203Z
Learning: When posting comments on GitHub PRs or discussions, include a note that the comment was AI-generated (e.g., '*This comment was generated by an AI coding assistant.*').

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-31T15:12:18.847Z
Learning: When posting comments on GitHub PRs or discussions, always include a note that the comment was AI-generated

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-31T15:12:28.703Z
Learning: When posting comments on GitHub PRs or discussions, always include a note that the comment was AI-generated

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-31T15:12:28.703Z
Learning: Applies to **/*.rs : Treat lockfile version strings as opaque - compare with ==, never with a version ordering - never write non-concrete strings (latest, lts/*, prefix) into the lockfile; resolve first

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-03T23:36:49.782Z
Learning: Applies to src/**/*.rs : Lockfile version strings must be treated as opaque — compare with `==`, never with version ordering. Never write a non-concrete string (latest, lts/*, a prefix) into the lockfile; resolve first.

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-03T23:36:49.782Z
Learning: Applies to src/**/*.rs : Lockfile version strings must be treated as opaque - compare with ==, never with version ordering. Never write a non-concrete string (latest, lts/*, a prefix) into the lockfile; resolve first

@risu729

risu729 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

This comment was generated by an AI coding assistant.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

@risu729: Triggering a new review of the PR now.

This comment was generated by an AI coding assistant.


🧠 Learnings used
Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-31T15:12:28.703Z
Learning: Applies to **/*.rs : Treat lockfile version strings as opaque - compare with ==, never with a version ordering - never write non-concrete strings (latest, lts/*, prefix) into the lockfile; resolve first

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-03T23:36:49.782Z
Learning: Applies to src/**/*.rs : Lockfile version strings must be treated as opaque — compare with `==`, never with version ordering. Never write a non-concrete string (latest, lts/*, a prefix) into the lockfile; resolve first.

Learnt from: CR
Repo: jdx/mise PR: 0
File: .cursor/rules/development.mdc:0-0
Timestamp: 2026-05-31T15:11:40.047Z
Learning: Applies to **/*.rs : Run `mise run lint-fix` to automatically fix linting issues and stage changes with `git add` before committing

Learnt from: CR
Repo: jdx/mise PR: 0
File: .cursor/rules/development.mdc:0-0
Timestamp: 2026-05-31T15:11:38.296Z
Learning: Applies to **/*.rs : Run `mise run lint-fix` and commit lint fixes with `git add` before committing

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-03T23:36:49.782Z
Learning: Applies to src/**/*.rs : Lockfile version strings must be treated as opaque - compare with ==, never with version ordering. Never write a non-concrete string (latest, lts/*, a prefix) into the lockfile; resolve first

Learnt from: CR
Repo: jdx/mise PR: 0
File: .cursor/rules/development.mdc:0-0
Timestamp: 2026-05-31T15:11:40.047Z
Learning: Applies to **/*.rs : Run linting using `mise run lint`

Learnt from: CR
Repo: jdx/mise PR: 0
File: .cursor/rules/development.mdc:0-0
Timestamp: 2026-06-03T17:35:47.414Z
Learning: Applies to **/*.rs : Run linting using `mise run lint`

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-31T15:12:12.203Z
Learning: When posting comments on GitHub PRs or discussions, include a note that the comment was AI-generated (e.g., '*This comment was generated by an AI coding assistant.*').

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-31T15:12:18.847Z
Learning: When posting comments on GitHub PRs or discussions, always include a note that the comment was AI-generated

Learnt from: CR
Repo: jdx/mise PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-31T15:12:28.703Z
Learning: When posting comments on GitHub PRs or discussions, always include a note that the comment was AI-generated
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@risu729

This comment was marked as outdated.

@risu729 risu729 marked this pull request as ready for review June 5, 2026 20:41
@jdx jdx merged commit 44f2b2e into jdx:main Jun 5, 2026
33 checks passed
@risu729 risu729 deleted the fix/ruby-build-lock-options branch June 5, 2026 23:56
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