From 9faeb940355d8177afebf8e36d2875ac928cee2d Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 1 Nov 2026 02:55:43 +0100 Subject: [PATCH] queue, heartbeat tests: a question in another item's run is no boundary; no held brief, no held note Co-Authored-By: Claude Sonnet 5.5 --- crates/mind-body/src/heartbeat/tests.rs | 9 +++++++++ crates/mind-body/src/queue.rs | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/crates/mind-body/src/heartbeat/tests.rs b/crates/mind-body/src/heartbeat/tests.rs index 0145bf7..5ab34d6 100644 --- a/crates/mind-body/src/heartbeat/tests.rs +++ b/crates/mind-body/src/heartbeat/tests.rs @@ -1091,3 +1091,12 @@ fn a_trip_and_a_wait_say_so_in_the_trace() { beats_until(&rig, 12, || notes().contains(&waiting)); assert!(notes().contains(&waiting), "{:?}", notes()); } + +#[test] +fn a_beat_with_no_held_brief_writes_no_held_note() { + let (rig, source) = rig_with_a_persona_turn(); + brief_by(&rig, ANN, crate::persona::AGENT, "free", &source); + rig.poll(); + let notes: Vec = rig.store.traces.borrow().iter().flat_map(|trace| trace.instances.iter().map(|instance| instance.note.clone())).collect(); + assert!(notes.iter().all(|note| !note.contains("held")), "{notes:?}"); +} diff --git a/crates/mind-body/src/queue.rs b/crates/mind-body/src/queue.rs index bf6e69f..d68ce30 100644 --- a/crates/mind-body/src/queue.rs +++ b/crates/mind-body/src/queue.rs @@ -604,6 +604,15 @@ mod tests { } } + #[test] + fn a_question_in_a_run_that_did_not_claim_the_item_is_no_boundary() { + let (mind, item) = worked(&[E, E, E]); + mind.committed(vec![spec("y")]); + mind.committed(vec![run("other", RunTurn::SelfRun, RunOperator::Mind, &[spec_ref("y")])]); + mind.committed(vec![question_in("fork", &run_ref("other"))]); + assert_eq!(breaker(&mind, &item, &[]).unwrap(), Breaker::Trip { run: run_ref("h2") }, "the question holds y's run, not x's count"); + } + /// A daemon that is not there: the failure names no input, endpoint or /// instance. #[test]