diff --git a/crates/mind-body/src/persona.rs b/crates/mind-body/src/persona.rs index aa76d88..f0741c4 100644 --- a/crates/mind-body/src/persona.rs +++ b/crates/mind-body/src/persona.rs @@ -605,7 +605,7 @@ fn holds(state: &Value, diff: &Value) -> bool { /// refuses or cannot take leaves it `landed`, and the next wake posts it again under the same id (`owed_identity`). fn post_identity(start: &Start, instance: &Slug, mut record: Value) { let key = record["key"].as_str().unwrap_or_default().to_owned(); - let mut mark = |record: &mut Value, status: &str| { + let mark = |record: &mut Value, status: &str| { record["status"] = json!(status); if let Err(fault) = start.trace.record(&key, &*record) { eprintln!("mind-persona: the identity record {key} was not updated to {status}: {fault:#}"); diff --git a/crates/mind-body/src/persona/drain_tests.rs b/crates/mind-body/src/persona/drain_tests.rs index c2f15f1..b45ac92 100644 --- a/crates/mind-body/src/persona/drain_tests.rs +++ b/crates/mind-body/src/persona/drain_tests.rs @@ -602,11 +602,11 @@ fn t_p2_identity_post_is_retried_next_wake() { /// A crash between the write-ahead and the put's outcome: the next wake posts what her state holds and voids what it does not. #[test] fn t_p2_a_pending_identity_record_is_settled_by_her_state() { - let diff = |after: &str| json!({ "kind": "identity_diff", "key": format!("n0-d-{after}"), "seq": 9, "status": "pending", "request_id": format!("identity-{}", after.len()), "room": "#review:gamecult.org", "text": "changed", "diffs": [{ "field": "publicName", "before": "Tobiah Fenn", "after": after }], "event": null }); + let diff = |key: &str, after: &str| json!({ "kind": "identity_diff", "key": key, "seq": 9, "status": "pending", "request_id": format!("identity-{key}"), "room": "#review:gamecult.org", "text": "changed", "diffs": [{ "field": "publicName", "before": "Tobiah Fenn", "after": after }], "event": null }); let rig = three_rooms(); *rig.review.borrow_mut() = Some("#review:gamecult.org".into()); - rig.trace.record("n0-d-a", &diff("Tobiah Fenn")).unwrap(); - rig.trace.record("n0-d-b", &diff("Never Put")).unwrap(); + rig.trace.record("n0-d-a", &diff("n0-d-a", "Tobiah Fenn")).unwrap(); + rig.trace.record("n0-d-b", &diff("n0-d-b", "Never Put")).unwrap(); rig.run(Tally::default()); let records = rig.all_records(); let status = |key: &str| rig.trace.rows.borrow().iter().find(|(held, _)| held == key).unwrap().1["status"].clone();