persona: name the page's shown lines under a key the packet's elsewhere check does not trip; restore the arrivals senders

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-29 21:27:22 +01:00
commit 67ca14b90b
3 changed files with 12 additions and 8 deletions

View file

@ -18,6 +18,8 @@ use crate::testkit::at;
const META: &str = "@meta:gamecult.org";
const LIBBY: &str = "@libby:gamecult.org";
const ANN: &str = "@ann:gamecult.org";
const BO: &str = "@bo:gamecult.org";
const BASE_MS: u64 = 1_795_867_200_000;
fn room(n: u64) -> String {
@ -218,9 +220,9 @@ impl Rig {
}
}
/// Three direct messages from the operator: every line wakes her, in three rooms.
/// Three direct messages, from the operator and two members: every line wakes her, in three rooms.
fn three_rooms() -> Rig {
Rig::new(vec![line(1, &room(1), META, "morning, are you there"), line(2, &room(2), META, "evening, a question for you"), line(3, &room(3), META, "night, one more thing")])
Rig::new(vec![line(1, &room(1), META, "morning, are you there"), line(2, &room(2), ANN, "evening, a question for you"), line(3, &room(3), BO, "night, one more thing")])
}
#[test]
@ -312,12 +314,14 @@ fn t_p1_strike_then_set_aside() {
/// A line set aside is acked past before the wake, so the wake reads its room without it: the later line of the room is answered in the same start.
#[test]
fn t_p1_a_set_aside_line_is_acked_before_the_wake_reads_the_room() {
let rig = Rig::new(vec![line(1, &room(1), META, "POISON in the first line"), line(2, &room(1), META, "a fine second line")]);
rig.run(poisoned("POISON", REFUSED));
rig.run(poisoned("POISON", REFUSED));
assert_eq!(rig.run(poisoned("POISON", REFUSED)), Outcome::Drained { wakes: 1, acked_through: Some(2) });
let rig = Rig::new(vec![line(1, &room(1), META, "a line the model refuses"), line(2, &room(1), META, "a fine second line")]);
rig.run(failing(REFUSED));
rig.run(failing(REFUSED));
let tally = Tally::default();
assert_eq!(rig.run(tally.clone()), Outcome::Drained { wakes: 1, acked_through: Some(2) });
assert_eq!(rig.acks(), [1, 2], "past the set-aside line first, then the wake's");
assert_eq!(rig.records().last().unwrap()["status"], "completed");
assert!(tally.0.borrow()[1].contains("a fine second line"));
}
#[test]

View file

@ -349,7 +349,7 @@ fn packet_json(packet: &Packet) -> Value {
"arrival": packet.arrival,
"speaking": packet.speaking,
"heard": packet.heard,
"elsewhere_shown": packet.elsewhere_shown,
"shown_from_other_rooms": packet.elsewhere_shown,
})
}

View file

@ -50,7 +50,7 @@ pub(crate) fn wake(organs: &Organs, request: &Request, now: DateTime<Utc>) -> Re
prose: persona["prose"].as_str().map(str::to_owned),
usage: json!({ "projector": render["usage"], "persona": persona["usage"] }),
failed,
elsewhere_shown: report["packet"]["elsewhere_shown"].as_array().into_iter().flatten().filter_map(Value::as_str).map(str::to_owned).collect(),
elsewhere_shown: report["packet"]["shown_from_other_rooms"].as_array().into_iter().flatten().filter_map(Value::as_str).map(str::to_owned).collect(),
report,
})
}