diff --git a/crates/mind-body/src/projection/interpret/tests.rs b/crates/mind-body/src/projection/interpret/tests.rs index b0a357d..3efc458 100644 --- a/crates/mind-body/src/projection/interpret/tests.rs +++ b/crates/mind-body/src/projection/interpret/tests.rs @@ -485,6 +485,10 @@ fn a_note_needs_no_room_and_speech_does() { let decision = noted(&roomless, json!([{ "draft": 2 }]), json!([{ "kind": "idea", "draft": 1, "about": null, "private": false }])); assert_eq!((decision["suggestions"][0]["text"].as_str(), decision["suggestions"][0]["room"].clone()), (Some(NOTE), Value::Null), "{decision}"); assert_eq!(refusals(&decision), [("say".to_owned(), "no_room".to_owned())]); + // He is told the line he meant to say had nowhere to go (Soul at 0cfc386: it was omitted). + let outcome = crate::projection::outcome::outcome_of(&json!({ "interpreter": decision, "posted": [] })).unwrap(); + assert!(outcome.lines(packet().forms).contains(&"- Nothing reached anyone. That turn had no room for him to speak in, so it was not sent: \"Another thought.\".".to_owned()), "{:?}", outcome.lines(packet().forms)); + assert!(outcome.omitted.is_empty(), "{:?}", outcome.omitted); } #[test] diff --git a/crates/mind-body/src/projection/outcome.rs b/crates/mind-body/src/projection/outcome.rs index d6b6ab9..fcee18e 100644 --- a/crates/mind-body/src/projection/outcome.rs +++ b/crates/mind-body/src/projection/outcome.rs @@ -136,7 +136,7 @@ pub(crate) fn outcome_of(record: &Value) -> Option { } for refusal in decision["refused"].as_array().into_iter().flatten() { match (serde_json::from_value::(refusal["reason"].clone()), words(&refusal["text"])) { - (Ok(reason @ (Refusal::Echo | Refusal::OverLines)), Some(text)) => outcome.parts.push(Part::Refused { reason, room: room.clone(), text }), + (Ok(reason @ (Refusal::Echo | Refusal::OverLines | Refusal::NoRoom)), Some(text)) => outcome.parts.push(Part::Refused { reason, room: room.clone(), text }), (Ok(Refusal::NotAmendable), Some(added)) => outcome.parts.push(Part::NotAmended { refusal: None, room: room.clone(), added }), (Ok(reason @ (Refusal::Private | Refusal::SecondNote)), Some(_)) => outcome.parts.push(Part::NoteRefused(reason)), _ => outcome.omitted.push(format!("a refusal she is not told ({}): {}", refusal["reason"], refusal["why"])), @@ -239,6 +239,7 @@ impl Part { Self::Amended { room, added } => format!("{} has {poss} line, now ending with: {}.", capitalized(room), quoted(added)), Self::NoteLeft(text) => format!("{cap_subj} left Self a note: {}.", quoted(text)), Self::Refused { reason: Refusal::Echo, room, .. } | Self::Gap { kind: GapKind::Conditional | GapKind::Unwritten | GapKind::Unresolved, room, .. } => format!("Nothing reached {}.", place(room)), + Self::Refused { reason: Refusal::NoRoom, .. } => "Nothing reached anyone.".to_owned(), Self::Refused { room, .. } | Self::Unfinished { room, .. } => format!("Nothing of this reached {}:", place(room)), Self::Gap { kind: GapKind::Addressee | GapKind::Elsewhere, .. } => "Nothing reached anyone.".to_owned(), Self::Gap { kind: GapKind::MissingAffordance, .. } => "Nothing happened.".to_owned(), @@ -271,6 +272,7 @@ impl Part { Self::Promise { .. } => format!(" It promises something {subj} {has} no way to do, now or later, and it will not happen by itself. The line stands as {subj} wrote it; {subj} can add to it."), Self::NoteLeft(_) => format!(" It waits in Self's inbox until Self reads it; nothing tells {obj} when, and nothing in it happens by itself."), Self::Refused { reason: Refusal::Echo, .. } => format!(" What {subj} wrote was mostly the words {subj} had just been sent, so none of it was sent."), + Self::Refused { reason: Refusal::NoRoom, text, .. } => format!(" That turn had no room for {obj} to speak in, so it was not sent: {}.", quoted(text)), Self::Refused { text, .. } => format!(" {subj} had already sent {} that turn. {}", lines_word(), shown(&Quote::Wrote(text.clone()))), Self::Gap { kind: GapKind::Conditional, quote, .. } => after(format!("{cap_subj} wrote this and did not send it, and it is not sent unless {subj} send{s} it"), quote), Self::Gap { kind: GapKind::Addressee, quote, .. } => after(format!("{cap_subj} meant to send this and it was unclear to whom"), quote),