From 33b42226f5a96f0cf4a85f08f587a5bd35340c9d Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 19 Nov 2026 23:43:49 +0100 Subject: [PATCH] Projector guard: "short-term" is ordinary English, its one kebab exemption; shortTerm and short_term are still caught Co-Authored-By: Claude Opus 5.5 --- crates/mind-body/src/projection/narrate.rs | 6 +++++- crates/mind-body/src/projection/tests.rs | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/mind-body/src/projection/narrate.rs b/crates/mind-body/src/projection/narrate.rs index 11104a4..502f2da 100644 --- a/crates/mind-body/src/projection/narrate.rs +++ b/crates/mind-body/src/projection/narrate.rs @@ -116,6 +116,10 @@ pub(crate) fn words(text: &str) -> usize { text.split_whitespace().count() } +/// The one kebab form that is ordinary English: "short-term" folds to the schema key `shortTerm`, and prose must not fail +/// the judge for it. `shortTerm`, `short_term` and the run-together `shortterm` are still caught. +const KEBAB_ENGLISH: &str = "short-term"; + /// Her persona state's schema: its property names are the identifiers a narration must never carry. const PERSONA_SCHEMA: &str = include_str!("../../../../schemas/cultnet/gamecult.persona_state.v0.schema.json"); @@ -173,7 +177,7 @@ pub(crate) fn field_names(narration: &str, ids: &[String]) -> Vec { let known = identifiers(); let mut found = BTreeSet::new(); for token in narration.split(|c: char| !(c.is_alphanumeric() || c == '_' || c == '-')).map(|token| token.trim_matches('-')).filter(|token| !token.is_empty()) { - if known.contains(&folded(token)) { + if known.contains(&folded(token)) && !token.eq_ignore_ascii_case(KEBAB_ENGLISH) { found.insert(token.to_owned()); } } diff --git a/crates/mind-body/src/projection/tests.rs b/crates/mind-body/src/projection/tests.rs index 4941a25..78da7ef 100644 --- a/crates/mind-body/src/projection/tests.rs +++ b/crates/mind-body/src/projection/tests.rs @@ -1065,8 +1065,11 @@ fn the_guard_catches_every_case_convention() { for leak in ["social-bonds", "socialbonds", "SOCIAL_BONDS", "SocialBonds", "candidate-actions", "the voice-summary", "inclusion-score", "activationProfile.situationalState"] { assert!(!field_names(leak, &[]).is_empty(), "{leak:?}"); } - // The cost, recorded: a schema key that reads as English hyphenated is flagged too. - assert_eq!(field_names("a short-term thing", &[]), ["short-term"]); + // The one exemption: "short-term" is ordinary English; its identifier forms are still caught. + assert!(field_names("a short-term thing, and a Short-Term one", &[]).is_empty()); + for leak in ["shortTerm", "short_term", "ShortTerm", "shortterm"] { + assert_eq!(field_names(&format!("her {leak} list"), &[]), [leak], "{leak}"); + } for prose in ["the DevOps crew", "an iPhone", "GameCult", "PlayStation", "need-to-know", "trust: she waits"] { assert!(field_names(prose, &[]).is_empty(), "{prose:?}"); }