Persona T7: a read that returns only titles says the contents were not read (R19, Heimdall described PR contents from a title list)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-27 18:44:20 +01:00
commit db2fd8af76
2 changed files with 43 additions and 11 deletions

View file

@ -475,7 +475,7 @@ fn fixture_search(entries: &[ReadEntry], request: &ReadRequest) -> Option<String
(of.to_lowercase() == repo && (search_finds(words, title) || search_finds(words, body))).then(|| format!("- #{number} {title}"))
})
.collect();
(!listed.is_empty()).then(|| listed.join("\n"))
(!listed.is_empty()).then(|| format!("{}\n{TITLES_ONLY}", listed.join("\n")))
}
// ---------------------------------------------------------------------------------------------
@ -511,7 +511,7 @@ impl LiveReads {
if items.is_empty() {
return Err(ReadFailure::NotFound);
}
Ok(items.iter().map(|item| format!("- {}", facts_words(&item.facts))).collect::<Vec<_>>().join("\n"))
Ok(format!("{}\n{TITLES_ONLY}", items.iter().map(|item| format!("- {}", facts_words(&item.facts))).collect::<Vec<_>>().join("\n")))
}
fn rulings(&self, slug: &str, since: DateTime<Utc>) -> Result<String, ReadFailure> {
@ -547,11 +547,20 @@ impl LiveReads {
}
}
/// The line that ends a read whose result is titles and nothing of what they head (map 16.35, R19): she reads it with the
/// list, so she does not describe the contents of what she only saw named.
pub(crate) const TITLES_ONLY: &str = "Only titles were returned here; the contents were not read.";
/// What a campaign read shows, live and in the simulator alike (map 16.25.8): each ruling, newest first, at most
/// `RULINGS_SHOWN`, as `- {title}: {ruling}`, or `- {title}` when no ruling text is held. None is not found.
pub(crate) fn rulings_text<'a>(rulings: impl IntoIterator<Item = (&'a str, Option<&'a str>)>) -> Result<String, ReadFailure> {
let shown: Vec<String> = rulings.into_iter().take(RULINGS_SHOWN as usize).map(|(title, ruling)| ruling.map_or_else(|| format!("- {title}"), |ruling| format!("- {title}: {ruling}"))).collect();
if shown.is_empty() { Err(ReadFailure::NotFound) } else { Ok(shown.join("\n")) }
let rulings: Vec<(&str, Option<&str>)> = rulings.into_iter().take(RULINGS_SHOWN as usize).collect();
let shown: Vec<String> = rulings.iter().map(|(title, ruling)| ruling.map_or_else(|| format!("- {title}"), |ruling| format!("- {title}: {ruling}"))).collect();
if shown.is_empty() {
return Err(ReadFailure::NotFound);
}
let titled = rulings.iter().any(|(_, ruling)| ruling.is_none());
Ok(if titled { format!("{}\n{TITLES_ONLY}", shown.join("\n")) } else { shown.join("\n") })
}
fn forge_text(forge: &dyn ForgeGet, path: &str) -> Result<String, ReadFailure> {
@ -596,7 +605,8 @@ fn repo_read(forge: &dyn ForgeGet, target: &str) -> Result<String, ReadFailure>
Ok(format!("{}
Recent pull requests, merged and closed:
{}", repo["description"].as_str().unwrap_or_default(), listed.join("
{}
{TITLES_ONLY}", repo["description"].as_str().unwrap_or_default(), listed.join("
")))
}
Some('#') => {
@ -632,7 +642,7 @@ fn search(forge: &dyn ForgeGet, name: &str, words: &str) -> Result<String, ReadF
format!("- #{} {} ({} {state}, opened by {}, {})", item["number"], item["title"].as_str().unwrap_or_default(), if pull { "pull request" } else { "issue" }, item["user"]["login"].as_str().unwrap_or("?"), item["created_at"].as_str().unwrap_or_default().get(..10).unwrap_or_default())
})
.collect();
if listed.is_empty() { Err(ReadFailure::NotFound) } else { Ok(listed.join("\n")) }
if listed.is_empty() { Err(ReadFailure::NotFound) } else { Ok(format!("{}\n{TITLES_ONLY}", listed.join("\n"))) }
}
/// A document of her mind as a recall shows it: its id and the words its kind is known by.

View file

