Persona harness: a fixture search says a change's number once
Soul's R9 item 5. When a recorded text opens with its own number ("#87 Merge
pages..."), the search list no longer repeats it ("- #87 #87 Merge pages...").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
623061bb77
commit
7132f152ca
2 changed files with 11 additions and 0 deletions
|
|
@ -410,7 +410,9 @@ fn fixture_search(entries: &[ReadEntry], request: &ReadRequest) -> Option<String
|
|||
.filter_map(|entry| {
|
||||
let (of, number) = entry.target.split_once('#')?;
|
||||
let (title, body) = entry.text.as_deref()?.split_once('\n').unwrap_or((entry.text.as_deref()?, ""));
|
||||
// A recorded text that opens with its own number ("#87 Merge pages…") is listed without saying it twice.
|
||||
let title = title.trim();
|
||||
let title = title.strip_prefix(&format!("#{number}")).map_or(title, str::trim_start);
|
||||
(of.to_lowercase() == repo && (search_finds(words, title) || search_finds(words, body))).then(|| format!("- #{number} {title}"))
|
||||
})
|
||||
.collect();
|
||||
|
|
|
|||
|
|
@ -182,3 +182,12 @@ fn r9_one_matcher_stems_for_the_fixture_and_the_live_forge() {
|
|||
assert_eq!(repo_read(&Recorded, "GameCult/Bifrost?q=consent receipts"), repo_read(&Recorded, "GameCult/Bifrost?q=consent receipt"));
|
||||
assert!(repo_read(&Recorded, "GameCult/Bifrost?q=consent receipts").unwrap().starts_with("- #71 "));
|
||||
}
|
||||
|
||||
/// Soul's R9: a fixture search lists a change once by its number, even when its recorded text opens with the number.
|
||||
#[test]
|
||||
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()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue