persona: the pending-identity test keys its records as the drain does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-01 00:05:47 +01:00
commit c2fc1b8393
2 changed files with 4 additions and 4 deletions

View file

@ -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<C: Chat>(start: &Start<C>, 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:#}");

View file

@ -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();