persona drain tests: Soul s8's DM sequence and held-sibling record against a mouth that vouches only for what it attempted
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0c06eaf31e
commit
ccecac90e0
1 changed files with 55 additions and 1 deletions
|
|
@ -84,7 +84,7 @@ impl Chat for Rc<FakeMouth> {
|
|||
Ok(ChatPending { persona: "eureka".into(), deliveries: self.held.borrow().iter().filter(|delivery| delivery.seq > after).take(self.page.get()).cloned().collect(), tail: Some(self.tail.borrow().clone()), tail_gaps: vec![] })
|
||||
}
|
||||
fn send(&self, request: &ChatSendRequest) -> Result<ChatSendReceipt> {
|
||||
let attempted = self.txn.borrow().contains_key(&request.request_id) || self.down.borrow().contains(&request.room_alias) && self.attempts.borrow().contains(&request.request_id);
|
||||
let attempted = self.attempts.borrow().contains(&request.request_id);
|
||||
self.attempts.borrow_mut().push(request.request_id.clone());
|
||||
if let Some(refusal) = self.refuse.get() {
|
||||
return Ok(ChatSendReceipt { request_id: request.request_id.clone(), event_id: None, refusal: Some(refusal), newer: vec![] });
|
||||
|
|
@ -1270,6 +1270,7 @@ fn t_l3_a_send_never_handed_over_goes_out_as_a_first_send_and_every_later_reply_
|
|||
{ "id": "l1:s0", "room": room(1), "text": "one", "handed": true }, { "id": "l1:s1", "room": room(1), "text": "two" }], "posted": [], "refused_sends": [], "edited": [],
|
||||
"at": (Utc.timestamp_millis_opt(i64::try_from(BASE_MS).unwrap()).unwrap() - Duration::seconds(30)).to_rfc3339() })));
|
||||
rig.mouth.txn.borrow_mut().insert("l1:s0".into(), "$ev-0".into());
|
||||
rig.mouth.attempts.borrow_mut().push("l1:s0".into());
|
||||
// And a start killed before its first send, in another room.
|
||||
unhanded_record(&rig, "n1-t0", 20, &[("l2:s0", &room(2), "killed before it went")]);
|
||||
rig.run(Never);
|
||||
|
|
@ -1352,3 +1353,56 @@ fn t_l3_a_refusal_answered_to_a_resend_is_unknown_and_told_and_to_a_first_send_i
|
|||
assert!(crate::projection::history(&rows).last_outcome.is_some_and(|last| last["unknown"][0]["text"] == "handed over"), "she is told it is unknown");
|
||||
}
|
||||
}
|
||||
|
||||
/// Soul s8 held-send-never-vouched, her DM sequence against a mouth that vouches only for what it attempted. An older send turns unknown, the newer one in
|
||||
/// its room waits, her turn tells her, and then every later reply in the room posts: none held behind the unknown is repeated as a resend the mouth cannot
|
||||
/// vouch for, so none turns unknown in its turn.
|
||||
#[test]
|
||||
fn t_l3_after_an_unknown_in_her_dm_every_later_reply_posts() {
|
||||
let rig = Rig::new(vec![]);
|
||||
rig.mouth.vouches_attempted.set(true);
|
||||
owing_record(&rig, "n0-t0", 2500, &[("lold:s0", &room(1), "the old line")]);
|
||||
owing_record(&rig, "n1-t0", 100, &[("lnew:s0", &room(1), "the newer line"), ("lelse:s0", &room(2), "elsewhere")]);
|
||||
rig.mouth.attempts.borrow_mut().extend(["lnew:s0".to_owned(), "lelse:s0".to_owned()]); // both were handed over once, by the start that decided them
|
||||
rig.run(Never);
|
||||
assert_eq!(texts(&rig, &room(2)), ["elsewhere"], "another room's send is repeated and posts");
|
||||
assert!(texts(&rig, &room(1)).is_empty(), "nothing into the room before she is told");
|
||||
// A member writes in the room: her turn there tells her, and her reply is held behind the newer line, never handed to the mouth.
|
||||
rig.mouth.held.borrow_mut().push(line(1, &room(1), META, "hello"));
|
||||
rig.run(scripted(false));
|
||||
assert!(texts(&rig, &room(1)).is_empty(), "the start that held it goes by: {:?}", texts(&rig, &room(1)));
|
||||
rig.run(Never);
|
||||
// And again, a later line and her reply to it.
|
||||
rig.mouth.held.borrow_mut().push(line(2, &room(1), META, "are you there?"));
|
||||
rig.run(scripted(false));
|
||||
rig.run(Never);
|
||||
let rows: Vec<Value> = rig.trace.rows.borrow().iter().map(|(_, record)| record.clone()).collect();
|
||||
let said = texts(&rig, &room(1));
|
||||
assert_eq!(said.len(), 3, "the newer line, her reply to the first line and her reply to the second: {said:?}");
|
||||
assert_eq!(said[0], "the newer line");
|
||||
assert_eq!(rows.iter().filter_map(|record| record["unknown_sends"].as_array()).map(Vec::len).sum::<usize>(), 1, "only the old line is unknown: {rows:?}");
|
||||
assert!(!crate::projection::owes(&rows), "nothing is owed");
|
||||
}
|
||||
|
||||
/// Soul s8 held-sibling-restart-storm, the record. A send handed over that the mouth cannot vouch for turns unknown and holds its sibling, never handed
|
||||
/// over, in its room: it stays owed and unmarked, each start tries nothing, until the window ends, and then it is refused as not sent, which is all that is known.
|
||||
#[test]
|
||||
fn t_l3_a_held_sibling_stays_owed_unhanded_until_the_window_and_is_then_told_as_not_sent() {
|
||||
let rig = Rig::new(vec![]);
|
||||
rig.mouth.vouches_attempted.set(true);
|
||||
rig.trace.rows.borrow_mut().push(("n0-t0".into(), json!({ "key": "n0-t0", "room": room(1), "held": [], "owed": [
|
||||
{ "id": "la:s0", "room": room(1), "text": "one", "handed": true }, { "id": "la:s1", "room": room(1), "text": "two" }], "posted": [], "refused_sends": [], "edited": [],
|
||||
"at": (Utc.timestamp_millis_opt(i64::try_from(BASE_MS).unwrap()).unwrap() - Duration::seconds(60)).to_rfc3339() })));
|
||||
for _ in 0..3 {
|
||||
rig.run(Never);
|
||||
let rows: Vec<Value> = rig.trace.rows.borrow().iter().map(|(_, record)| record.clone()).collect();
|
||||
assert!(crate::projection::owes(&rows), "{}", rows[0]);
|
||||
assert_eq!(rows[0]["owed"][0]["text"], "two");
|
||||
assert!(rows[0]["owed"][0].get("handed").is_none(), "{}", rows[0]);
|
||||
}
|
||||
assert!(texts(&rig, &room(1)).is_empty());
|
||||
rig.ticks.set(rig.ticks.get() + 1800);
|
||||
rig.run(Never);
|
||||
let rows: Vec<Value> = rig.trace.rows.borrow().iter().map(|(_, record)| record.clone()).collect();
|
||||
assert!(!crate::projection::owes(&rows) && rows[0]["refused_sends"][0]["refusal"] == "not_sent_past_the_window", "{}", rows[0]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue