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(config): report an example block with no [section] header instead of skipping it

xerj-org8a2cf83361de
diff --git a/engine/crates/xerj-common/src/config.rs b/engine/crates/xerj-common/src/config.rs
index 482b32af6..7b6bc8a19 100644
--- a/engine/crates/xerj-common/src/config.rs
+++ b/engine/crates/xerj-common/src/config.rs
@@ -1996,14 +1996,30 @@ mod tests {
continue;
};
let key = key.trim();
- if section.is_empty()
- || key.is_empty()
+ if key.is_empty()
|| !key
.bytes()
.all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'_')
{
continue;
}
+ if section.is_empty() {
+ // Skipping quietly here is how a whole block escapes the
+ // check. Only a line that names a real setting matters, so
+ // report exactly those and stay quiet about `key = value`
+ // text that is not config at all.
+ if defaults
+ .as_object()
+ .is_some_and(|cfg| cfg.values().any(|s| s.get(key).is_some()))
+ {
+ drift.push(format!(
+ "example: `{key} = …` sits in a block with no [section] header \
+ above it, so nothing can check it against Config::default() — \
+ add the header"
+ ));
+ }
+ continue;
+ }
let Some(actual) = defaults.get(&section).and_then(|s| s.get(key)) else {
drift.push(format!(
"example: [{section}] {key} is not a key in Config — a reader pasting \