Skip to content

fix: support distributions CodSpeed publishes no valgrind package for (Arch, rolling releases) - #525

Open
moha-bekh wants to merge 8 commits into
mainfrom
cod-3072-cli-fails-to-detect-os-version-on-arch-linux
Open

moha-bekh wants to merge 8 commits into
mainfrom
cod-3072-cli-fails-to-detect-os-version-on-arch-linux

Conversation

@moha-bekh

@moha-bekh moha-bekh commented Sep 3, 2026

Copy link
Copy Markdown
Member

Refs COD-3072

The CLI aborted on Arch before doing anything: SupportedOs::from_os failed when /etc/os-release had no VERSION_ID, which rolling releases do not ship. Fixing that surfaced the next failure at setup, where install_valgrind went straight to the valgrind-codspeed deb we only publish for some Debian/Ubuntu versions.

Changes

  • A missing OS version is now an Option rather than an error (macOS keeps the hard error, the version is always there and we report it to the API).
  • ValgrindExecutor::setup() matches on its own support_level: deb install, source build, or bail.
  • On a host we publish no package for, the setup accepts a valgrind the user brings, offers to build one from source (CODSPEED_VALGRIND_BUILD_FROM_SOURCE skips the prompt), and otherwise says what to install by hand.
  • The libc debug symbol probe is scoped to the apt path, where it belongs, and warns instead of blocking.
  • codspeed setup no longer skips RequiresManualInstallation executors; a failing one warns and the others still run.

Blocked on

VALGRIND_CODSPEED_BRANCH points at a feature branch until CodSpeedHQ/valgrind-codspeed#40 lands. Merging before that would have released runners cloning it.

Test plan

  • fmt, clippy, cargo test --lib.
  • manual run on Arch Linux ARM rolling (no VERSION_ID): status, setup and exec in the three modes pass, 7c4b2aa^ still reproduces the failure, and the no-package path warns and carries on.
  • the source build end to end on the same host: clone, vendored Capstone, configure, make, make install under sudo, then setup, status and exec against the freshly built valgrind-3.26.0.codspeed7.

🤖 Generated with Claude Code

moha-bekh and others added 2 commits September 3, 2026 11:12
`SupportedOs::from_os` read `sysinfo::System::os_version()` before looking
at the OS at all and bailed with "Failed to get OS version" when it was
absent. That value comes from `VERSION_ID` in `/etc/os-release`, which
rolling releases do not ship: on Arch (`ID=archarm`, `BUILD_ID=rolling`)
every command aborted before it could determine anything about the host.

The version only matters for the distributions we publish packages for,
and those all expose one — the rest are already handled by
`is_supported()`. So on Linux fall back to `"unknown"` with a `debug!`
rather than failing, and keep the hard error on macOS, where the version
is always available and is what we report to the API.

Refs COD-3072

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZZqxhWtwHhurnV2hsJ48H
`install_valgrind` went straight to `apt::install_cached`, which resolves the
`valgrind-codspeed` deb for the host through `get_codspeed_valgrind_target`.
That mapping only covers the Debian/Ubuntu versions we publish packages for, so
on anything else — Arch and other rolling releases, non-apt distributions — it
bailed with a bare "Unsupported system" and the run stopped at setup. Yet
`ValgrindExecutor::support_level` already reports `RequiresManualInstallation`
for those hosts, so the executor was advertising a path that setup refused to
take.

Mirror that support level in the setup: when no package exists for the host,
return early if a valgrind installation is already present, and otherwise fail
with an error that says CodSpeed publishes nothing for this distribution and
points at valgrind-codspeed for a manual install. The libc debug symbol check
is already skipped on non-apt systems, so an existing build is enough.

Refs COD-3072

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown

Greptile Summary

This PR allows Linux distributions without a reported OS version to initialize using an unknown placeholder and adds a manual Valgrind-installation path for hosts outside the published package matrix.

  • Keeps macOS version detection strict.
  • Accepts a compatible existing Valgrind installation on unsupported Linux package targets.
  • Improves the unsupported-host failure message, although it omits the separately enforced libc debug-symbol requirement.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking diagnostic gap for manual installations on unsupported Ubuntu or Debian versions.

The changed setup branch correctly avoids automatic package installation where no package exists, but its error message cannot guide users whose compatible Valgrind installation fails only because libc debug symbols are missing.

Files Needing Attention: src/executor/valgrind/setup.rs

Important Files Changed

Filename Overview
src/system/os.rs Linux now falls back to an unknown version while preserving strict macOS detection; no concrete compatibility defect was identified.
src/executor/valgrind/setup.rs Manual installations are now accepted outside the package matrix, but the failure guidance does not mention the libc debug symbols required on apt-compatible hosts.

Fix all with Greploop Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
### Issue 1
src/executor/valgrind/setup.rs:260-264
**Manual requirement omitted**

On unsupported Ubuntu or Debian versions, `is_valgrind_installed` also requires resolvable libc debug symbols, but this error only instructs users to install `valgrind-codspeed`. A user who follows that instruction can receive the same error again without learning that the debug-symbol package is the remaining requirement.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(valgrind): accept a manual installat..." | Re-trigger Greptile

Comment thread src/executor/valgrind/setup.rs Outdated
@codspeed

codspeed Bot commented Sep 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 17 untouched benchmarks


Comparing cod-3072-cli-fails-to-detect-os-version-on-arch-linux (8be4528) with main (f198706)

Open in CodSpeed

