From b423a334fcf1ccad3eee4103c0e1e6d5c5c84d73 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 3 Dec 2026 11:22:14 +0100 Subject: [PATCH] elaboration focus: one owner of a subject's place; pin it and standing_place Co-Authored-By: Claude Opus 5.5 --- crates/ghostlight/src/controllers.rs | 23 +++++++++++++++++++++++ crates/ghostlight/src/elaboration.rs | 16 ++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/crates/ghostlight/src/controllers.rs b/crates/ghostlight/src/controllers.rs index 9759cda..32149c7 100644 --- a/crates/ghostlight/src/controllers.rs +++ b/crates/ghostlight/src/controllers.rs @@ -14954,6 +14954,29 @@ assert!(projector_text.contains("I ask about the hinge."), "the player's own tur task.await.unwrap(); } + /// A subject's place is the position it stands in, by its own id: the one + /// owner the claim order, the jurisdiction cover and the Dungeon's focus + /// read. + #[tokio::test] + async fn a_subjects_place_is_where_it_stands() { + let (_directory, mailbox, task, commons, _roads) = dead_end_world( + crate::tests::stock_weights(), + &["The Unwalked Road"], + Roots::None, + 0, + ) + .await; + let snapshot = mailbox.snapshot().await.unwrap(); + let subject = snapshot.subjects.first().expect("the fixture's subject").id; + assert_eq!(snapshot.place_of(subject), Some(commons)); + assert_eq!(snapshot.standing_place(subject), Some("The Commons")); + let stranger = SubjectId::issue(); + assert_eq!(snapshot.place_of(stranger), None); + assert_eq!(snapshot.standing_place(stranger), None); + drop(mailbox); + task.await.unwrap(); + } + /// With one session allowed, the sweep spends it on the dead end the focus /// names, not the first the kernel lists. #[tokio::test] diff --git a/crates/ghostlight/src/elaboration.rs b/crates/ghostlight/src/elaboration.rs index 222f84c..796d1d4 100644 --- a/crates/ghostlight/src/elaboration.rs +++ b/crates/ghostlight/src/elaboration.rs @@ -1020,13 +1020,7 @@ pub(super) fn claim_order(snapshot: &WorldSnapshot, focus: &Focus) -> Vec Option { - let subject_place = |subject: SubjectId| { - snapshot - .subjects - .iter() - .find(|row| row.id == subject) - .and_then(|row| row.position) - }; + let subject_place = |subject: SubjectId| snapshot.place_of(subject); match answer { PatchAnswer::Deficit(JurisdictionKey::PlaceSubtree(root)) => Some(*root), PatchAnswer::Deficit(JurisdictionKey::Uncovered) => None, @@ -1147,13 +1141,7 @@ fn boundary_in( jurisdiction: JurisdictionKey, boundary: &CausalBoundary, ) -> bool { - let subject_place = |subject: SubjectId| { - snapshot - .subjects - .iter() - .find(|row| row.id == subject) - .and_then(|row| row.position) - }; + let subject_place = |subject: SubjectId| snapshot.place_of(subject); match jurisdiction { JurisdictionKey::Uncovered => match boundary { CausalBoundary::UnelaboratedDestination { .. } => false,