diff --git a/crates/mind-body/README.md b/crates/mind-body/README.md new file mode 100644 index 0000000..598ed78 --- /dev/null +++ b/crates/mind-body/README.md @@ -0,0 +1,26 @@ +# mind-body + +The Mind's body: the control store, the launch primitive and the `mind-wake` +one-shot. + +## The container lane + +`tests/wake.rs` holds one `#[ignore]`d test that runs the real `mind-wake` +binary against the real `huginn-daemon` and a real store at the brake's root, +and asserts that the host a run records is the kernel's hostname. It writes +`/etc/gamecult/minds`, so it runs in a container only (`/.dockerenv`), as root, +with the daemon built beside the binary. A plain `cargo test` skips it, and so +does `cargo mutants`, which therefore reports the three `host()` mutants in +`src/wake.rs` as missed. The lane that kills them: + +```sh +cargo build -p huginn-daemon -p mind-body --all-targets \ + && cargo test -p mind-body --test wake -- --include-ignored +``` + +On Yggdrasil, run it through the verify stopgap in the Rust image +(`ygg-verify.sh rust ''`). + +Mutation testing of the waker needs the glob form, because `-f src/wake.rs` +finds no mutants in this workspace: `cargo mutants -p mind-body -f +"**/src/wake.rs"`. diff --git a/crates/mind-body/src/wake/tests.rs b/crates/mind-body/src/wake/tests.rs index 3c32cd1..5e0e05c 100644 --- a/crates/mind-body/src/wake/tests.rs +++ b/crates/mind-body/src/wake/tests.rs @@ -176,8 +176,8 @@ fn with_the_brake_held_or_the_dial_absent_a_cycle_queries_nothing_admits_nothing fn the_wait_is_the_grants_cadence_after_the_newest_persona_turn_and_ends_exactly_there() { // (heat, base cooldown, the cadence base_cooldown / heat): whole, halved, // and one that carries nanoseconds, so an offset or scale shows. The last - // two sit beyond a second below and a day above (the dial allows both), so - // a floor or a ceiling on the wait shows too. + // three sit beyond a second below, a day above and at the dial's maximum + // (the dial allows all three), so a floor or a ceiling on the wait shows too. let heats = [ ("1", 600, seconds(600, 0)), ("2", 600, seconds(300, 0)), @@ -185,6 +185,9 @@ fn the_wait_is_the_grants_cadence_after_the_newest_persona_turn_and_ends_exactly ("0.05", 3600, seconds(72_000, 0)), ("2", 1, seconds(0, 500_000_000)), ("0.05", 10_000, seconds(200_000, 0)), + // The dial's maximum (base cooldown u32::MAX at heat 0.05): a ceiling + // anywhere below it, a week or a year included, changes the wait. + ("0.05", 4_294_967_295, seconds(85_899_345_900, 0)), ]; for (heat, cooldown, cadence) in heats { let rig = Rig::new(); diff --git a/crates/mind-body/tests/wake.rs b/crates/mind-body/tests/wake.rs index 9a97e3b..c535391 100644 --- a/crates/mind-body/tests/wake.rs +++ b/crates/mind-body/tests/wake.rs @@ -137,6 +137,10 @@ impl Drop for Daemon { /// daemon beside the binary. `PATH` is empty so no unit is ever reached: the /// run opens, its unit fails to start and the run is withdrawn, which is the /// outcome printed. +/// +/// `cargo test` and `cargo mutants` skip it, so the `host()` mutants survive +/// there. Run it in a container as root with the README's lane command +/// (`crates/mind-body/README.md`). #[test] #[ignore = "container only: root, /etc/gamecult/minds and a built huginn-daemon beside the binary"] fn the_real_bin_against_the_real_daemon_opens_a_run_that_records_this_machines_host_and_the_agent() {