From 8a9ade959d05c3c97f0f781a5dc614bc1328d9e4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 29 Sep 2026 20:36:51 +0200 Subject: [PATCH] Drop a racy queue peek from the hung-embedder test The test read the queued search's due moment through the sink's lock right after asking, but the worker can take the search first: it failed under the load of cargo-mutants' baseline run. The stamp is pinned without a worker in the_sink_owns_the_searchs_deadline_and_tells_the_loop, which is the test that owns it. Co-Authored-By: Claude Opus 5.5 --- crates/huginn-daemon/src/index/tests.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/huginn-daemon/src/index/tests.rs b/crates/huginn-daemon/src/index/tests.rs index 17ead91..51bf48c 100644 --- a/crates/huginn-daemon/src/index/tests.rs +++ b/crates/huginn-daemon/src/index/tests.rs @@ -380,7 +380,7 @@ fn every_call_on_the_search_path_is_bounded_by_the_searchs_time_and_the_flush_by /// identity read never answers, and the search is answered, and the worker /// free, when the search's own time has passed. A search that waited past its /// time in the queue is answered without asking the embedder anything. A -/// ticket's time is `SEARCH_DEADLINE` from the moment it was asked. +/// ticket's time is stamped by the sink (see `the_sink_owns_the_searchs_deadline_and_tells_the_loop`). #[test] fn a_hung_embedder_holds_the_worker_no_longer_than_the_search_that_asked() { let (_root, mind) = mind_with_documents(); @@ -389,10 +389,7 @@ fn a_hung_embedder_holds_the_worker_no_longer_than_the_search_that_asked() { let mut sink = WorkerSink::spawn(embedder.clone(), index, &slug(INSTANCE), Some(MIND.into()), entries, quick()); sink.wait_status(|status| *status == IndexStatus::Current); - let asked = Instant::now(); ask_sink(&mut sink, "the ticket's time", 3).unwrap(); - let due = lock(&sink.shared).searches.back().expect("the search is queued").due; - assert!(due >= asked + SEARCH_DEADLINE && due <= Instant::now() + SEARCH_DEADLINE, "due is SEARCH_DEADLINE after it was asked"); answers(&mut sink, 1); embedder.state.lock().unwrap().hang_identity = true;