From fece9a773722bc98081fcfb7886e1b4e04748b31 Mon Sep 17 00:00:00 2001 From: Eureka Date: Wed, 11 Nov 2026 16:03:28 +0000 Subject: [PATCH] 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 --- crates/huginn-daemon/src/daemon.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/huginn-daemon/src/daemon.rs b/crates/huginn-daemon/src/daemon.rs index c91f0d6..366b433 100644 --- a/crates/huginn-daemon/src/daemon.rs +++ b/crates/huginn-daemon/src/daemon.rs @@ -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.