From 5d154b58c45971747ae3f12eb7dd80c76c623be0 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Wed, 17 Dec 2025 10:21:59 -0600 Subject: [PATCH] fix(toolset): filter tools by OS in list_current_versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move OS filtering into list_current_versions() so that tools configured for other operating systems (via the `os` field) are consistently filtered out across all commands that list tools. This fixes issues where: - `mise install` would try to install tools for other OSes - `mise ls` would show tools configured for other OSes - `mise upgrade` would warn about tools for other OSes Fixes #7352 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/cli/doctor/mod.rs | 1 - src/toolset/mod.rs | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/cli/doctor/mod.rs b/src/cli/doctor/mod.rs index 6795d128e1..0d06fd5f1b 100644 --- a/src/cli/doctor/mod.rs +++ b/src/cli/doctor/mod.rs @@ -335,7 +335,6 @@ impl Doctor { let tools = ts .list_current_versions() .into_iter() - .filter(|(_, tv)| tv.request.is_os_supported()) .map(|(f, tv)| match f.is_version_installed(&config, &tv, true) { true => (tv.to_string(), style::nstyle("")), false => { diff --git a/src/toolset/mod.rs b/src/toolset/mod.rs index 9b8ecf8e70..ca6a1afa0d 100644 --- a/src/toolset/mod.rs +++ b/src/toolset/mod.rs @@ -564,9 +564,7 @@ impl Toolset { measure!("toolset::list_missing_versions", { self.list_current_versions() .into_iter() - .filter(|(p, tv)| { - tv.request.is_os_supported() && !p.is_version_installed(config, tv, true) - }) + .filter(|(p, tv)| !p.is_version_installed(config, tv, true)) .map(|(_, tv)| tv) .collect() }) @@ -610,7 +608,7 @@ impl Toolset { self.list_versions_by_plugin() .iter() .flat_map(|(p, v)| { - v.iter().map(|v| { + v.iter().filter(|v| v.request.is_os_supported()).map(|v| { // map cargo backend specific prefixes to ref let tv = match v.version.split_once(':') { Some((ref_type @ ("tag" | "branch" | "rev"), r)) => { @@ -672,8 +670,6 @@ impl Toolset { let versions = self .list_current_versions() .into_iter() - // Respect per-tool os constraints set via options.os - .filter(|(_, tv)| tv.request.is_os_supported()) // Filter to only check specified tools if provided .filter(|(_, tv)| { if let Some(tools) = filter_tools {