Persona K45: the carry pass reads holds without writing a null; tests follow the words gate and the broken-hold row

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-22 08:04:50 +01:00
commit 62ddcfcf6d
3 changed files with 10 additions and 4 deletions

View file

@ -437,7 +437,7 @@ fn carry_held(state: &mut Value, record: &Value, applied: &mut Applied) {
};
let listed = decision["holds"].as_array().into_iter().flatten().find(|listed| listed["id"].as_str() == Some(handle)).map(|listed| listed["entry"].clone());
let line = decision["lines"].as_array().into_iter().flatten().find(|line| line["id"].as_str() == Some(handle)).map(|line| line["event"].clone());
let hold = state["holds"].as_array_mut().into_iter().flatten().find(|hold| {
let hold = state.get_mut("holds").and_then(Value::as_array_mut).into_iter().flatten().find(|hold| {
hold["status"] == "open" && (listed.as_ref().is_some_and(|entry| hold["id"] == *entry) || line.as_ref().is_some_and(|event| hold["event"] == *event))
});
let Some(hold) = hold else {

View file

@ -1763,7 +1763,7 @@ fn k39_held_for_quotes_no_askers_words() {
packet.holds = vec![listed];
let decision = answered(&packet, X1_LIBBY_R1, json!({ "say": [say_holding(1, json!(["h1"])), say_holding(2, json!([]))], "gaps": [] }));
let refused = &decision["refused"][0];
assert_eq!((refused["reason"].as_str(), refused["hold"].clone()), (Some("held"), json!({ "who": "Meta" })), "{decision}");
assert_eq!((refused["reason"].as_str(), refused["hold"].clone()), (Some("held"), json!({ "who": "Meta", "id": "h1" })), "{decision}");
let posted: Vec<Value> = decision["said"].as_array().unwrap().iter().map(|line| json!({ "event": "9", "room": line["room"], "text": line["text"] })).collect();
let told = crate::projection::outcome::outcome_of(&json!({ "interpreter": decision, "posted": posted, "edited": [] })).unwrap().lines(packet.forms);
let held = told.iter().find(|line| line.contains("asked him to hold it")).unwrap_or_else(|| panic!("{told:?}"));
@ -1780,7 +1780,8 @@ fn k39_unquoted_hold_is_retried() {
assert_eq!((decision["retried"]["failed"].as_str(), decision["retried"]["holds"].clone()), (Some("the answer names holds it did not open"), json!(["q3"])), "{decision}");
let prompts = speech_prompts(&model);
assert!(prompts.len() == 2 && prompts[1].contains("named holds it did not open from a listed line's own words: q3."), "{prompts:?}");
assert_eq!((texts(&decision), decision["refused"][0]["reason"].as_str()), (vec!["Meta, the draft is ready, and I'm holding it".to_owned()], Some("held")), "{decision}");
// K45: draft 2 repeats draft 1, so it is held by its words.
assert_eq!((texts(&decision), decision["refused"][0]["reason"].as_str()), (Vec::<String>::new(), Some("held")), "{decision}");
let (state, applied) = committed(&decision, X1_LIBBY_R1);
assert_eq!((applied.held.len(), state["holds"][0]["words"].as_str()), (1, Some("hold it, don't post it in here yet")), "{applied:?}");
// Her next turn's packet lists it.

View file

@ -442,7 +442,12 @@ fn k49_every_row_with_words_is_settled_by_its_room() {
let here = at(MINDS);
let not_reached = |outcome: &Outcome| outcome.lines(packet().forms).into_iter().filter(|line| line.starts_with("- Nothing")).count();
assert_eq!(not_reached(&here), 0, "{row}: {:?}", here.lines(packet().forms));
assert!(here.omitted.iter().any(|why| why == &format!("a {row} of words a receipt shows reached {MINDS}: {SENTINEL}")), "{row}: {:?}", here.omitted);
if row == "held draft" {
// K45: a held draft that reached its room is a broken hold, told and reported, never omitted.
assert_eq!(here.hold_broken, [format!("{MINDS}: {SENTINEL}")], "{row}: {:?}", here.omitted);
} else {
assert!(here.omitted.iter().any(|why| why == &format!("a {row} of words a receipt shows reached {MINDS}: {SENTINEL}")), "{row}: {:?}", here.omitted);
}
let elsewhere = at(SWARM);
assert_eq!(not_reached(&elsewhere), 1, "{row}: {:?}", elsewhere.lines(packet().forms));
assert!(!elsewhere.omitted.iter().any(|why| why.contains("a receipt shows reached")), "{row}: {:?}", elsewhere.omitted);