From 8c4bffdbbaf7d74fcb745254763fcbc17892c3a4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 3 Dec 2026 00:21:31 +0100 Subject: [PATCH] Begin spawn test reads the player's place through WorldSnapshot::standing_place Co-Authored-By: Claude Sonnet 5.5 --- crates/ghostlight-dungeon/src/begin.rs | 6 ++---- crates/ghostlight/src/lib.rs | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/ghostlight-dungeon/src/begin.rs b/crates/ghostlight-dungeon/src/begin.rs index e3543d9..35eb7a9 100644 --- a/crates/ghostlight-dungeon/src/begin.rs +++ b/crates/ghostlight-dungeon/src/begin.rs @@ -849,12 +849,10 @@ pub(crate) mod tests { (world.phase == WorldPhase::Active && rig.status(&begun.timeline).await.is_none()).then_some(world) }) .await; - let hall = world.places.iter().find(|place| place.label == "Hall").unwrap().id; let player = world.subjects.iter().find(|subject| subject.label == "Deru").unwrap(); - assert_eq!(player.position, Some(hall), "the player stands in the hall"); - let others = world.subjects.iter().filter(|s| s.id != player.id && s.position == Some(hall)).count(); + assert_eq!(world.standing_place(player.id), Some("Hall"), "the player stands in the hall"); + let others = world.subjects.iter().filter(|s| s.id != player.id && world.standing_place(s.id) == Some("Hall")).count(); assert_eq!(others, 2, "with the two people placed there"); - assert!(world.routes.iter().all(|route| !route.open), "no open way back to the empty commons"); } /// Spec test: a seed fault reads Failed with a category and no endpoint diff --git a/crates/ghostlight/src/lib.rs b/crates/ghostlight/src/lib.rs index 2af17b6..50d2763 100644 --- a/crates/ghostlight/src/lib.rs +++ b/crates/ghostlight/src/lib.rs @@ -1296,6 +1296,13 @@ pub struct WorldSnapshot { } impl WorldSnapshot { + /// The label of the place a subject stands in, for the owner's own + /// surfaces and tests; no subject-facing lane reads this. + pub fn standing_place(&self, subject: SubjectId) -> Option<&str> { + let position = self.subjects.iter().find(|candidate| candidate.id == subject)?.position?; + self.places.iter().find(|place| place.id == position).map(|place| place.label.as_str()) + } + /// What every lane reads as the world's guidance: the era line, then the /// owner's brief verbatim, either omitted when empty. Derived on every /// read; no prompt reads `brief` directly.