From 069969020a0264b4714a8dfdead54bb15c9297ae Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 31 Oct 2026 20:00:16 +0100 Subject: [PATCH] tests pin the lane budgets, the rulings' room beside full open lists, and the people a shown memory names; recall drops an unreachable counter (mutants triage) Co-Authored-By: Claude Sonnet 5.5 --- crates/mind-body/src/persona/tests.rs | 24 +++++++++++++++++++++++- crates/mind-body/src/recall.rs | 5 +---- crates/mind-body/src/recall/tests.rs | 2 ++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/crates/mind-body/src/persona/tests.rs b/crates/mind-body/src/persona/tests.rs index 8c6b2b1..566a3eb 100644 --- a/crates/mind-body/src/persona/tests.rs +++ b/crates/mind-body/src/persona/tests.rs @@ -1985,9 +1985,11 @@ fn each_open_list_holds_its_own_bound_exactly_and_counts_what_it_drops() { crate::testkit::memory(&format!("a{index}"), MemorySort::Asked, &"a".repeat(900), &[]), ]); } - mind.committed(vec![open_follow_up("later", &spec_ref("x"), "Wire the thing.")]); + mind.committed(vec![ruling("R1", None)]); + mind.committed(vec![open_follow_up("later", &spec_ref("x"), "Wire the thing, per eureka-body:ruling:R1.")]); let goals = render_responsibilities(&mind, &slug, &names).unwrap(); assert!(goals.text.contains("eureka-body/later"), "{}", goals.text); + assert!(goals.text.contains("- eureka-body:ruling:R1: A ruling"), "the cited ruling still has its room: {}", goals.text); assert!(goals.text.len() > GOALS_MAX_BYTES, "the open lists sit outside the goals bound"); assert!(goals.text.contains("older commitments not shown") && goals.text.contains("older asks not shown")); assert!(goals.open.len() < 12 && goals.open.iter().all(|id| goals.text.contains(id.as_str())), "open is exactly what was shown"); @@ -2009,3 +2011,23 @@ fn newest_open_items_come_first_with_their_commitments_before_their_asks_and_aft assert!(at("steward of") < at("You committed to:") && at("You committed to:") < at("Asked of you, not yet taken on:") && at("Asked of you, not yet taken on:") < at("Open follow-ups"), "{text}"); assert!(at("newer part") < at("older part") && at("newer ask") < at("older ask"), "{text}"); } + +#[test] +fn whoever_a_shown_memory_or_open_item_names_may_be_named_in_the_next_reply() { + // A recalled memory heard from @dave about @carol, and an open ask by @erin: none of them spoke, none is a Mind or an operator. + let rig = Rig::new(vec![delivery(1, "swarm", "@op:chat", "hello")], &[says(&[("swarm", "hi")])]); + rig.mind.committed(vec![crate::testkit::memory_from( + "seen", + MemorySort::Learned, + "Carol is on leave", + &["@carol:chat"], + MemoryOrigin::Room { rooms: "swarm".into(), heard_from: vec!["@dave:chat".into()] }, + 500, + )]); + rig.mind.committed(vec![crate::testkit::memory("open", MemorySort::Asked, "Review the notes", &["@erin:chat"])]); + assert_eq!(failure_of(rig.go()), None); + let allowed = about_enum(&rig, 0); + for who in ["@carol:chat", "@dave:chat", "@erin:chat"] { + assert!(allowed.contains(&who.to_string()), "{who} in {allowed:?}"); + } +} diff --git a/crates/mind-body/src/recall.rs b/crates/mind-body/src/recall.rs index fc5dea4..9141341 100644 --- a/crates/mind-body/src/recall.rs +++ b/crates/mind-body/src/recall.rs @@ -246,10 +246,7 @@ fn fill(lane: Lane, candidates: Vec, matched: usize, limit elsewhere += 1; continue; } - let Some(line) = line_of(&view, &cue.names) else { - elsewhere += 1; - continue; - }; + let Some(line) = line_of(&view, &cue.names) else { continue }; if entries.len() == limit || bytes + line.len() > budget { continue; } diff --git a/crates/mind-body/src/recall/tests.rs b/crates/mind-body/src/recall/tests.rs index 4db8223..e1a2901 100644 --- a/crates/mind-body/src/recall/tests.rs +++ b/crates/mind-body/src/recall/tests.rs @@ -222,6 +222,8 @@ fn equal_weights_keep_the_newest_first() { #[test] fn lane_limits_and_budgets_fit_the_total_and_nothing_exceeds_them() { assert_eq!(MAX_BYTES, ABOUT_BYTES + RELEVANT_BYTES + SALIENT_BYTES); + assert_eq!((ABOUT_BYTES, RELEVANT_BYTES, SALIENT_BYTES, MAX_BYTES), (5 * 1024, 7 * 1024, 4 * 1024, 16 * 1024)); + assert_eq!((ABOUT_LIMIT, RELEVANT_LIMIT, SALIENT_LIMIT), (6, 8, 4)); assert_eq!(ABOUT_LIMIT + RELEVANT_LIMIT + SALIENT_LIMIT, 18); let mind = TestMind::seeded(); for index in 0..40 {