From 84fbc0de301729ccf654cbc693a6132605a950f6 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 21 Nov 2026 19:04:00 +0100 Subject: [PATCH] Persona reads: a cap's refusal is temporary and never carried as refused Soul's R9 item 2. A read refused by a cap (reads a wake, bytes a wake, her prose's length) is no longer put on the Interpreter's "Refused earlier, so never named again" list, from the conversation or from this wake; only a rule's refusal is (not hers, malformed, not in front of her, already read). A capped read never ran, so it is not counted as read either, and the next wake makes it. Co-Authored-By: Claude Opus 5.5 --- crates/mind-body/src/projection/exchange.rs | 16 +++++++++------- .../mind-body/src/projection/exchange/tests.rs | 15 +++++++++++++++ crates/mind-body/src/projection/interpret.rs | 2 +- .../mind-body/src/projection/interpret/tests.rs | 12 ++++++++++++ 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/crates/mind-body/src/projection/exchange.rs b/crates/mind-body/src/projection/exchange.rs index 0f4aac3..a34a23b 100644 --- a/crates/mind-body/src/projection/exchange.rs +++ b/crates/mind-body/src/projection/exchange.rs @@ -16,7 +16,7 @@ use chrono::{DateTime, Utc}; use serde_json::Value; use super::domain::floor_minute; -use super::read::ReadRequest; +use super::read::{ReadRefusal, ReadRequest}; use super::select::{Forms, capitalized, coarse, spoken}; /// How long a pause ends a conversation (Q-G (a)): her turns in a room belong to one conversation while each is within @@ -39,14 +39,16 @@ pub(crate) struct Exchange { pub(crate) tried: Vec, /// When the conversation began: her first turn in it. What she closed since is still listed (Soul's R7). pub(crate) since: Option>, - /// Every read refused in it, as `kind target (why)`, once each: shown to the Interpreter so it never names the same - /// refused read again (Soul's R8). + /// Every read a rule refused in it, as `kind target (why)`, once each: shown to the Interpreter so it never names the + /// same refused read again (Soul's R8). A cap's refusal is not here: it is temporary (Soul's R9). pub(crate) refused: Vec, } -/// A refused read as the Interpreter is shown it: `kind target (why)`. -pub(crate) fn refused_read(refused: &Value) -> String { - format!("{} {} ({})", refused["read"]["kind"].as_str().unwrap_or("?"), refused["read"]["target"].as_str().unwrap_or("?").trim(), refused["why"].as_str().unwrap_or("?")) +/// A refused read as the Interpreter is shown it, `kind target (why)`; none for a cap's refusal (reads a wake, bytes a +/// wake, her prose's length), which lasts only the wake it happened in, so the read may be made next wake (Soul's R9). +pub(crate) fn refused_read(refused: &Value) -> Option { + let cap = serde_json::from_value::(refused["why"].clone()).is_ok_and(ReadRefusal::cap); + (!cap).then(|| format!("{} {} ({})", refused["read"]["kind"].as_str().unwrap_or("?"), refused["read"]["target"].as_str().unwrap_or("?").trim(), refused["why"].as_str().unwrap_or("?"))) } /// A read's latest result as her view shows it. @@ -104,7 +106,7 @@ pub(crate) fn exchange_of(records: &[Value], room: &str, now: DateTime, her .collect(); exchange.lines.push(Did { at: *at, text: format!("- {}{reply}: {}{}", coarse(*at, now), spoken(text), added.join("")) }); } - for refused in decision["read_refused"].as_array().into_iter().flatten().map(refused_read) { + for refused in decision["read_refused"].as_array().into_iter().flatten().filter_map(refused_read) { if !exchange.refused.contains(&refused) { exchange.refused.push(refused); } diff --git a/crates/mind-body/src/projection/exchange/tests.rs b/crates/mind-body/src/projection/exchange/tests.rs index 99e94ba..c9f5cc3 100644 --- a/crates/mind-body/src/projection/exchange/tests.rs +++ b/crates/mind-body/src/projection/exchange/tests.rs @@ -75,3 +75,18 @@ fn r8_the_conversation_carries_its_refused_reads() { let exchange = exchange_of(&[record.clone(), record], MINDS, now(), her()); assert_eq!(exchange.refused, ["repo GameCult/Bifrost?q=Merge pages and notices (search_words_not_in_her_thought)"]); } + +/// Soul's R9: a cap's refusal is temporary. A search found #85, the cap stopped the open, and the conversation neither +/// lists that refusal nor counts #85 as read, so the next wake opens it; a rule's refusal stays listed. +#[test] +fn r9_a_cap_refusal_is_not_carried_and_the_next_wake_may_read_it() { + let found = json!({ "ok": true, "request": { "kind": "repo", "target": "GameCult/Bifrost?q=passkeys" }, "what": "a search", "text": "- #85 Passkeys" }); + let mut record = turn(10, MINDS, &[], json!([found]), json!([]), json!([])); + record["interpreter"]["read_refused"] = json!([ + { "read": { "kind": "repo", "target": "GameCult/Bifrost#85" }, "why": "prose_words", "what": "GameCult/Bifrost#85 on the forge" }, + { "read": { "kind": "repo", "target": "GameCult/Bifrost#d3" }, "why": "malformed_target" }, + ]); + let exchange = exchange_of(&[record], MINDS, now(), her()); + assert_eq!(exchange.refused, ["repo GameCult/Bifrost#d3 (malformed_target)"]); + assert!(!exchange.tried.iter().any(|tried| tried.key == ReadRequest::Repo("GameCult/Bifrost#85".into()).normal()), "{:?}", exchange.tried); +} diff --git a/crates/mind-body/src/projection/interpret.rs b/crates/mind-body/src/projection/interpret.rs index b09ed6d..cbd885a 100644 --- a/crates/mind-body/src/projection/interpret.rs +++ b/crates/mind-body/src/projection/interpret.rs @@ -475,7 +475,7 @@ pub(crate) fn speech_prompt_in(packet: &Packet, narration: &str, prose: &str, tu // The reads refused earlier in this conversation and this wake, with why, so the same refused read is never named // again (Soul's R8). let mut refused: Vec = packet.refused_reads.clone(); - for read in wake_refused.iter().map(crate::projection::exchange::refused_read) { + for read in wake_refused.iter().filter_map(crate::projection::exchange::refused_read) { if !refused.contains(&read) { refused.push(read); } diff --git a/crates/mind-body/src/projection/interpret/tests.rs b/crates/mind-body/src/projection/interpret/tests.rs index c438ba0..eba342b 100644 --- a/crates/mind-body/src/projection/interpret/tests.rs +++ b/crates/mind-body/src/projection/interpret/tests.rs @@ -1031,3 +1031,15 @@ fn r8_anchors_need_two_title_words_and_a_generic_word_names_only_the_one_thing_t let sit = asked(&reading, "I want to sit with this a while.", json!({ "kind": "mind", "target": "want to sit", "quote": "I want to sit with this" })); assert_eq!(sit["read_refused"][0]["why"], "no_recall_words", "{sit}"); } + +/// Soul's R9: the next wake, the read a cap stopped is made: it is neither in view nor on the refused list. +#[test] +fn r9_the_read_a_cap_stopped_is_made_the_next_wake() { + let mut next = reading_packet(); + next.already_read = vec![crate::projection::exchange::Tried { key: ReadRequest::Repo("GameCult/Bifrost?q=passkeys".into()).normal(), found: true, what: "a search".into() }]; + let wake_refused = [json!({ "read": { "kind": "repo", "target": "GameCult/Bifrost#85" }, "why": "prose_words" })]; + let prose = "I'll open GameCult/Bifrost#85 and read the passkey change now."; + assert!(!speech_prompt_in(&next, "x", prose, &Tuning::default(), "", &drafts(prose), &wake_refused).contains("Refused earlier")); + let read = asked(&next, prose, json!({ "kind": "repo", "target": "GameCult/Bifrost#85", "quote": "I'll open GameCult/Bifrost#85 and read" })); + assert_eq!(read["read"]["request"], json!({ "kind": "repo", "target": "GameCult/Bifrost#85" }), "{read}"); +}