persona drain: one unmark for a send not handed over

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-28 05:51:00 +01:00
commit 4818cb2054

View file

@ -153,6 +153,13 @@ pub(crate) fn decide(organs: &Organs, request: &Request, key: &str, now: DateTim
Taken { report, record, state }
}
/// The send is not handed over: the mark is removed.
fn unmark(send: &mut Value) {
if let Some(fields) = send.as_object_mut() {
fields.remove("handed");
}
}
/// Settles what `record` owes through `actuator`: each owed send is posted, refused (a refusal is an answer) or, when no answer
/// came, still owed. The only receipt is the mouth's answer to a send, an event id; her lines in the room's tail are never one. The
/// amendments follow once nothing is owed. A record that owes nothing is the shape the simulator and the mouth share.
@ -202,9 +209,7 @@ pub(crate) fn deliver(actuator: &dyn Actuator, record: &mut Value, pass: Pass, s
send["handed"] = json!(true);
record["owed"] = json!(still.iter().chain(std::iter::once(&send)).chain(&owed[index + 1..]).collect::<Vec<_>>());
if !ahead(record) {
if let Some(fields) = send.as_object_mut() {
fields.remove("handed");
}
unmark(&mut send);
stalled.insert(room.clone());
still.push(send);
continue;
@ -220,9 +225,7 @@ pub(crate) fn deliver(actuator: &dyn Actuator, record: &mut Value, pass: Pass, s
Sent::NotSent => {
stalled.insert(room.clone());
if !handed {
if let Some(fields) = send.as_object_mut() {
fields.remove("handed");
}
unmark(&mut send);
}
still.push(send);
}