//! **This repo must contain no silenced test file.**
//!
//! A `tests/*.rs` carrying a crate-level `#![cfg(feature = "X")]` that the crate's
//! `default` closure does not satisfy compiles to an **empty test binary**. `cargo
//! test` then prints `running 0 tests ... ok` for it — a green produced by looking
//! at nothing. That is LAW 2's exact failure mode, and it is invisible to review
//! because the file reads like its running siblings.
//!
//! `nornir_testmatrix::audit_repo` walks every `test` target of the workspace (via
//! `cargo metadata`), resolves the crate's transitive `default` feature closure,
//! and reports any gated file that is neither default-reachable nor rescued by a
//! declared arm in `.nornir/testmatrix-arms.json`.
//!
//! ## What was dark in draupnir on 2026-08-01
//!
//! draupnir is `default = []` **by design** — the lean core is pure std and every
//! live backend sits behind a feature. The cost of that correct decision is that
//! every backend proof is gated, and a gated proof is a silent one unless it is
//! declared. Measured with the guard, from disk: 4 test targets scanned, 3
//! feature-gated, **2 silenced**:
//!
//! - `tests/stage1_container_start_proof.rs` (`backend-oci`, 1 hidden `#[test]`)
//! - `tests/stage2_youki_start_proof.rs` (`backend-youki`, 1 hidden `#[test]`)
//!
//! Both are the repo's *headline* proofs — the container `BOOT-OK` on the bollard
//! path and on the daemon-less youki path — and neither had ever been reachable
//! from a plain `cargo test`. Both were compiled and RUN on 2026-08-01; see
//! `.nornir/testmatrix-arms.json` for exactly what each arm proves and what it does
//! not. `tests/live_oci_published_port.rs` was already rescued by the arm declared
//! on 2026-07-21.
//!
//! ## Why this file is not itself feature-gated
//!
//! A guard hidden behind the mechanism it polices would go dark exactly when a
//! feature is off — which is when it is needed. It carries **no** `#![cfg]`, and
//! its only dependency is the serde-only `nornir-testmatrix` (a dev-dependency),
//! so it runs on a plain `cargo test` with no features at all.
use std::path::{Path, PathBuf};
/// The repo root — draupnir's root crate IS the repo, so the manifest directory is
/// already it.
fn repo_root() -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
.ancestors()
.nth(0)
.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()
)
});
// Non-vacuity (LAW 2: check output, not exit code). A root that resolves but
// scans nothing reports "0 silenced" because it looked at nothing.
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")
);
}