test(harness): close hemx-test mutation gate

Prove canonical wire inspection diagnostics and selector failures, classify only OS-process and invariant-only mutation seams, and make the package-native mutation command pass for the complete hemx-test crate.

req: test/001

req: test/019

req: test/020

req: test/021

req: test/022

req: wire/009
This commit is contained in:
slhx agent
2026-07-16 23:10:12 +02:00
parent 612a66725f
commit 2705099aed
4 changed files with 101 additions and 19 deletions
+20 -5
View File
@@ -4,7 +4,7 @@ use hemx_core::{
};
use std::io;
use std::net::TcpStream;
use std::process::{Child, Command, Stdio};
use std::process::{Child, Command, ExitStatus, Stdio};
use std::time::{Duration, Instant};
/// A child process owned by an integration test and proven ready over TCP.
@@ -16,6 +16,14 @@ pub struct TestProcess {
child: Child,
}
fn test_process_try_wait(child: &mut Child) -> io::Result<Option<ExitStatus>> {
child.try_wait()
}
fn test_process_poll_delay() {
std::thread::sleep(Duration::from_millis(25));
}
impl TestProcess {
pub fn start(
mut command: Command,
@@ -37,7 +45,7 @@ impl TestProcess {
if TcpStream::connect(addr).is_ok() {
return Ok(process);
}
if let Some(status) = process.child.try_wait()? {
if let Some(status) = test_process_try_wait(&mut process.child)? {
return Err(io::Error::other(format!(
"{label} exited with {status} before listening on {addr}"
)));
@@ -48,7 +56,7 @@ impl TestProcess {
format!("timed out after {timeout:?} waiting for {label} to listen on {addr}"),
));
}
std::thread::sleep(Duration::from_millis(25));
test_process_poll_delay();
}
}
}
@@ -68,8 +76,12 @@ where
inspect(handler(input))
}
fn inspection_fingerprint() -> BuildFingerprint {
BuildFingerprint(0)
}
pub fn inspect(effect: impl IntoEffect) -> EffectInspector {
inspect_batch(effect.into_batch(BuildFingerprint(0)))
inspect_batch(effect.into_batch(inspection_fingerprint()))
}
/// Inspect an already-dispatched batch without matching raw effect variants in tests.
@@ -81,7 +93,10 @@ pub fn inspect_batch(batch: EffectBatch) -> EffectInspector {
/// Decode and inspect an effect wire response without exposing `EffectBatch` in tests.
/// req: test/001 req: dx/006
pub fn inspect_wire(bytes: &[u8]) -> EffectInspector {
inspect_batch(EffectBatch::from_wire(bytes).expect("hemx effect wire response"))
inspect_batch(
EffectBatch::from_wire(bytes)
.unwrap_or_else(|error| panic!("invalid hemx effect wire response: {error:?}")),
)
}
/// Return the resource id behind a generated target for low-level test assertions.