playtest atlas: group people by commitments too, read no lens for Begin's seed

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-03 05:25:26 +01:00
commit 5686b25816

View file

@ -616,14 +616,30 @@ impl World {
}
/// The group a person belongs to: the institution whose office they hold,
/// else an institution or population they depend on.
/// else an institution or population they depend on, else one they share a
/// commitment with.
fn home_group(&self, person: &Subject) -> Option<String> {
if let Some(office) = person.offices_held.first() {
return Some(office.institution.clone());
}
person.depends.split(", ").filter_map(|part| part.strip_prefix("subject ")).find(|label| {
self.subject(label).is_some_and(|subject| subject.kind == "institution" || subject.kind == "population")
}).map(str::to_owned)
let is_group = |kind: &str| kind == "institution" || kind == "population";
let depended = person
.depends
.split(", ")
.filter_map(|part| part.strip_prefix("subject "))
.find(|label| self.subject(label).is_some_and(|subject| is_group(&subject.kind)))
.map(str::to_owned);
depended.or_else(|| {
self.commitments.iter().find_map(|commitment| {
if commitment.holder_id == person.id {
commitment.with.as_deref().filter(|with| self.subject(with).is_some_and(|subject| is_group(&subject.kind))).map(str::to_owned)
} else if commitment.with.as_deref() == Some(person.label.as_str()) {
self.subjects.iter().find(|subject| subject.id == commitment.holder_id && is_group(&subject.kind)).map(|subject| subject.label.clone())
} else {
None
}
})
})
}
}
@ -688,7 +704,8 @@ impl Watch<'_> {
async fn poll(&mut self, sweep: usize) -> Option<World> {
let snapshot = self.host.world.snapshot().await.ok()?;
let world = parse_world(&table_view(&snapshot));
let lenses = self.activity.recent();
// Begin's seed and its run-ahead are not a sweep of this run; no lens is read for them.
let lenses = if sweep == 0 { Vec::new() } else { self.activity.recent() };
for (key, (section, label)) in world.keyed() {
self.seen.entry(key).or_insert_with(|| Seen { sweep, lenses: lenses.clone(), section, label });
}
@ -1024,7 +1041,7 @@ per-patch evidence references are not readable outside the kernel, so an entry n
for sweep in sweeps {
let mut by_lens: BTreeMap<String, BTreeMap<&str, Vec<&str>>> = BTreeMap::new();
for entry in seen.values().filter(|entry| entry.sweep == sweep) {
by_lens.entry(lens_names(&entry.lenses)).or_default().entry(entry.section).or_default().push(&entry.label);
by_lens.entry(if sweep == 0 { "Begin's seed".to_owned() } else { lens_names(&entry.lenses) }).or_default().entry(entry.section).or_default().push(&entry.label);
}
out.push_str(&format!("### Sweep {sweep}{}\n\n", if sweep == 0 { " (Begin's seed and run-ahead)" } else { "" }));
for (lens, sections) in by_lens {
@ -1107,7 +1124,7 @@ per-patch evidence references are not readable outside the kernel, so an entry n
}
// People, by group then place.
out.push_str("## People\n\nGrouped by home group (the institution whose office a person holds, else the institution or population they depend on), then by the place they stand in.\n\n");
out.push_str("## People\n\nGrouped by home group (the institution whose office a person holds, else the institution or population they depend on or share a commitment with), then by the place they stand in.\n\n");
let mut groups: BTreeMap<String, BTreeMap<String, Vec<&Subject>>> = BTreeMap::new();
for person in world.people() {
let group = world.home_group(person).unwrap_or_else(|| "No group recorded".to_owned());