use crate::brain::agent::service::phantom::claims_unbacked_evidence;
const FABRICATED_DUMP: &str = "Verified just now, real output:\n\
=== LINE COUNT ===\n\
1916 src/tui/mod.rs\n\
149:pub struct Tui {\n\
161:impl Tui {\n\
171: pub async fn run(&mut self) -> Result<AppExit> {";
#[test]
fn a_dump_no_tool_produced_is_flagged() {
let real = vec!["25 src/tui/mod.rs\n".to_string()];
assert!(claims_unbacked_evidence(FABRICATED_DUMP, &real));
}
#[test]
fn a_dump_with_no_tools_at_all_is_flagged() {
assert!(claims_unbacked_evidence(FABRICATED_DUMP, &[]));
}
#[test]
fn quoting_a_real_result_is_clean() {
let real = vec![
"=== LINE COUNT ===\n1916 src/tui/mod.rs\n149:pub struct Tui {\n161:impl Tui {\n\
171: pub async fn run(&mut self) -> Result<AppExit> {"
.to_string(),
];
assert!(!claims_unbacked_evidence(FABRICATED_DUMP, &real));
}
#[test]
fn a_partially_quoted_result_is_clean() {
let text = "Here are the hits:\n149:pub struct Tui {\n161:impl Tui {\n999:invented line";
let real = vec!["149:pub struct Tui {\n161:impl Tui {\n".to_string()];
assert!(!claims_unbacked_evidence(text, &real));
}
#[test]
fn prose_is_never_examined() {
let text = "The module is declarations only, which is why the file is short. \
I would move the vim layer into its own submodule.";
assert!(!claims_unbacked_evidence(text, &[]));
}
#[test]
fn a_single_citation_is_not_a_dump() {
let text = "The fold logic lives at chat.rs and the anchor is set there.\n\
149:pub struct Tui {";
assert!(!claims_unbacked_evidence(text, &[]));
}
#[test]
fn a_timestamp_is_not_an_evidence_line() {
let text = "It happened at 13:32:10 and again later.\n\
The retry fired immediately after.\n\
Nothing else ran.";
assert!(!claims_unbacked_evidence(text, &[]));
}
#[test]
fn an_aligned_key_value_block_is_evidence() {
let text = "Checked with gh, real data, three open issues:\n\
# : 775\n\
Title : Non-owner can no longer trigger /new in group chats\n\
Labels : bug, telegram\n\
Opened : 2026-07-26";
assert!(claims_unbacked_evidence(text, &[]));
}
#[test]
fn a_column_row_listing_is_evidence() {
let text = "The actual output is above:\n\
#776 TUI: pasted multi-line text loses formatting bug, tui\n\
#775 Non-owner can no longer trigger /new ... bug, telegram\n\
#769 Provider wave follow-up: CI and docs chore, providers";
assert!(claims_unbacked_evidence(text, &[]));
}
#[test]
fn prose_containing_a_colon_is_not_a_key_value_block() {
let text = "Here is the thing: the module is declarations only.\n\
That matters because: the code lives in submodules.\n\
So the fix is: move the layer out.";
assert!(!claims_unbacked_evidence(text, &[]));
}
#[test]
fn a_markdown_heading_is_not_a_column_row() {
let text = "# Findings\n# Next steps\n# Open questions";
assert!(!claims_unbacked_evidence(text, &[]));
}