From 6e2733fb470cac15b7542ed67f9e4738f9e77d52 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 22 Oct 2026 18:22:00 +0200 Subject: [PATCH] mind-body tests: the grace is exact at its boundary, and the child's stderr is the journal Both found by hand mutation: grace-boundary-late and stderr-not-the-journal had no test. Co-Authored-By: Claude Sonnet 5.5 --- crates/mind-body/src/self_run/tests.rs | 4 ++++ crates/mind-body/tests/self_run.rs | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/mind-body/src/self_run/tests.rs b/crates/mind-body/src/self_run/tests.rs index c9ce971..fff273a 100644 --- a/crates/mind-body/src/self_run/tests.rs +++ b/crates/mind-body/src/self_run/tests.rs @@ -508,6 +508,10 @@ fn after_the_flush_the_grace_interrupts_exactly_once_and_not_a_second_early() { assert_eq!(on_time.count(&Event::Interrupted), 1); assert_eq!(on_time.ended().0, Cause::Interrupted); + // Exactly at the grace is the grace: the interrupt comes then, not on the next wait. + let exact = carry_with(&Seen::of(&with_run()), vec![Out(at("m1", CEILING_TOKENS)), Idle(grace)], Some(130), true); + assert_eq!(exact.ended().0, Cause::Interrupted); + // A child that ignores it is interrupted once and still waited for. let stubborn = carry_with(&Seen::of(&with_run()), vec![Out(at("m1", CEILING_TOKENS)), Idle(grace), Idle(grace), Idle(grace)], Some(0), false); assert_eq!(stubborn.count(&Event::Interrupted), 1); diff --git a/crates/mind-body/tests/self_run.rs b/crates/mind-body/tests/self_run.rs index 21ced3d..4753055 100644 --- a/crates/mind-body/tests/self_run.rs +++ b/crates/mind-body/tests/self_run.rs @@ -236,7 +236,8 @@ mod lane { ) }; let body = format!( - "echo '{first}'\necho '{second}'\nread -t 5 start\nread -t 5 flush\necho \"$start\" >> {record}\necho \"$flush\" >> {record}\necho \"$SELF_RUN_ENV_CANARY\" >> {record}\necho '{{\"type\":\"result\"}}'\nwhile read more; do :; done\nexit 0", + "echo journal-line >&2 +echo '{first}'\necho '{second}'\nread -t 5 start\nread -t 5 flush\necho \"$start\" >> {record}\necho \"$flush\" >> {record}\necho \"$SELF_RUN_ENV_CANARY\" >> {record}\necho '{{\"type\":\"result\"}}'\nwhile read more; do :; done\nexit 0", first = request("msg_1", 100), second = request("msg_2", 299_999), record = bin.path().join("record").display(), @@ -249,6 +250,7 @@ mod lane { assert_eq!(output.status.code(), Some(0), "{stdout}\n{}", String::from_utf8_lossy(&output.stderr)); assert_eq!(stdout, "request 1 prefix 101\nrequest 2 prefix 300000\nended: flushed code 0 requests 2 prefix 300000\n"); assert!(!all_output(&output).contains(ENV_CANARY), "the unit's environment is the child's, not the bin's output"); + assert!(String::from_utf8_lossy(&output.stderr).contains("journal-line"), "the child's stderr is the unit's journal"); let recorded = std::fs::read_to_string(&record).unwrap(); let mut lines = recorded.lines();