From 547a9cd354ad0622c027d746bc22d98474ae4e87 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 22 Oct 2026 17:37:17 +0200 Subject: [PATCH] mind-body tests: check is refused for a held instance whose prefix neighbours are released eureka is held; eureka-two, eureka2 and xeureka are released with a dial and open. Kills Soul's s-check-wrong-instance-by-prefix mutant. Follow-up gate-prefix-neighbour-test. Not yet built; verified at the head of the cut. Co-Authored-By: Claude Sonnet 5.5 --- crates/mind-body/tests/cli.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/crates/mind-body/tests/cli.rs b/crates/mind-body/tests/cli.rs index 6d489d5..c5228e4 100644 --- a/crates/mind-body/tests/cli.rs +++ b/crates/mind-body/tests/cli.rs @@ -236,6 +236,25 @@ fn check_opens_on_release_with_a_dial_and_is_per_instance() { assert!(format!("{:#}", other.unwrap_err()).contains("BrakeAbsent")); } +#[test] +fn check_holds_for_the_named_instance_with_a_released_prefix_neighbour() { + let root = tempfile::tempdir().unwrap(); + go(root.path(), &["--instance", "eureka", "brake", "hold"], "op", 0).0.unwrap(); + // Neighbours that share the held instance's text as a prefix, or only an edge of it, are released with a dial. + for (i, neighbour) in ["eureka-two", "eureka2", "xeureka"].into_iter().enumerate() { + let at = 1 + 2 * i as i64; + go(root.path(), &["--instance", neighbour, "brake", "release"], "op", at).0.unwrap(); + go(root.path(), &["--instance", neighbour, "dial", "set", "--heat", "0.5", "--base-cooldown-s", "3600", "--base-run-usd", "5"], "op", at + 1) + .0 + .unwrap(); + let (open, _) = go(root.path(), &["--instance", neighbour, "check"], "op", 10); + open.unwrap_or_else(|error| panic!("{neighbour} is released and must open: {error:#}")); + } + let (result, out) = check_out(root.path()); + let error = format!("{:#}", result.unwrap_err()); + assert!(error.contains("BrakeHeld") && out.contains("BrakeHeld"), "{error} / {out}"); +} + #[test] fn check_writes_nothing_and_creates_no_directory() { let root = tempfile::tempdir().unwrap();