Persona wake: the drain's own-rooms test follows the mind's one-instance rule

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-27 21:11:40 +01:00
commit 4b134c3d1e

View file

@ -864,23 +864,15 @@ mod wake_rule {
fn her_own_rooms_are_read_from_her_mind_as_the_poll_reads_them_and_an_unreadable_mind_is_an_error() {
let rig = quiet_rig();
steward(&rig, BOB, "GameCult/Swarm", &[]);
// A stewardship of another instance held in her mind: the poll's reader counts it, so the drain's does.
rig.minds[BOB].committed(vec![PipelineDocument::Stewardship(eureka_pipeline::PipelineStewardship {
instance: Slug("ann".into()),
repo: "GameCult/Annwork".into(),
sequence: 1,
assigned_on: eureka_pipeline::Date("2026-11-06".into()),
note: "assigned".into(),
names: vec![],
})]);
let aliases = ["#SWARM:chat", "#annwork:chat", "#general:chat", "!dm:chat"];
// Her mind refuses another instance's stewardship (ForeignInstance), so the poll's and the drain's readers cannot disagree on instance.
let aliases = ["#SWARM:chat", "#general:chat", "!dm:chat"];
let rooms = |down: bool| {
let (calls, admits, reads, stewardship_down) = (Cell::new(0), Cell::new(0), Cell::new(0), Cell::new(down));
own_rooms_among(&Counting { inner: &rig.minds[BOB], calls: &calls, admits: &admits, stewardship_reads: &reads, stewardship_down: &stewardship_down }, aliases)
};
assert_eq!(rooms(false).unwrap(), vec!["#SWARM:chat".to_owned(), "#annwork:chat".to_owned()]);
assert_eq!(rooms(false).unwrap(), vec!["#SWARM:chat".to_owned()]);
assert!(rooms(true).is_err(), "unread is an error the caller reports, not no rooms");
rig.say(BOB, ChatDelivery { room_alias: "#annwork:chat".into(), ..delivery(1, "@member:chat", "what a day", &[]) });
rig.say(BOB, ChatDelivery { ..delivery(1, "@member:chat", "what a day", &[]) });
assert_eq!(rig.poll(), Outcome::Polled { launched: vec![Slug("bob".into())] }, "the poll reads the same room as hers");
}
}