diff --git a/crates/mind-body/src/projection/outcome.rs b/crates/mind-body/src/projection/outcome.rs index 03fd0a2..b93cbd9 100644 --- a/crates/mind-body/src/projection/outcome.rs +++ b/crates/mind-body/src/projection/outcome.rs @@ -234,6 +234,12 @@ enum Part { /// A note not left: private, or a second one. NoteRefused(Refusal), Failed, + /// Her state after the turn was put and refused twice: what she meant to keep from that turn was not kept (the drain's + /// `put_refused`). + NotKept, + /// A waking line whose turn failed twice, acked past with no third try (the drain's `set_aside`): it is told by the room + /// it was in, and nothing reached it. + SetAside { room: Option }, /// Receipts went out, and a later step of the turn broke (C3c's `broke_after`, 16.20.7). BrokeAfter { room: Option }, /// A read she performed (map 16.22.3): what, in code's words; never its content, which is in her view while the @@ -295,6 +301,16 @@ pub(crate) fn outcome_of(record: &Value) -> Option { outcome.parts.push(Part::Failed); return Some(outcome); } + // A record the drain wrote when it set lines aside carries no decision: it says only which rooms' lines it left. + for set_aside in record["set_aside"].as_array().into_iter().flatten() { + outcome.parts.push(Part::SetAside { room: words(&set_aside["room"]) }); + } + if record.get("set_aside").is_some() { + return Some(outcome); + } + if record.get("put_refused").is_some() { + outcome.parts.push(Part::NotKept); + } let room = words(&decision["room"]); // A draft refused as an echo is shown by no row: the echo's line quotes none of it, and a gap naming it quotes nothing. let echoes: Vec<&Value> = decision["refused"].as_array().into_iter().flatten().filter(|refusal| refusal["reason"] == "echo").map(|refusal| &refusal["draft"]).collect(); @@ -546,6 +562,7 @@ impl Part { fn rank(&self) -> u8 { match self { Self::Failed => 0, + Self::SetAside { .. } | Self::NotKept => 1, Self::Refused { .. } | Self::Gap { .. } | Self::Unfinished { .. } | Self::Unsent { .. } | Self::NotAmended { .. } | Self::NoteRefused(_) | Self::ReadFailed { .. } | Self::ReadRefused { .. } => 1, Self::SaidUnbacked { .. } | Self::Amended { unbacked: true, .. } => 2, Self::Said { .. } | Self::Amended { .. } | Self::NoteLeft(_) | Self::Read { .. } => 3, @@ -589,6 +606,8 @@ impl Part { Self::NoteRefused(Refusal::SecondNote) => "No second note was left:".to_owned(), Self::NoteRefused(_) => "No note was left:".to_owned(), Self::Failed => format!("Nothing reached the room, and nothing {subj} meant last time happened:"), + Self::NotKept => format!("What {subj} meant to keep from that turn was not kept."), + Self::SetAside { room } => format!("Nothing reached {}.", place(room)), Self::BrokeAfter { room } => format!("Nothing more reached {}:", place(room)), Self::Read { what } => format!("{cap_subj} read {}.", form.read(what, her)), Self::ReadFailed { what, .. } => format!("{cap_subj} reached for {} and could not read it:", form.read(what, her)), @@ -652,6 +671,8 @@ impl Part { Self::NoteRefused(Refusal::SecondNote) => " one a turn.".to_owned(), Self::NoteRefused(_) => format!(" it carried something {subj} may not pass on."), Self::Failed => format!(" the turn broke off, not by {poss} choice."), + Self::NotKept => String::new(), + Self::SetAside { .. } => format!(" {} turn on a line there failed twice, so the line was set aside, and it will not be tried again.", capitalized(poss)), Self::BrokeAfter { .. } => format!(" the rest of that turn broke off, not by {poss} choice."), Self::Read { .. } => String::new(), Self::ReadFailed { failure, .. } => format!(" {}.", failure.words()), diff --git a/crates/mind-body/src/projection/outcome/tests.rs b/crates/mind-body/src/projection/outcome/tests.rs index ad8e776..69ff779 100644 --- a/crates/mind-body/src/projection/outcome/tests.rs +++ b/crates/mind-body/src/projection/outcome/tests.rs @@ -419,6 +419,8 @@ fn variant(part: &Part) -> &'static str { Part::NoteLeft(_) => "note_left", Part::NoteRefused(_) => "note_refused", Part::Failed => "failed", + Part::NotKept => "not_kept", + Part::SetAside { .. } => "set_aside", Part::BrokeAfter { .. } => "broke_after", Part::Read { .. } => "read", Part::ReadFailed { .. } => "read_failed", @@ -426,7 +428,7 @@ fn variant(part: &Part) -> &'static str { } } -const VARIANTS: usize = 15; +const VARIANTS: usize = 17; /// Every row kind, and every arm that renders a different sentence, with `s` in every text of a record it carries and in /// every read's target; and whether her told form shows those words (an echo, a held @@ -463,6 +465,8 @@ fn fixtures(s: &str) -> Vec<(Part, bool)> { out.push((Part::NoteRefused(Refusal::Private), false)); out.push((Part::NoteRefused(Refusal::SecondNote), false)); out.push((Part::Failed, false)); + out.push((Part::NotKept, false)); + out.push((Part::SetAside { room: room() }, false)); out.push((Part::BrokeAfter { room: room() }, false)); for (request, shows) in [ (ReadRequest::Web(format!("https://example.org/{s}")), true), @@ -644,3 +648,12 @@ fn t6_a_refused_send_is_told_as_not_gone_out() { let (lines, omitted) = told(&elsewhere); assert!(lines.is_empty() && omitted[0].contains("no receipt"), "{lines:?} {omitted:?}"); } + +#[test] +fn a_put_refused_twice_and_a_set_aside_line_are_told_plainly() { + let mut refused = record("Hi Nibu.", json!({ "say": [{ "draft": 1 }], "gaps": [] }), &["Hi Nibu."]); + refused["put_refused"] = json!("stale again"); + assert_eq!(told(&refused).0, ["- What he meant to keep from that turn was not kept.", "- #minds:gamecult.org has, from him: \"Hi Nibu.\"."], "the refusal's words are the mind's, not hers: she is told only that it was not kept"); + let aside = json!({ "set_aside": [{ "room": MINDS, "event": "$e1" }], "at": "2026-11-27T10:00:00Z" }); + assert_eq!(told(&aside).0, ["- Nothing reached #minds:gamecult.org. His turn on a line there failed twice, so the line was set aside, and it will not be tried again."]); +}