moha-bekh and others added 3 commits September 3, 2026 22:41
On the systems we publish no valgrind package for (rolling releases,
non-apt distributions, ...), the setup used to give up immediately and
ask for a manual installation. Try a best-effort source build instead:
check the build toolchain, clone the sources, compile them and install
system-wide, only falling back to the manual instructions when any of
those steps fails.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…all path

`is_valgrind_installed` answered two questions at once: whether a usable
valgrind-codspeed is on PATH, and whether the system libc has separate debug
symbols. The second belongs to the apt path alone, where the setup cache
restores package files without touching dpkg's database and `dpkg -s libc6-dbg`
therefore lies (e5587f4). Everywhere else it was neutralised by an
`apt::is_system_compatible` early return.

But that early return only covers non-apt systems, so on Ubuntu and Debian the
probe leaked into the two callers that install nothing: accepting a manual
installation, and verifying a source build. Neither installs `libc6-dbg`, so
both were rejected on the very distributions where the check applies. The
source-build fallback could therefore never succeed on Ubuntu, and a user who
followed the resulting "install it manually" instruction was refused again, for
a reason the error never named.

Split the function in two and apply the probe at the one call site whose
decision it belongs to, the `apt::install_cached` idempotency closure, where
`apt::is_system_compatible` holds by construction and the early return was dead
weight. Missing symbols now warn rather than block, reusing the wording the
perf profiler already has for them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The source-build fallback ran as soon as it could, which spends minutes
compiling and then installs system-wide under sudo without the user having
agreed to either.

Ask first, mirroring the confirmation the walltime executor uses before
installing bash: an interactive run gets a `[Y/n]` prompt on stderr,
`CODSPEED_VALGRIND_BUILD_FROM_SOURCE` answers it without asking, and a run with
no terminal builds anyway, since nobody is there to answer and failing the run
outright is the worse outcome. The prompt is wrapped in `suspend_progress_bar`
so a spinner cannot overwrite the question, as the sudo password prompt already
does.

Declining is an outcome, not an error: the three ways this fallback can end
without a usable valgrind — declined, failed, built but unusable — now warn and
fall through to the same instruction to install manually, instead of being
reported as "building it from source failed".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@moha-bekh moha-bekh changed the title fix: support distributions that report no OS version (Arch, rolling releases) fix: support distributions CodSpeed publishes no valgrind package for (Arch, rolling releases) Sep 4, 2026

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

olgtm, nothing that big to change!

Comment thread src/system/os.rs Outdated
Comment thread src/system/os.rs Outdated
Comment thread src/executor/valgrind/setup.rs Outdated
Comment thread src/executor/valgrind/setup.rs Outdated
Comment thread src/executor/valgrind/setup.rs Outdated
Comment thread src/executor/valgrind/build_from_source.rs Outdated
Comment thread src/executor/valgrind/build_from_source.rs Outdated
Comment thread src/executor/valgrind/build_from_source.rs Outdated
Comment thread src/executor/valgrind/build_from_source.rs
Comment thread src/executor/valgrind/build_from_source.rs Outdated
moha-bekh and others added 3 commits September 16, 2026 13:56
Rolling releases expose no `VERSION_ID`, and the `"unknown"` placeholder that
stood in for it leaked into every consumer of `SupportedOs::version()`:
`Display` printed "arch unknown", and nothing in the type said the string could
be a stand-in rather than a version.

Make the absence part of the type instead. `LinuxDistribution::Other` carries an
`Option<String>` and `version()` returns an `Option`, so `Display` drops the
version rather than printing a placeholder. `"unknown"` now survives only in
`SupportedOsSerde`, where the wire format requires a `String`.

A distribution reporting no version falls into `Other` even when its id is
`ubuntu` or `debian`. That is correct by construction: every distribution we
ship packages for reports a version, so one that does not is not among them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`install_valgrind` re-derived what `ValgrindExecutor::support_level` already
knows, deciding for itself whether a package exists for the host before doing
anything. Match on the support level in `ValgrindExecutor::setup` instead, and
give each branch its own function: `install_valgrind` is the apt path alone, and
`try_install_from_source` handles the hosts we publish nothing for.

Simplify the source build the same change touches:

- clone into a `tempfile::TempDir` rather than a fixed path under the system
  temporary directory, so no leftover checkout has to be removed by hand and the
  sources are wiped once the build is done;
- on an incomplete toolchain, name the missing executables and stop there. The
  per-distribution table of install commands was a second list to keep in step
  with reality, for an edge case that already carries a lot of code;
- drop the `is_wanted` env-var tests, which only restated the two-line match
  they covered.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`codspeed setup` skipped `RequiresManualInstallation` executors outright, so the
source-build fallback the valgrind executor now carries was only reachable from
`codspeed run`/`exec`. On Arch, the one command a user runs to prepare their
machine told them to install the tooling by hand while the runner was willing to
build it for them.

Run the setup for those executors too, and treat a failure as the executor
having tried rather than as fatal: it warns, names the executor and the OS, and
the remaining executors are still set up. That distinction matters for the
walltime executor, whose setup apt-installs and so fails on a non-apt host —
under the old branch it never ran, and running it unguarded would abort the
whole command.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@moha-bekh

moha-bekh commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

@GuillaumeLagrange ready for another pass — all threads addressed, and the manual Arch run is done (status, setup, exec in the three modes). Still blocked on CodSpeedHQ/valgrind-codspeed#40.

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