Persona T7 fix: the live repo root and recall titles-only lines are pinned by tests (Soul s2 N5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f9a0e1ef2d
commit
b042bee00b
2 changed files with 31 additions and 4 deletions
|
|
@ -515,10 +515,7 @@ impl LiveReads {
|
|||
|
||||
fn recall(&self, words: &str) -> Result<String, ReadFailure> {
|
||||
let PipelinePageItems::Headers(items) = self.ask(Selection::default(), Some(SemanticQuery { text: Line(words.to_owned()), top_k: RECALL_TOP_K }))? else { return Err(ReadFailure::Failed) };
|
||||
if items.is_empty() {
|
||||
return Err(ReadFailure::NotFound);
|
||||
}
|
||||
Ok(format!("{}\n{TITLES_ONLY}", items.iter().map(|item| format!("- {}", facts_words(&item.facts))).collect::<Vec<_>>().join("\n")))
|
||||
recall_text(items.iter().map(|item| &item.facts))
|
||||
}
|
||||
|
||||
fn rulings(&self, slug: &str, since: DateTime<Utc>) -> Result<String, ReadFailure> {
|
||||
|
|
@ -647,6 +644,12 @@ fn search(forge: &dyn ForgeGet, name: &str, words: &str) -> Result<String, ReadF
|
|||
if listed.is_empty() { Err(ReadFailure::NotFound) } else { Ok(format!("{}\n{TITLES_ONLY}", listed.join("\n"))) }
|
||||
}
|
||||
|
||||
/// What a mind recall shows, live and under test: each document's words as a list, then the titles-only line. None is not found.
|
||||
fn recall_text<'a>(facts: impl IntoIterator<Item = &'a PipelineFacts>) -> Result<String, ReadFailure> {
|
||||
let listed: Vec<String> = facts.into_iter().map(|facts| format!("- {}", facts_words(facts))).collect();
|
||||
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.
|
||||
fn facts_words(facts: &PipelineFacts) -> String {
|
||||
match facts {
|
||||
|
|
|
|||
|
|
@ -221,3 +221,27 @@ fn a_read_that_returns_only_titles_says_the_contents_were_not_read() {
|
|||
let named = rulings_text([("Ruling one", None), ("Ruling two", Some("The text."))]).unwrap();
|
||||
assert_eq!(named, "- Ruling one (title only: the ruling was not read)\n- Ruling two: The text.");
|
||||
}
|
||||
|
||||
/// Soul s2 (live-titles-only-unpinned; m10, m11): the live repo root and the live recall end with the titles-only line, and
|
||||
/// the live opening of one pull request does not.
|
||||
#[test]
|
||||
fn the_live_root_listing_and_recall_say_titles_only() {
|
||||
struct Forge;
|
||||
impl ForgeGet for Forge {
|
||||
fn get(&self, path: &str) -> anyhow::Result<(u16, String)> {
|
||||
let body = if path.contains("/pulls/") {
|
||||
serde_json::json!({ "number": 3, "title": "A title", "state": "closed", "merged": true, "user": { "login": "nibu" }, "body": "The whole body." })
|
||||
} else if path.contains("/pulls") {
|
||||
serde_json::json!([{ "number": 3, "title": "A title", "state": "closed", "merged": true, "user": { "login": "nibu" } }])
|
||||
} else {
|
||||
serde_json::json!({ "description": "A repo." })
|
||||
};
|
||||
Ok((200, body.to_string()))
|
||||
}
|
||||
}
|
||||
assert!(repo_read(&Forge, "GameCult/Lodur").unwrap().ends_with(TITLES_ONLY));
|
||||
assert!(!repo_read(&Forge, "GameCult/Lodur#3").unwrap().contains(TITLES_ONLY));
|
||||
let facts = PipelineFacts::Target { revision: 1, invariants: Vec::new() };
|
||||
assert!(recall_text([&facts]).unwrap().ends_with(TITLES_ONLY));
|
||||
assert_eq!(recall_text([]), Err(ReadFailure::NotFound));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue