diff --git a/crates/mind-body/src/projection/interpret/tests.rs b/crates/mind-body/src/projection/interpret/tests.rs index 94daf64..0aabd6a 100644 --- a/crates/mind-body/src/projection/interpret/tests.rs +++ b/crates/mind-body/src/projection/interpret/tests.rs @@ -3548,3 +3548,20 @@ fn k64_an_unread_target_stays_a_read_need() { assert!(x5_r6_view(&state).contains("It needs her to read https://ccrma.stanford.edu/~jos/pasp/, and she has not read it yet."), "{read:?}"); } } + +/// A read need with no receipt never reads as unread beside a read of the same target that this conversation found (K64): +/// an entry opened before K64, or put from outside, shows the read and when. +#[test] +fn k64_the_view_never_says_unread_beside_a_read_of_the_same_target() { + let mut state = libby(&json!([])); + state["commitments"] = json!([{ "id": "c-r1-t5-1", "to": DERU, "room": MINDS, "event": "5", "madeAt": (now() - chrono::Duration::minutes(40)).to_rfc3339(), "words": "I'll read it and come back to you.", "status": "open", "needs": { "kind": "read", "request": { "kind": "web", "target": PASP } }, "closedAt": null, "closedBy": null, "extensions": {} }]); + let room = Room { messages: vec![RoomLine { event: "$x5-1".into(), ..line(MINDS, DERU, "Deru", X5_DERU_R5, true) }], here: Some(MINDS.into()), ..Room::default() }; + let view = |found: bool| { + let exchange = crate::projection::exchange::Exchange { tried: vec![crate::projection::exchange::Tried { key: ReadRequest::Web(PASP.into()).normal(), found, what: PASP.into(), at: now() - chrono::Duration::minutes(30) }], ..Default::default() }; + let (minds, operators) = (vec![LIBBY.to_owned(), DERU.to_owned()], vec![META.to_owned()]); + select(&Inputs { kind: TurnKind::Chat, state: &state, room: &room, history: &History::default(), observation: None, people: People { operators: &operators, minds: &minds, own_sender: LIBBY }, now: now(), seed: 1, affordances: &[Affordance::Perceive, Affordance::Speak], domain: None, exchange: Some(&exchange) }, &Tuning::default()).in_view + }; + let found = view(true); + assert!(found.contains("It needs her to read https://ccrma.stanford.edu/~jos/pasp/: she read it about half an hour ago.") && !found.contains("not read it yet"), "{found}"); + assert!(view(false).contains("and she has not read it yet."), "a read that found nothing is no read of it"); +}