From 12b777e67fcdb10efe9bdc04ea4af9bb8f36e3a6 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 19 Nov 2026 23:36:12 +0100 Subject: [PATCH] Projector: clippy; others counted when messages to her take the room; the e^-21 floor is a short-term item's Co-Authored-By: Claude Opus 5.5 --- .../src/projection/fixtures/golden-chat.txt | 20 ------------------- crates/mind-body/src/projection/select.rs | 8 ++++++-- crates/mind-body/src/projection/tests.rs | 7 ++++--- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/crates/mind-body/src/projection/fixtures/golden-chat.txt b/crates/mind-body/src/projection/fixtures/golden-chat.txt index a595b2d..e69de29 100644 --- a/crates/mind-body/src/projection/fixtures/golden-chat.txt +++ b/crates/mind-body/src/projection/fixtures/golden-chat.txt @@ -1,20 +0,0 @@ -lens: PersonPresent("Kiko") -selected: need-relatedness, t1-w0 -present: Kiko, Libby ---- identity -Eureka (she/her). Dry, direct, almost feral; zeal aimed at revealing. ---- context -- now: Thursday 19 November, 14:05 UTC -- mood, with no earlier turn to measure from: lighter, more settled than middling -- bond [bond-kiko] Kiko, sparring partner: fair trust, heavy friction. Kiko pokes her to stop massaging the pipeline. -- bond [bond-libby] Libby, collaborator: fair trust, a little friction. Libby holds the sounds and teases her about the pipeline. -- need [need-relatedness]: company, strong -- wondering [t1-w0]: Whether the trace could be smaller. ---- stimulus -Said to her: -- Libby in #swarm:gamecult.org: "Eureka, did you see the door fix?" -Also in the room: -- Kiko in #swarm:gamecult.org: "She saw it. She hated it." ---- heard -Libby, in #swarm:gamecult.org: "Eureka, did you see the door fix?" -Kiko, in #swarm:gamecult.org: "She saw it. She hated it." diff --git a/crates/mind-body/src/projection/select.rs b/crates/mind-body/src/projection/select.rs index e1d3fe8..7299d51 100644 --- a/crates/mind-body/src/projection/select.rs +++ b/crates/mind-body/src/projection/select.rs @@ -595,7 +595,7 @@ fn said_to_her(to_her: &[&RoomLine], render: impl Fn(&RoomLine, &str) -> String, let mut clipped = 0; for line in to_her.iter().rev() { let whole = render(line, &spoken(&line.text)); - if used + whole.len() + 1 <= ceiling { + if used + whole.len() < ceiling { used += whole.len() + 1; kept.push(whole); continue; @@ -640,7 +640,11 @@ fn chat_stimulus(inputs: &Inputs, tuning: &Tuning) -> (String, String, Overflow) } let others_typed: Vec = others.iter().map(|line| typed(line, &spoken(&line.text))).collect(); let room_left = tuning.select.stimulus_bytes.saturating_sub(stimulus.len() + 1); - let also = newest_section("Also in the room:", &others_typed, room_left); + let mut also = newest_section("Also in the room:", &others_typed, room_left); + if also.is_empty() && !others_typed.is_empty() { + // The messages to her took the room: the others are counted, never silently gone. + also = format!("({} more in the room not shown)", others_typed.len()); + } if !also.is_empty() { if !stimulus.is_empty() { stimulus.push('\n'); diff --git a/crates/mind-body/src/projection/tests.rs b/crates/mind-body/src/projection/tests.rs index 5d7ddba..5af0c2c 100644 --- a/crates/mind-body/src/projection/tests.rs +++ b/crates/mind-body/src/projection/tests.rs @@ -256,8 +256,8 @@ fn an_item_shown_five_times_in_a_row_drops_out() { #[test] fn an_item_scoring_minus_twenty_one_almost_never_appears() { - // A memory three weeks old against a 24-hour time constant: recency alone is about exp(-21). - let state = json!({ "publicName": "Eureka", "thoughtMemory": { "memories": [{ "id": "ancient", "summary": "Long ago.", "createdAt": hours_ago(21 * 24) }] } }); + // A short-term item three weeks old against a 24-hour time constant: recency alone is about exp(-21). + let state = json!({ "publicName": "Eureka", "thoughtMemory": { "shortTerm": [{ "id": "ancient", "summary": "Long ago.", "createdAt": hours_ago(21 * 24) }] } }); let packet = packet_of(TurnKind::Beat, &state, &Room::default(), &History::default(), 1); assert!(packet.selected.is_empty() || packet.selected[0].log_score < -20.0); let shown = (1..=500).filter(|seed| !packet_of(TurnKind::Beat, &state, &Room::default(), &History::default(), *seed).selected.is_empty()).count(); @@ -327,7 +327,8 @@ fn every_message_to_her_survives() { assert!(packet.heard.contains(&format!("\"{words}\"")) && packet.stimulus.contains(&words), "message {at} to her was dropped"); } let kept = packet.stimulus.matches("aside").count(); - assert!(packet.stimulus.contains(&format!("({} earlier not shown)", 30 - kept)) || kept == 30, "the note counts exactly the others left out: {}", packet.stimulus); + let note = if kept == 0 { "(30 more in the room not shown)".to_owned() } else { format!("({} earlier not shown)", 30 - kept) }; + assert!(packet.stimulus.contains(¬e) || kept == 30, "the note counts exactly the others left out: {}", packet.stimulus); } #[test]