AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
test(engine): bound the publication test barriers so a missed point fails fast (#158)
xerj-org2915297fea01
diff --git a/engine/crates/xerj-engine/src/index.rs b/engine/crates/xerj-engine/src/index.rsindex eca283d0c..5e2140df4 100644--- a/engine/crates/xerj-engine/src/index.rs+++ b/engine/crates/xerj-engine/src/index.rs@@ -1760,6 +1760,21 @@ mod merge_publication_transaction_tests {use crate::Engine;use tempfile::TempDir;+ /// Wait for a publication test barrier, bounded.+ ///+ /// These barriers block a tokio worker thread on purpose, and an unbounded+ /// `recv()` turns "the code never reached this point" into a hang. On CI+ /// that surfaced as a job cancelled at the six-hour ceiling with nothing in+ /// the log but "has been running for over 60 seconds". Bounded, the same+ /// bug is a ten-second failure naming the point it waited for.+ #[track_caller]+ fn await_barrier<T>(rx: &std::sync::mpsc::Receiver<T>, what: &str) -> T {+ match rx.recv_timeout(std::time::Duration::from_secs(20)) {+ Ok(v) => v,+ Err(e) => panic!("publication barrier `{what}` never fired ({e:?})"),+ }+ }+fn config(dir: &TempDir) -> xerj_common::config::Config {let mut config = xerj_common::config::Config::default();config.server.data_dir = dir.path().to_string_lossy().into_owned();@@ -1997,12 +2012,12 @@ mod merge_publication_transaction_tests {index.set_publication_test_hook(Some(Arc::new(move |_, point| {if point == PublicationTestPoint::MergeAfterRepoint {entered_tx.lock().take().unwrap().send(()).unwrap();- resume_rx.lock().take().unwrap().recv().unwrap();+ await_barrier(&resume_rx.lock().take().unwrap(), "resume");}})));let merge_index = Arc::clone(&index);let merge = tokio::spawn(async move { merge_index.run_merge_once().await });- tokio::task::spawn_blocking(move || entered_rx.recv().unwrap())+ tokio::task::spawn_blocking(move || await_barrier(&entered_rx, "entered")).await.unwrap();let read_index = Arc::clone(&index);