From 161ced630c2b69b053cffb25897406deb4f537f2 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 13:00:23 +0000 Subject: [PATCH 1/2] fix(valgrind): make the unsupported system error actionable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Unsupported system" error gave no detail, leaving users on an outdated CodSpeed (e.g. an old action version on a new `ubuntu-latest`) with nothing to act on. Name the detected system and the supported ones, point to updating CodSpeed first, and say where to get help if the error persists. Co-Authored-By: François Farge <29537204+fargito@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 --- src/executor/valgrind/setup.rs | 45 ++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/src/executor/valgrind/setup.rs b/src/executor/valgrind/setup.rs index 39c8bbbbe..3e9124756 100644 --- a/src/executor/valgrind/setup.rs +++ b/src/executor/valgrind/setup.rs @@ -12,9 +12,27 @@ use crate::system::{LinuxDistribution, SupportedOs, SystemInfo}; use semver::Version; use std::{env, path::Path, process::Command}; +/// Error for a system we publish no valgrind package for. It names the detected system and +/// points to the fixes, since an outdated CodSpeed is the usual reason for hitting it. +fn unsupported_system_error(system_info: &SystemInfo) -> Error { + anyhow!( + "Unsupported system: {} ({}). Supported systems are Ubuntu 22.04, 24.04 and 26.04, \ + and Debian 12, on x86_64 and aarch64.\n\ + \n\ + Make sure you are running the latest version of CodSpeed first:\n\ + - On GitHub Actions, update `CodSpeedHQ/action` to its latest release (e.g. `CodSpeedHQ/action@v5`).\n\ + - Elsewhere, run `codspeed update`, or re-run `curl -fsSL https://codspeed.io/install.sh | bash`.\n\ + \n\ + If the error persists, reach out on Discord (https://codspeed.io/discord) \ + or by email (support@codspeed.io).", + system_info.os, + system_info.arch, + ) +} + fn get_codspeed_valgrind_target(system_info: &SystemInfo) -> Result { let SupportedOs::Linux(distro) = &system_info.os else { - bail!("Unsupported system"); + return Err(unsupported_system_error(system_info)); }; let (distro_version, arch) = match (distro, system_info.arch.as_str()) { @@ -42,7 +60,7 @@ fn get_codspeed_valgrind_target(system_info: &SystemInfo) -> Result { (DistroVersion::Ubuntu2604, Arch::Arm64) } - _ => bail!("Unsupported system"), + _ => return Err(unsupported_system_error(system_info)), }; Ok(ValgrindTarget { @@ -387,6 +405,29 @@ mod tests { assert!(get_codspeed_valgrind_binary(&system_info).is_err()); } + #[test] + fn test_codspeed_valgrind_unsupported_system_error_is_actionable() { + let system_info = SystemInfo { + os: SupportedOs::Linux(LinuxDistribution::Ubuntu { + version: "20.04".into(), + }), + arch: "x86_64".to_string(), + ..SystemInfo::test() + }; + let message = get_codspeed_valgrind_target(&system_info) + .unwrap_err() + .to_string(); + + // The detected system and the supported ones + assert!(message.contains("Unsupported system: ubuntu 20.04 (x86_64)")); + assert!(message.contains("Ubuntu 22.04, 24.04 and 26.04, and Debian 12")); + // How to update, then where to get help + assert!(message.contains("`CodSpeedHQ/action`")); + assert!(message.contains("`codspeed update`")); + assert!(message.contains("https://codspeed.io/discord")); + assert!(message.contains("support@codspeed.io")); + } + #[test] fn test_parse_valgrind_codspeed_version_with_prefix() { let version = parse_valgrind_codspeed_version("valgrind-3.25.1.codspeed").unwrap(); From c68337b8d1b3946b7fe56618c62ec0fd50fd7c2c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 13:20:10 +0000 Subject: [PATCH 2/2] fix(valgrind): point to the docs for supported systems in the error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not bake the supported systems or CodSpeed versions in the unsupported system error: link to the documentation, which lists them for the latest version, and keep `codspeed update` as the only way to update the CLI. Hosts without a published package go through the manual installation path rather than the unsupported system error, so users never saw the advice. Append it to the manual installation error as well. Co-Authored-By: François Farge <29537204+fargito@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 --- src/executor/valgrind/setup.rs | 76 +++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/src/executor/valgrind/setup.rs b/src/executor/valgrind/setup.rs index 3e9124756..4b3544019 100644 --- a/src/executor/valgrind/setup.rs +++ b/src/executor/valgrind/setup.rs @@ -12,19 +12,36 @@ use crate::system::{LinuxDistribution, SupportedOs, SystemInfo}; use semver::Version; use std::{env, path::Path, process::Command}; +/// What to try when the system is not supported. An outdated CodSpeed is the usual reason for +/// hitting it. The supported systems are listed in the documentation rather than here, so +/// they stay accurate as support evolves. +const UNSUPPORTED_SYSTEM_ADVICE: &str = "\ +Make sure you are running the latest version of CodSpeed first:\n\ +- On GitHub Actions, update `CodSpeedHQ/action` to its latest release.\n\ +- Elsewhere, run `codspeed update`.\n\ +\n\ +The supported systems are listed in the documentation: https://codspeed.io/docs/cli#installation\n\ +\n\ +If the error persists, reach out on Discord (https://codspeed.io/discord) \ +or by email (support@codspeed.io)."; + /// Error for a system we publish no valgrind package for. It names the detected system and -/// points to the fixes, since an outdated CodSpeed is the usual reason for hitting it. +/// points to the fixes. fn unsupported_system_error(system_info: &SystemInfo) -> Error { anyhow!( - "Unsupported system: {} ({}). Supported systems are Ubuntu 22.04, 24.04 and 26.04, \ - and Debian 12, on x86_64 and aarch64.\n\ - \n\ - Make sure you are running the latest version of CodSpeed first:\n\ - - On GitHub Actions, update `CodSpeedHQ/action` to its latest release (e.g. `CodSpeedHQ/action@v5`).\n\ - - Elsewhere, run `codspeed update`, or re-run `curl -fsSL https://codspeed.io/install.sh | bash`.\n\ - \n\ - If the error persists, reach out on Discord (https://codspeed.io/discord) \ - or by email (support@codspeed.io).", + "Unsupported system: {} ({}).\n\n{UNSUPPORTED_SYSTEM_ADVICE}", + system_info.os, + system_info.arch, + ) +} + +/// Error for a system without a package, where valgrind could not be provided either. +fn manual_installation_error(system_info: &SystemInfo) -> Error { + anyhow!( + "valgrind-codspeed {} or higher is required and could not be installed automatically \ + on {} ({}). Install it manually, see https://github.com/CodSpeedHQ/valgrind-codspeed\n\n\ + {UNSUPPORTED_SYSTEM_ADVICE}", + VALGRIND_CODSPEED_VERSION_STRING.as_str(), system_info.os, system_info.arch, ) @@ -241,11 +258,7 @@ pub(super) async fn try_install_from_source( } } - bail!( - "valgrind-codspeed {} or higher is required and could not be installed automatically. \ - Install it manually, see https://github.com/CodSpeedHQ/valgrind-codspeed", - VALGRIND_CODSPEED_VERSION_STRING.as_str() - ); + Err(manual_installation_error(system_info)) } /// Install the valgrind-codspeed package we publish for this system, from apt. @@ -418,12 +431,37 @@ mod tests { .unwrap_err() .to_string(); - // The detected system and the supported ones - assert!(message.contains("Unsupported system: ubuntu 20.04 (x86_64)")); - assert!(message.contains("Ubuntu 22.04, 24.04 and 26.04, and Debian 12")); - // How to update, then where to get help + // The detected system, without a hard-coded list of the supported ones + assert!(message.starts_with("Unsupported system: ubuntu 20.04 (x86_64).")); + assert!(!message.contains("22.04")); + // How to update, then where to read about the supported systems and get help + assert!(message.contains("`CodSpeedHQ/action`")); + assert!(message.contains("`codspeed update`")); + assert!(!message.contains("curl")); + assert!(message.contains("https://codspeed.io/docs/cli#installation")); + assert!(message.contains("https://codspeed.io/discord")); + assert!(message.contains("support@codspeed.io")); + } + + #[test] + fn test_manual_installation_error_is_actionable() { + let system_info = SystemInfo { + os: SupportedOs::Linux(LinuxDistribution::Ubuntu { + version: "20.04".into(), + }), + arch: "x86_64".to_string(), + ..SystemInfo::test() + }; + let message = manual_installation_error(&system_info).to_string(); + + // The error users get on a system without a package keeps the manual installation + // pointer and carries the same advice as the unsupported system error + assert!(message.contains("ubuntu 20.04 (x86_64)")); + assert!(message.contains("https://github.com/CodSpeedHQ/valgrind-codspeed")); assert!(message.contains("`CodSpeedHQ/action`")); assert!(message.contains("`codspeed update`")); + assert!(!message.contains("curl")); + assert!(message.contains("https://codspeed.io/docs/cli#installation")); assert!(message.contains("https://codspeed.io/discord")); assert!(message.contains("support@codspeed.io")); }