Pin the daemon door for texts: refused by field before queueing

Zero, nine and blank texts answer Refused naming `texts` and never reach the
index; two texts are one queued search. Cut
gamecult-chat:cut_spec:cut-source-query-texts.r1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Eureka 2026-11-11 16:03:28 +00:00
commit fece9a7737

View file

@ -673,7 +673,16 @@ pub(crate) mod tests {
let answer = daemon.handle(refused, now()).answered();
assert!(matches!(answer, HuginnMindResponse::Refused(_)), "{answer:?}");
}
assert_eq!(*asked.lock().unwrap(), 2, "a refused query never reached the index");
let texts = |texts: &[&str]| HuginnMindRequest::SearchSources {
instance: slug(INSTANCE),
query: SourceQuery { text: huginn_mind::eureka_pipeline::Line::default(), texts: texts.iter().map(|text| huginn_mind::eureka_pipeline::Line((*text).into())).collect(), top_k: 5, repo: None, front: false },
};
for refused in [texts(&[]), texts(&["a"; 9]), texts(&["a", " "])] {
let answer = daemon.handle(refused, now()).answered();
assert!(matches!(answer, HuginnMindResponse::Refused(MindRefusal::SelectionInvalid { ref field, .. }) if field == "texts"), "{answer:?}");
}
assert!(matches!(daemon.handle(texts(&["a", "b"]), now()), Handled::Searching(_)), "two texts are one queued search");
assert_eq!(*asked.lock().unwrap(), 3, "a refused query never reached the index");
}
/// A daemon over the instance's mind under `state_root`, with no index.