fix(ruby): reject non-MRI Ruby engines on Windows with clear error#8539
fix(ruby): reject non-MRI Ruby engines on Windows with clear error#8539
Conversation
On Windows, the Ruby plugin uses RubyInstaller2 which only distributes standard MRI Ruby. When a user requests a non-MRI engine like jruby or truffleruby, the plugin would construct an invalid download URL and fail with a confusing 404 error. Now it fails early with a clear message. Fixes #8537 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the Ruby plugin's behavior on Windows by introducing a validation step during installation. Previously, attempting to install non-MRI Ruby engines like JRuby or TruffleRuby on Windows would lead to a cryptic 404 error due to an invalid download URL. The change now proactively checks the requested Ruby engine and, if it's not a standard MRI version, it immediately fails with a user-friendly error message, clarifying that only MRI Ruby is supported on Windows via RubyInstaller2. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Greptile SummaryThis PR adds a focused early-exit guard in the Windows Ruby plugin ( Key changes:
Minor concerns:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["install_version_ called\n(ruby_windows.rs)"] --> B{"is_mri_version\n(tv.version)?"}
B -- "No\n(e.g. jruby-9, truffleruby-23)" --> C["bail! with clear error\n'Ruby engine X is not supported\non Windows'"]
B -- "Yes\n(e.g. 3.2.0, 3.3.1)" --> D["download RubyInstaller2 .7z\n(rubyinstaller_url)"]
D --> E["verify_checksum"]
E --> F["install (un7z + rename)"]
F --> G["verify (ruby -v)"]
G --> H["install_rubygems_hook"]
H --> I["test_gem (gem -v)"]
I --> J["install_default_gems"]
J --> K["Ok(tv)"]
C --> L["Err returned to caller"]
|
| if !super::ruby_common::is_mri_version(&tv.version) { | ||
| bail!( | ||
| "Ruby engine '{}' is not supported on Windows.\n\ | ||
| Only standard MRI Ruby versions can be installed via RubyInstaller2.", | ||
| tv.version | ||
| ); | ||
| } |
There was a problem hiding this comment.
No unit test for the new rejection behavior
There is no test that verifies a non-MRI version string (e.g. jruby-9.4.0.0, truffleruby-23) produces the expected bail error. Consider adding a small unit test for install_version_ that mocks a non-MRI ToolVersion and asserts the error message contains "is not supported on Windows". This would guard against regressions to the early-exit path and make the intent explicit.
There was a problem hiding this comment.
Code Review
This pull request correctly adds a check to prevent installation of non-MRI Ruby engines on Windows, providing a much clearer error message to the user. My only feedback is a minor formatting issue in the new error message string which would cause unintended indentation in the output.
Note: Security Review did not run due to the size of the PR.
| "Ruby engine '{}' is not supported on Windows.\n\ | ||
| Only standard MRI Ruby versions can be installed via RubyInstaller2.", |
There was a problem hiding this comment.
The indentation on the second line of this multi-line string literal will be included in the error message, which is likely not intended. This will cause the second line of the error message to be indented with several spaces. It's better to put the string on a single line or remove the indentation on the continued line to fix the output format.
"Ruby engine '{}' is not supported on Windows.\nOnly standard MRI Ruby versions can be installed via RubyInstaller2.",
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.5 x -- echo |
26.0 ± 0.6 | 25.1 | 32.4 | 1.00 |
mise x -- echo |
26.4 ± 1.0 | 25.7 | 36.8 | 1.02 ± 0.05 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.5 env |
25.7 ± 1.2 | 24.6 | 36.9 | 1.00 |
mise env |
26.2 ± 1.8 | 25.0 | 39.4 | 1.02 ± 0.09 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.5 hook-env |
26.5 ± 0.9 | 25.6 | 34.4 | 1.00 |
mise hook-env |
27.8 ± 2.7 | 25.7 | 52.0 | 1.05 ± 0.11 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.5 ls |
25.6 ± 0.9 | 24.7 | 33.4 | 1.00 ± 0.04 |
mise ls |
25.5 ± 0.4 | 24.9 | 30.8 | 1.00 |
xtasks/test/perf
| Command | mise-2026.3.5 | mise | Variance |
|---|---|---|---|
| install (cached) | 161ms | 161ms | +0% |
| ls (cached) | 88ms | 87ms | +1% |
| bin-paths (cached) | 91ms | 90ms | +1% |
| task-ls (cached) | 846ms | 817ms | +3% |
Summary
Fixes #8537
Test plan
mise use ruby@jruby-9on Windows now shows a clear error instead of a 404🤖 Generated with Claude Code
Note
Low Risk
Small, localized change to Windows Ruby installation flow that only adds an upfront validation and error message; minimal impact on successful MRI installs.
Overview
Adds an early Windows-only guard in the Ruby installer to reject non-MRI engine version strings (e.g., JRuby/TruffleRuby) before attempting a RubyInstaller2 download.
This replaces a confusing downstream 404 from a constructed RubyInstaller2 URL with a clear
bail!error message explaining that only standard MRI Ruby is supported on Windows.Written by Cursor Bugbot for commit a1c623b. This will update automatically on new commits. Configure here.