diff --git a/crates/mind-body/src/projection/interpret.rs b/crates/mind-body/src/projection/interpret.rs index 181261e..4844e97 100644 --- a/crates/mind-body/src/projection/interpret.rs +++ b/crates/mind-body/src/projection/interpret.rs @@ -492,8 +492,8 @@ pub(crate) fn decide(model: &dyn Model, request_id: &str, packet: &Packet, narra (reason, _) => refusals.push(refused(Act::Amend, Some(draft), None, reason.unwrap_or(Refusal::NotAmendable))), } } - // A note to Self (map 16.18): one whole draft, at most one a turn, refused when the Interpreter judges it carries - // something private. It is recorded in the turn's record and nowhere else; nothing here writes her Mind. + // A note to Self (map 16.18): one whole draft, at most one a turn, refused as an echo as a line is, and when the + // Interpreter judges it carries something private. It is recorded in the turn's record and nowhere else; nothing here writes her Mind. let mut suggestions: Vec = Vec::new(); for proposed in parsed.suggest { let Some(draft) = proposed.draft.and_then(|n| found.numbered(n)) else { @@ -502,6 +502,8 @@ pub(crate) fn decide(model: &dyn Model, request_id: &str, packet: &Packet, narra }; let reason = if used.contains(&draft.n) { Some(Refusal::Used) + } else if echo(&draft.text, &packet.bodies) { + Some(Refusal::Echo) } else if !suggestions.is_empty() { Some(Refusal::SecondNote) } else if proposed.private != Some(false) { diff --git a/crates/mind-body/src/projection/interpret/tests.rs b/crates/mind-body/src/projection/interpret/tests.rs index d9fed07..b0a357d 100644 --- a/crates/mind-body/src/projection/interpret/tests.rs +++ b/crates/mind-body/src/projection/interpret/tests.rs @@ -594,9 +594,21 @@ fn k18_a_refused_act_does_not_use_up_its_draft_and_is_told() { assert_eq!((refusals(&decision), decision["suggestions"][0]["text"].as_str()), (vec![("amend".to_owned(), "not_amendable".to_owned())], Some("Couldn't send it after all.")), "{decision}"); let told = crate::projection::outcome::outcome_of(&json!({ "interpreter": decision, "posted": [] })).unwrap().lines(packet().forms); assert!(told.iter().any(|line| line.starts_with("- Nothing changed, and nothing reached #minds:gamecult.org:")) && told.iter().any(|line| line.starts_with("- He left Self a note:")), "{told:?}"); - // An echo-refused line leaves its draft free for a note too. - let echoed = answered(&packet(), "The economy is still the least-built part!", json!({ "say": [{ "draft": 1 }], "gaps": [], "suggest": [{ "kind": "feedback", "draft": 1, "about": NIBU, "private": false }] })); - assert_eq!((refusals(&echoed), echoed["suggestions"].as_array().unwrap().len()), (vec![("say".to_owned(), "echo".to_owned())], 1), "{echoed}"); +} + +/// Soul's probe at 0cfc386: a draft refused as an echo was then left as her idea note. A note runs the echo check as a +/// line and an addition do, whatever its kind. +#[test] +fn an_echo_is_no_note_either() { + let echo = "v0.2.0 is tagged and the economy is still the least built part. I think this looks okay to ship."; + for kind in ["idea", "feedback"] { + let about = if kind == "feedback" { json!(NIBU) } else { Value::Null }; + let decision = answered(&packet(), &format!("{echo}"), json!({ "say": [{ "draft": 1 }], "gaps": [], "suggest": [{ "kind": kind, "draft": 1, "about": about, "private": false }] })); + assert_eq!((refusals(&decision), decision["suggestions"].as_array().unwrap().len()), (vec![("say".to_owned(), "echo".to_owned()), ("suggest".to_owned(), "echo".to_owned())], 0), "{kind}: {decision}"); + } + // A note of her own words is still left. + let own = answered(&packet(), "The economy wants a pass before we ship.", json!({ "say": [], "gaps": [], "suggest": [{ "kind": "idea", "draft": 1, "about": null, "private": false }] })); + assert_eq!(own["suggestions"].as_array().unwrap().len(), 1, "{own}"); } #[test]