xtask/tests/silenced_tests_guard.rs
//! **holger's own silenced-test guard.** A `tests/*.rs` whose crate-level
//! `#![cfg(feature = "X")]` is not satisfied by its crate's `default` closure
//! compiles to an EMPTY test binary and prints `running 0 tests ... ok`.
//!
//! ## Why this file exists next to `holger_matrix.rs`
//!
//! `xtask/tests/holger_matrix.rs` is the constellation's REFERENCE mitigation for
//! this problem: it re-invokes each `gui` test file as its own matrix cell. The
//! arms file already records why that is not enough — a matrix re-invokes an
//! ENUMERATED list and silently stops covering anything added afterwards. The
//! enumeration cannot notice its own omission.
//!
//! And it did not. On 2026-07-21 the arms file declared `-p holger-server-ui --features
//! gui`; on 2026-08-01 a re-measure found **2 targets** that gate on features `gui`
//! does not imply, so neither the matrix nor the arm covered them:
//!
//! * `server/ui/tests/demo_walk.rs` — `#![cfg(feature = "demo")]`. It had **never
//! compiled**: `frame()` called `ctx.run(input, |ctx| app.draw_ui(ui))`, naming a
//! `ui` that does not exist in that scope, because `Context::run` hands a
//! `&Context` (egui 0.34's Ui-closure form is `run_ui`). Being dark is worse than
//! being red: turning the feature on just errored, so nobody ever did. Fixed in
//! the same change as this file.
//! * `server/ui/tests/warehouse_scan.rs` — `#![cfg(feature = "warehouse-scan")]`,
//! 1 test. It compiles; it was simply never named.
//!
//! Both need `gui` in ADDITION to their own feature (the panes they drive live
//! behind `gui-core`), which is why the arms name `gui-embedded` — holger's own
//! `["gui", "warehouse-scan", "bench", "demo"]` tier, the feature set `demo_walk`'s
//! header always told people to use.
//!
//! ## Why this file is not itself feature-gated
//!
//! Because it is the guard. A gated guard compiles to zero tests and reports green
//! while auditing nothing — the precise disease. It takes no feature, runs only
//! `cargo metadata --no-deps` (no build, no network, no egui, no display), and runs
//! on every plain `cargo test`.
//!
//! ## What this does NOT prove
//!
//! That the arms are RUN, or that the tests they name PASS. This compares the arms
//! file against what is on disk. Compiling each arm is
//! `nornir_testmatrix::verify_arms`, run by hand on 2026-08-01; its results are
//! recorded in `.nornir/testmatrix-arms.json`.
use std::path::{Path, PathBuf};
fn repo_root() -> PathBuf {
// xtask → <repo root>
Path::new(env!("CARGO_MANIFEST_DIR"))
.ancestors()
.nth(1)
.unwrap()
.to_path_buf()
}
#[test]
fn this_repo_has_no_silenced_test_files() {
let root = repo_root();
let rep = nornir_testmatrix::audit_repo(&root, "self-audit").unwrap_or_else(|e| {
panic!(
"the silenced-test audit could not RUN at {} — that is a RED, not a skip: {e:#}",
root.display()
)
});
assert!(
rep.scanned > 0,
"the audit scanned ZERO test targets under {} — it proved nothing",
root.display()
);
assert!(
rep.is_green(),
"SILENCED TESTS — {}\n{}",
rep.summary(),
rep.silenced()
.iter()
.map(|f| format!(" · {}", f.message()))
.collect::<Vec<_>>()
.join("\n")
);
}