Persona K60: the test shim states clear_of without inserting an absent amend list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-22 17:03:53 +01:00
commit 1a76451219

View file

@ -69,7 +69,7 @@ pub(crate) fn judged(mut answer: Value, packet: &Packet) -> Value {
}
let handles: Vec<String> = packet.holds.iter().map(|hold| hold.id.clone()).chain(opened).collect();
for key in ["say", "amend"] {
for line in answer[key].as_array_mut().into_iter().flatten().filter(|line| line.get("clear_of").is_none()) {
for line in answer.get_mut(key).and_then(Value::as_array_mut).into_iter().flatten().filter(|line| line.get("clear_of").is_none()) {
let named: Vec<String> = line["holds"].as_array().into_iter().flatten().filter_map(Value::as_str).map(str::to_owned).collect();
line["clear_of"] = json!(handles.iter().filter(|handle| !named.contains(handle)).collect::<Vec<_>>());
}