@ -102,7 +102,8 @@ fn k28_a_search_finds_an_older_change_by_her_words() {
}
}
let forge = Forge(std::cell::RefCell::default(), true);
assert_eq!(repo_read(&forge, "GameCult/Bifrost?q=consent receipt").unwrap(), "- #89 Chat sign-in gates on a live consent receipt (pull request merged, opened by heimdall, 2026-11-12)");
assert_eq!(repo_read(&forge, "GameCult/Bifrost?q=consent receipt").unwrap(), format!("- #89 Chat sign-in gates on a live consent receipt (pull request merged, opened by heimdall, 2026-11-12)
{TITLES_ONLY}"));
assert_eq!(forge.0.borrow()[0], "/api/v1/repos/GameCult/Bifrost/issues?state=all&q=consent%20receipt&limit=10");
assert_eq!(repo_read(&Forge(std::cell::RefCell::default(), false), "GameCult/Bifrost?q=nothing here"), Err(ReadFailure::NotFound));
assert_eq!(ReadRequest::Repo("GameCult/Bifrost?q=consent receipt".into()).what(her()), "a search of GameCult/Bifrost for \"consent receipt\"");
@ -120,10 +121,13 @@ fn r7_a_fixture_search_matches_the_titles_of_its_recorded_changes() {
.unwrap();
let since = Utc::now();
let search = |target: &str| fixture.read(&ReadRequest::Repo(target.into()), since);
assert_eq!(search("GameCult/Bifrost?q=consent receipt"), Ok("- #89 Consent receipt for door grants".into()));
assert_eq!(search("GameCult/Bifrost?q=body"), Ok("- #89 Consent receipt for door grants".into()), "the body counts as the forge's does");
assert_eq!(search("GameCult/Bifrost?q=consent receipt"), Ok(format!("- #89 Consent receipt for door grants
{TITLES_ONLY}")));
assert_eq!(search("GameCult/Bifrost?q=body"), Ok(format!("- #89 Consent receipt for door grants
{TITLES_ONLY}")), "the body counts as the forge's does");
assert_eq!(search("GameCult/Bifrost?q=consent rec"), Err(ReadFailure::NotFound), "whole words only");
assert_eq!(search("gamecult/bifrost?q=Consent"), Ok("- #89 Consent receipt for door grants".into()), "the repo's own changes only, case-blind");
assert_eq!(search("gamecult/bifrost?q=Consent"), Ok(format!("- #89 Consent receipt for door grants
{TITLES_ONLY}")), "the repo's own changes only, case-blind");
assert_eq!(search("GameCult/Bifrost?q=consent signature"), Err(ReadFailure::NotFound));
assert_eq!(search("gamecult/BIFROST#90"), Ok("Sign-in gate".into()), "a recorded read by its normal form");
}
@ -189,5 +193,23 @@ fn r9_a_fixture_search_says_the_number_once() {
let fixture: ReadFixture = serde_json::from_value(serde_json::json!([{ "kind": "repo", "target": "GameCult/Bifrost#87", "text": "#87 Merge pages and notices (opened by heimdall, merged)
Prove both." }])).unwrap();
assert_eq!(fixture.read(&ReadRequest::Repo("GameCult/Bifrost?q=merge pages".into()), Utc::now()), Ok("- #87 Merge pages and notices (opened by heimdall, merged)".into()));
assert_eq!(fixture.read(&ReadRequest::Repo("GameCult/Bifrost?q=merge pages".into()), Utc::now()), Ok(format!("- #87 Merge pages and notices (opened by heimdall, merged)
{TITLES_ONLY}")));
}
/// R19, Heimdall: he described a pull request's contents after a read that returned only titles. Every read whose result
/// is titles says so, and a read that returns the text does not.
#[test]
fn a_read_that_returns_only_titles_says_the_contents_were_not_read() {
let fixture: ReadFixture = serde_json::from_value(serde_json::json!([
{ "kind": "repo", "target": "GameCult/Bifrost#87", "text": "#87 Merge pages and notices\nThe body." }
]))
.unwrap();
let search = fixture.read(&ReadRequest::Repo("GameCult/Bifrost?q=merge pages".into()), Utc::now()).unwrap();
assert!(search.ends_with(TITLES_ONLY) && TITLES_ONLY.contains("contents were not read"), "{search}");
let opened = fixture.read(&ReadRequest::Repo("GameCult/Bifrost#87".into()), Utc::now()).unwrap();
assert!(!opened.contains(TITLES_ONLY), "a read of the text is not titles only: {opened}");
let named = rulings_text([("Ruling one", None), ("Ruling two", Some("The text."))]).unwrap();
assert!(named.ends_with(TITLES_ONLY), "{named}");
assert!(!rulings_text([("Ruling two", Some("The text."))]).unwrap().contains(TITLES_ONLY));
}