From f08f4655e469a25546e44cdaf6d5624fceb7f9e6 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sat, 28 Nov 2026 17:51:30 -0700 Subject: [PATCH] Shorten the low-hit-rate warning; the fix lives in the reasons panel Co-Authored-By: Claude Fable 5.2 --- crates/server/src/view.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/server/src/view.rs b/crates/server/src/view.rs index 587175d..2abaa8b 100644 --- a/crates/server/src/view.rs +++ b/crates/server/src/view.rs @@ -440,22 +440,21 @@ fn buckets(chart: Chart<'_>, now: i64, builds: &Builds, hit_read: f64, live: boo /// throwaway server. fn low_hit_rate_detail(name: &str, hits: u64, n: u64, reasons: &[NotCached]) -> String { let mut text = format!( - "Only {}% of {} {name} compiles came from the cache, so most were rebuilt.", + "Only {}% of {} {name} compiles came from the cache.", pretty::pct(hits as f64 / n as f64), pretty::thousands(n) ); if let Some((lost, top)) = advice::fixable_loss(reasons) { text.push_str(&format!( - " Not counted in that rate: {} compiles were not cached at all for reasons you can fix; the biggest is \"{}\" ({}). {}", + " Another {} were skipped for reasons you can fix, mostly \"{}\" ({}): see \"Why compiles were not cacheable\".", pretty::thousands(lost), top.name, pretty::thousands(top.count), - top.action )); } if name == "Rust" { text.push_str( - " sccache 0.18.0 misses when anything in the compile's hash key differs from an earlier build: the rustc version, every argument (RUSTFLAGS, features, profile, cargo's metadata hash), every CARGO_* environment variable except CARGO_MAKEFLAGS, CARGO_BUILD_JOBS, CARGO_ENCODED_RUSTFLAGS and CARGO_REGISTRIES_*, the environment variables rustc lists in its dep-info, the contents of the source files and dependency libraries, and the directory the compile runs in. So the same crate built in two directories (two git worktrees) misses, and so does a different CARGO_TARGET_DIR set in the environment; the --target-dir flag does not.", + " A Rust compile misses when the folder it is built in, the compiler version, the flags or a CARGO_* variable differ from last time, so the same crate built in two folders (two git worktrees, or a different CARGO_TARGET_DIR variable) is built twice.", ); } else { text.push_str(" sccache's counters do not say why a compile missed."); @@ -1480,7 +1479,7 @@ mod tests { ); assert!(rate(vec![("Rust", [4, 46, 0])]).problems[0] .detail - .starts_with("Only 8% of 50 Rust compiles came from the cache, so most were rebuilt.")); + .starts_with("Only 8% of 50 Rust compiles came from the cache.")); let detail = seen( |s| { s.counters.langs = vec![("Rust".to_owned(), [4, 46, 0])]; @@ -1492,10 +1491,9 @@ mod tests { .detail .clone(); assert!( - detail.contains("30 compiles were not cached at all for reasons you can fix") + detail.contains("Another 30 were skipped for reasons you can fix") && detail.contains("\"Incremental compilation is on\" (30)") - && detail.contains("CARGO_INCREMENTAL=0") - && detail.contains("the directory the compile runs in") + && detail.contains("the folder it is built in") && !detail.contains("Programs and libraries"), "{detail}" );