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
fix(autoindex): #768 deliver the XERJ_URL wrong-node warning so --quiet can't drop it
xerj-orgfd0ebef949d9
diff --git a/engine/crates/xerj-autoindex/src/cli.rs b/engine/crates/xerj-autoindex/src/cli.rsindex 422c47d30..5126e666f 100644--- a/engine/crates/xerj-autoindex/src/cli.rs+++ b/engine/crates/xerj-autoindex/src/cli.rs@@ -32,6 +32,13 @@ pub struct IndexCfg {pub pdf_workers: usize,/// What the machine forced on this run, printed once at start-up.pub resource_notes: Vec<String>,+ /// #768: the `XERJ_URL`-ignored safety note (set when `XERJ_URL` is present+ /// but `--url` was not passed). Carried separately from `resource_notes`+ /// because it is a safety warning, not routine progress chatter: it is+ /// emitted with an unconditional `eprintln` (so `--quiet` does not silence a+ /// "you may be writing to the wrong node" message) and mirrored into the+ /// `--json` result, matching how `map`/`status` deliver the same note.+ pub xerj_url_note: Option<String>,pub pdf_timeout_secs: u64,pub bulk_mb: usize,pub bulk_timeout_secs: u64,@@ -819,10 +826,6 @@ pub fn parse(args: Vec<String>) -> Result<Cmd, String> {);}let plan = crate::resources::plan(workers, pdf_workers, bulk_mb);- let mut resource_notes = plan.notes;- if let Some(note) = xerj_url_note {- resource_notes.push(note);- }Ok(Cmd::Index(Box::new(IndexCfg {root,url,@@ -831,7 +834,11 @@ pub fn parse(args: Vec<String>) -> Result<Cmd, String> {workers: plan.index_workers,scan_workers: plan.scan_threads,pdf_workers: plan.pdf_workers,- resource_notes,+ resource_notes: plan.notes,+ // #768: delivered by run_index via unconditional eprintln (not the+ // --quiet-suppressible resource_notes surface) and mirrored into+ // --json, so a wrong-node warning is never silently dropped.+ xerj_url_note,pdf_timeout_secs,bulk_mb,bulk_timeout_secs,@@ -1000,6 +1007,21 @@ mod tests {);}+ /// #768: the index cfg carries the XERJ_URL-ignored note on its own field+ /// (delivered by an unconditional eprintln, so --quiet cannot silence a+ /// wrong-node warning) rather than folding it into the --quiet-suppressible+ /// resource_notes. An explicit --url means the env var was not ignored, so+ /// there is nothing to warn about — deterministic regardless of the+ /// environment the test runs in.+ #[test]+ fn index_suppresses_the_xerj_url_note_when_url_is_explicit() {+ let cfg = index(&["data", "--url", "http://es.internal:9200"]);+ assert!(+ cfg.xerj_url_note.is_none(),+ "an explicit --url means XERJ_URL was not ignored; no note"+ );+ }+/// #240 §1/§2: `--workers` capped itself at 8 for no recorded reason and/// governed only phase B. It now governs both phases and defaults to the/// machine.diff --git a/engine/crates/xerj-autoindex/src/detect/e2e.rs b/engine/crates/xerj-autoindex/src/detect/e2e.rsindex 70d4d3171..2eeab65b1 100644--- a/engine/crates/xerj-autoindex/src/detect/e2e.rs+++ b/engine/crates/xerj-autoindex/src/detect/e2e.rs@@ -266,6 +266,7 @@ fn cfg(root: &Path, state_dir: &Path, url: &str) -> IndexCfg {scan_workers: 1,pdf_workers: 1,resource_notes: Vec::new(),+ xerj_url_note: None,pdf_timeout_secs: 30,bulk_mb: 8,bulk_timeout_secs: 300,diff --git a/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rs b/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rsindex b971e2ae2..1ee9c2ec5 100644--- a/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rs+++ b/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rs@@ -587,6 +587,7 @@ fn cfg(root: &Path, state_dir: &Path, url: &str) -> IndexCfg {scan_workers: 1,pdf_workers: 1,resource_notes: Vec::new(),+ xerj_url_note: None,pdf_timeout_secs: 30,bulk_mb: 64,bulk_timeout_secs: 3_600,diff --git a/engine/crates/xerj-autoindex/src/incremental_reconcile_http_tests.rs b/engine/crates/xerj-autoindex/src/incremental_reconcile_http_tests.rsindex c875f71bf..ca4cbc6b6 100644--- a/engine/crates/xerj-autoindex/src/incremental_reconcile_http_tests.rs+++ b/engine/crates/xerj-autoindex/src/incremental_reconcile_http_tests.rs@@ -481,6 +481,7 @@ fn cfg(root: &Path, state_dir: &Path, url: &str, semantic: bool) -> IndexCfg {scan_workers: 1,pdf_workers: 1,resource_notes: Vec::new(),+ xerj_url_note: None,pdf_timeout_secs: 30,bulk_mb: 1,bulk_timeout_secs: 30,diff --git a/engine/crates/xerj-autoindex/src/lib.rs b/engine/crates/xerj-autoindex/src/lib.rsindex 885154b6a..23026074d 100644--- a/engine/crates/xerj-autoindex/src/lib.rs+++ b/engine/crates/xerj-autoindex/src/lib.rs@@ -1636,6 +1636,7 @@ mod phase_a_grouping_tests {scan_workers: 1,pdf_workers: 1,resource_notes: Vec::new(),+ xerj_url_note: None,pdf_timeout_secs: 10,bulk_mb: 1,bulk_timeout_secs: 10,@@ -3530,6 +3531,13 @@ pub fn run_index_report(cfg: IndexCfg) -> Result<(i32, Option<Value>)> {// The very first statement of the function, deliberately: `started` must// be when this invocation began, not when its summary was built.let invocation_started = chrono::Utc::now();+ // #768: the wrong-node warning is a safety signal, not progress chatter, so+ // it goes to stderr unconditionally (surviving --quiet, which silences the+ // resource_notes/pr.note surface) and before any endpoint I/O — the same+ // delivery map/status use. It is also mirrored into the --json result below.+ if let Some(note) = &cfg.xerj_url_note {+ eprintln!("autoindex: {note}");+ }// Fix the phase-A pool width BEFORE anything parallel starts: hashing and// sniffing are the CPU-bound phase, and they used to take every core no// matter what the caller asked for (#240 §2).@@ -6250,6 +6258,9 @@ pub fn run_index_report(cfg: IndexCfg) -> Result<(i32, Option<Value>)> {"bulk_concurrency_final": es.bulk_concurrency_limit(),"bulk_congestion_events": es.bulk_congestion_events(),"resource_notes": cfg.resource_notes,+ // #768: mirror the wrong-node warning here too (null when it did not+ // fire), so a --json consumer sees the same safety signal stderr does.+ "xerj_url_note": cfg.xerj_url_note,"semantic": !cfg.no_semantic,"pdf_extraction_reuse": pdf_spool_budget.report(),});