Skip to content

armgit / xerj

Public Imported from GitHub
0

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.

test(autoindex): serialise url_resolution's env mutation under ENV_LOCK

xerj-orgd7ec543b8404
diff --git a/engine/crates/xerj-autoindex/src/xc.rs b/engine/crates/xerj-autoindex/src/xc.rs
index af1f6dc96..c8eaf6fd0 100644
--- a/engine/crates/xerj-autoindex/src/xc.rs
+++ b/engine/crates/xerj-autoindex/src/xc.rs
@@ -1247,6 +1247,10 @@ mod tests {
#[test]
fn url_resolution_prefers_flag_then_env_then_default() {
+ // under ENV_LOCK: set/remove of process env is global, so any test
+ // mutating env serialises with the others (one unreproduced lib-suite
+ // failure was observed on the merged #977 branch before this lock).
+ let _g = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
assert_eq!(resolve_url(Some("http://a:1")), "http://a:1");
// env-dependent branches covered by the e2e; default pinned here.
std::env::remove_var("XERJ_URL");