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.

Merge remote-tracking branch 'origin/main' into HEAD

xerj-org64b7d2385b59
diff --cc engine/crates/xerj-server/src/main.rs
index 8552bece2,c7bbeca32..ee18eee86
--- a/engine/crates/xerj-server/src/main.rs
+++ b/engine/crates/xerj-server/src/main.rs
@@@ -2049,46 -2025,21 +2059,58 @@@ mod decide_flag_tests
);
}
+ #[test]
+ fn a_value_flag_without_its_value_is_an_error_not_unset() {
+ // #1435: given last, or followed by another flag, the value is
+ // missing — this used to boot on the default silently.
+ for line in [
+ &["--insecure", "--data-dir"][..],
+ &["--port"][..],
+ &["-c"][..],
+ &["--data-dir", "--insecure"][..],
+ &["--bind", "--port", "9300"][..],
+ &["--decide-model-dir"][..],
+ ] {
+ let err = parse_args_from(argv(line)).err();
+ assert!(
+ err.as_deref().is_some_and(|e| e.contains("needs a value")),
+ "{line:?} must be refused, got {err:?}"
+ );
+ }
+ // A value that merely contains or starts with a single dash is fine.
+ let args = parse_args_from(argv(&["-d", "-data", "--bind", "::1"])).unwrap();
+ assert_eq!(args.data_dir.as_deref(), Some("-data"));
+ assert_eq!(args.bind.as_deref(), Some("::1"));
+ }
+
+ #[test]
+ fn index_counts_refuse_a_non_number_instead_of_defaulting() {
+ use super::parse_count;
+ assert_eq!(parse_count("--batch", Some("200".into())), Ok(200));
+ assert!(parse_count("--batch", Some("abc".into()))
+ .unwrap_err()
+ .contains("whole number"));
+ assert!(parse_count("--workers", Some("-1".into())).is_err());
+ assert!(parse_count("--limit", None)
+ .unwrap_err()
+ .contains("needs a value"));
+ }
+
+ #[test]
+ fn help_counts_the_mcp_tools_actually_served() {
+ // #1443: the help said "exposes 13 tools" while `tools/list` served 16.
+ let served = super::mcp_tool_count();
+ assert!(served >= 16, "tool_specs() shrank to {served}");
+ let help = help_text(false);
+ assert!(
+ help.contains(&format!("exposes {served} tools")),
+ "help must state the served tool count {served}, got:\n{help}"
+ );
+ }
+
#[test]
fn decide_flags_default_to_none() {
- let args = parse_args_from(argv(&[]));
+ let args = parse_args_from(argv(&[])).unwrap();
assert_eq!(args.decide_mode, None);
assert_eq!(args.decide_model_dir, None);
}