Skip to content

ci: fix Coverage on Rust 1.100 and the logging.rs coverage flake - #452

Merged
mrnasil merged 5 commits into
mainfrom
fix/core-logging-coverage-flake
Nov 12, 2026
Merged

mrnasil merged 5 commits into
mainfrom
fix/core-logging-coverage-flake

Conversation

@mrnasil

@mrnasil mrnasil commented Nov 12, 2026

Copy link
Copy Markdown
Member

Fixes the recurring Coverage flake FAIL whycodes-core: 3011/3012 lines / core/src/logging.rs: 457/458 miss 1.

Cause: logging_helpers_cover_remaining_branches poisons PANIC_CLEANUP on purpose, and mutex poison is sticky. When that test ran before panic_hook_runs_registered_cleanup, run_panic_cleanup only ever saw the Poisoned branch, so the Ok(g) => g line (logging.rs:552) went uncovered.

Fix: clear the poison at the start of panic_hook_runs_registered_cleanup (both tests hold TEST_LOCK, so this is race-free).

Verified: cargo llvm-cov -p whycodes-core --lib -- --test-threads=1 logging_helpers_cover_remaining_branches panic_hook_runs_registered_cleanup — line 552 hit count 0 before, 2 after.

🤖 Generated with Claude Code

mrnasil and others added 3 commits November 12, 2026 22:50
…ndependent

logging_helpers_cover_remaining_branches poisons PANIC_CLEANUP on purpose,
and poison is sticky. When it ran before panic_hook_runs_registered_cleanup,
run_panic_cleanup never took its Ok branch and whycodes-core fell to
3011/3012 lines (core/src/logging.rs miss 1). Clear the poison first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rust 1.100 flags the headless resize error arm as unreachable (the test
backend's error type is uninhabited) and two if-guard-then-true tails as
needless_bool. Lint & Budgets fails on every PR until these are fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mrnasil mrnasil changed the title test(core): make panic-cleanup coverage independent of test order test(core): order-independent panic-cleanup coverage; clear Rust 1.100 lints Nov 12, 2026
@mrnasil

mrnasil commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Also fixes three new Rust 1.100 lints that fail Lint & Budgets on every PR: unreachable_code on the headless resize arm (crates/tui/src/run/mod.rs; the test backend's error type is uninhabited, so it is now let Ok(()) = ...) and needless_bool in crates/tui/src/ui/chat.rs and crates/lsp/src/detect.rs (the latter only on non-unix).

rustc 1.100 reports executed lines as 0 (e.g. whycodes-schema drops from
117/117 to 120/121 with no code change), failing every 100% floor and the
workspace floor. Pin only the coverage toolchain until stable measures
the same again; lint, test and build stay on stable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mrnasil mrnasil changed the title test(core): order-independent panic-cleanup coverage; clear Rust 1.100 lints ci: fix Coverage on Rust 1.100 and the logging.rs coverage flake Nov 12, 2026
@mrnasil

mrnasil commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Coverage on Rust 1.100 dropped to 94.6% workspace / dozens of 100%-floor crates with no code change. Reproduced locally: cargo +1.99.1 llvm-cov -p whycodes-schema is 117/117 lines, cargo +1.100 llvm-cov -p whycodes-schema is 120/121 and marks executed lines (e.g. validator.rs:11, :18-19) as 0. Pinned only the Coverage job to 1.99.1 (9978cd4); lint/test/build stay on stable. Unpin once stable measures the same.

Formatter tests run rustfmt; under RUSTUP_TOOLCHAIN=1.99.1 the proxy needs
that toolchain's rustfmt component.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mrnasil
mrnasil merged commit 4befdb0 into main Nov 12, 2026
7 checks passed
@mrnasil
mrnasil deleted the fix/core-logging-coverage-flake branch November 12, 2026 21:08
mrnasil added a commit that referenced this pull request Nov 21, 2026
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 added a commit that referenced this pull request Nov 21, 2026
* ci: Coverage back on stable rustc, cargo-llvm-cov pinned to 0.9.1

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]>

* ci: key the llvm-cov cache by toolchain; keep rustc 1.99.1

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]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@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