Repository navigation
ci: key the llvm-cov cache by toolchain (fixes Coverage on main) - #459
Merged
Merged
Conversation
Coverage has failed on main since #454: every crate drops below its floor (whycodes-schema 117/121, whycodes-function 67/68) although all tests pass. Reproduced locally: with cargo-llvm-cov 0.9.1, rustc 1.99.1 reports lines that ran as 0 (schema/validator.rs 81, 136-137, 156), while stable 1.100 measures those crates at 100%, the unpin condition #452 wrote down. The tool and the compiler drift together, so the Measure step now uses rust-toolchain.toml's stable and installs [email protected]. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The stable experiment in the previous commit measured worse on Linux (workspace 94.3%), so the toolchain was not the cause. The last good main run (2026-11-12) used the same rustc 1.99.1 and cargo-llvm-cov 0.9.1 and measured whycodes-schema at 117/117; failing runs report 117/121 on unchanged source, so the line totals grew. The persistent ${CARGO_TARGET_DIR}-llvm-cov dir is never cleaned (by design, for speed), and cargo-llvm-cov reports every test binary it finds there: binaries built by another rustc (the 1.100 runs around #452, and this PR's stable run) have no profile and count as uncovered lines.
coverage.sh now keys that dir by RUSTUP_TOOLCHAIN (${CARGO_TARGET_DIR}-llvm-cov-1.99.1 in CI), which also starts CI on a clean dir once. rustc stays pinned to 1.99.1 and cargo-llvm-cov to 0.9.1. Local runs without RUSTUP_TOOLCHAIN keep the old path.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Coverage (line floor) has failed on every push to
mainsince #454, and on every PR that changes Rust (#456, #458). All tests pass; every crate drops below its floor, including untouched ones (whycodes-schema117/121,whycodes-function67/68, workspace 97.5%).Cause
Not the toolchain. The last good
mainrun (2026-11-12) used the same rustc 1.99.1 and cargo-llvm-cov 0.9.1 and measuredwhycodes-schemaat 117/117. Failing runs report 117/121 on unchanged source: the line totals grew (workspace 100,443 → 101,908).The persistent
${CARGO_TARGET_DIR}-llvm-covdir on the self-hosted runner is never cleaned (by design, it saves a ~22 min cold build), and cargo-llvm-cov reports every test binary it finds there. Test binaries built by another rustc (the 1.100 experiments around #452) have no profile in this run, so their lines count as uncovered and inflate the totals.The first commit here tried stable rustc; on Linux it measured worse (workspace 94.3%), consistent with adding yet another set of foreign binaries to the same dir. My earlier local "1.99.1 misses lines" check ran both toolchains in one dir and had the same flaw, so it is not evidence about 1.99.1.
Change
scripts/coverage.shkeys the persistent dir byRUSTUP_TOOLCHAIN(…-llvm-cov-1.99.1in CI). Binaries from another rustc can no longer enter the report, and CI starts once from a clean dir (expect one slow Coverage run). Local runs withoutRUSTUP_TOOLCHAINkeep the old path.cargo-llvm-covpinned to0.9.1so the pair only moves deliberately.scripts/test_coverage.shcovers the keyed path.This PR's own Coverage run is the confirmation.
🤖 Generated with Claude Code