B6 fix-up: the tests that change an entry before the turn list it as the turn began

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-20 23:00:25 +01:00
commit 6f8da8adea

View file

@ -53,6 +53,13 @@ fn shown(status: &str) -> Value {
json!([{ "id": "c1", "entry": "c-r1-t1-1", "status": status, "to": META, "to_name": "Meta", "place": "in #minds:gamecult.org", "made": "just now", "words": "send the render tonight", "held": holding(status)["commitments"][0] }])
}
/// The Interpreter's list of the one entry `state` holds as the turn began: what a packet built from it shows.
fn listing(state: &Value) -> Value {
let mut listed = shown(state["commitments"][0]["status"].as_str().unwrap());
listed[0]["held"] = state["commitments"][0].clone();
listed
}
fn reasons(applied: &Applied) -> Vec<Value> {
applied.refused.iter().map(|refused| refused["reason"].clone()).collect()
}
@ -105,7 +112,7 @@ fn a_release_counts_only_from_the_person_promised_after_the_promise() {
// A promise to the room is released by anyone in it.
let mut to_room = holding("open");
to_room["commitments"][0]["to"] = Value::Null;
let (state, _) = apply(&to_room, &record(json!([close(How::Released, Evidence::Heard("q2".into()))]), shown("open"), true), PROSE, "r1-t2", now());
let (state, _) = apply(&to_room, &record(json!([close(How::Released, Evidence::Heard("q2".into()))]), listing(&to_room), true), PROSE, "r1-t2", now());
assert_eq!(state["commitments"][0]["status"], "released");
}
@ -194,7 +201,7 @@ fn b5_a_close_counts_only_where_the_person_promised_can_read_it() {
// A promise to the room closes only in its room.
let mut to_room = holding("open");
to_room["commitments"][0]["to"] = Value::Null;
let mut rec = record(json!([close(How::Withdrawn, Evidence::Draft(1))]), shown("open"), true);
let mut rec = record(json!([close(How::Withdrawn, Evidence::Draft(1))]), listing(&to_room), true);
rec["interpreter"]["said"][0]["room"] = json!("#general:gamecult.org");
rec["posted"][0]["room"] = json!("#general:gamecult.org");
assert_eq!(reasons(&apply(&to_room, &rec, PROSE, "r1-t2", now()).1), vec![json!("not_where_promised")]);