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.

fix(autoindex): say that exit 3 is success (#1643)

xerj-orgce46bcd533a9
diff --git a/engine/crates/xerj-autoindex/src/cli.rs b/engine/crates/xerj-autoindex/src/cli.rs
index ac9e91bb3..1beb0a4df 100644
--- a/engine/crates/xerj-autoindex/src/cli.rs
+++ b/engine/crates/xerj-autoindex/src/cli.rs
@@ -629,7 +629,9 @@ pub fn help_text_with(feedback: bool) -> String {
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20journal committed; only the catalog's duplicate-alias cleanup\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20could not run. Read `reason` on the xerj-done line to tell the\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20two apart, and rerun the same command once the reported server\n\
- \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20condition clears;\n\
+ \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20condition clears. ok=true with exit=3 is success: the next\n\
+ \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20line is a xerj-note that says so (--progress json sets\n\
+ \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20exit_meaning on the done object);\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x204 NEEDS A DECISION — the estimate exceeded --max-minutes, or a\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20--watch poll cost more than --max-monthly-ops; nothing was\n\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20indexed and a JSON decision request is on stdout;\n\
diff --git a/engine/crates/xerj-autoindex/src/progress.rs b/engine/crates/xerj-autoindex/src/progress.rs
index ae77fb6ce..9423281e0 100644
--- a/engine/crates/xerj-autoindex/src/progress.rs
+++ b/engine/crates/xerj-autoindex/src/progress.rs
@@ -654,6 +654,12 @@ impl Progress {
for (key, value) in flags {
doc.insert((*key).to_string(), (*value).into());
}
+ if ok && exit == 3 {
+ doc.insert(
+ "exit_meaning".into(),
+ "success: junk was recorded, the run did not fail".into(),
+ );
+ }
let line = serde_json::Value::Object(doc);
self.sink.write(format!("{line}\n").as_bytes());
}
@@ -674,6 +680,11 @@ impl Progress {
line.push_str(&format!(" {key}={value}"));
}
line.push('\n');
+ if ok && exit == 3 {
+ line.push_str(
+ "xerj-note exit=3 means success: junk was recorded, the run did not fail\n",
+ );
+ }
self.sink.write(line.as_bytes());
}
}
@@ -2023,6 +2034,10 @@ mod tests {
assert_eq!(last["exit"], 3);
assert_eq!(last["reason"], "completed-with-junk");
assert_eq!(last["files"], 1922);
+ assert_eq!(
+ last["exit_meaning"],
+ "success: junk was recorded, the run did not fail"
+ );
}
/// #279. `ignored_files_in_pruned_dirs` is budget-capped, so on its own it
@@ -2170,6 +2185,12 @@ mod tests {
"{text}"
);
assert!(text.contains("files=12 records=7"), "{text}");
+ assert!(
+ text.contains(
+ "xerj-note exit=3 means success: junk was recorded, the run did not fail"
+ ),
+ "{text}"
+ );
}
#[test]