Skip to content

ci: key the llvm-cov cache by toolchain (fixes Coverage on main) - #459

Merged
mrnasil merged 2 commits into
mainfrom
ci/unpin-coverage-toolchain
Nov 21, 2026
Merged

mrnasil merged 2 commits into
mainfrom
ci/unpin-coverage-toolchain

Conversation

@mrnasil

@mrnasil mrnasil commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Problem

Coverage (line floor) has failed on every push to main since #454, and on every PR that changes Rust (#456, #458). All tests pass; every crate drops below its floor, including untouched ones (whycodes-schema 117/121, whycodes-function 67/68, workspace 97.5%).

Cause

Not the toolchain. 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: the line totals grew (workspace 100,443 → 101,908).

The persistent ${CARGO_TARGET_DIR}-llvm-cov dir 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.sh keys the persistent dir by RUSTUP_TOOLCHAIN (…-llvm-cov-1.99.1 in 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 without RUSTUP_TOOLCHAIN keep the old path.
  • rustc stays pinned to 1.99.1; cargo-llvm-cov pinned to 0.9.1 so the pair only moves deliberately.
  • scripts/test_coverage.sh covers the keyed path.

This PR's own Coverage run is the confirmation.

🤖 Generated with Claude Code

mrnasil and others added 2 commits November 22, 2026 01:00
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]>
@mrnasil mrnasil changed the title ci: Coverage back on stable rustc, cargo-llvm-cov pinned to 0.9.1 ci: key the llvm-cov cache by toolchain (fixes Coverage on main) Nov 21, 2026
@mrnasil
mrnasil merged commit 74c61fe into main Nov 21, 2026
7 checks passed
@mrnasil
mrnasil deleted the ci/unpin-coverage-toolchain branch November 21, 2026 23:38
@mrnasil mrnasil mentioned this pull request Nov 26, 2026
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.

1 participant