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.

style(xls): rustfmt the isolation worker + its integration test

xerj-orgb6a8cf370cc3
diff --git a/engine/crates/xerj-autoindex/src/extract/xls.rs b/engine/crates/xerj-autoindex/src/extract/xls.rs
index a3217b4f6..4aacf6368 100644
--- a/engine/crates/xerj-autoindex/src/extract/xls.rs
+++ b/engine/crates/xerj-autoindex/src/extract/xls.rs
@@ -1306,9 +1306,17 @@ mod tests {
#[test]
fn parse_worker_output_reconstructs_records_and_truncation() {
let mut buf = Vec::new();
- buf.extend_from_slice(serde_json::to_string(&WorkerLine::Rec(rec("Sales!r4"))).unwrap().as_bytes());
+ buf.extend_from_slice(
+ serde_json::to_string(&WorkerLine::Rec(rec("Sales!r4")))
+ .unwrap()
+ .as_bytes(),
+ );
buf.push(b'\n');
- buf.extend_from_slice(serde_json::to_string(&WorkerLine::Rec(rec("Sales!r5"))).unwrap().as_bytes());
+ buf.extend_from_slice(
+ serde_json::to_string(&WorkerLine::Rec(rec("Sales!r5")))
+ .unwrap()
+ .as_bytes(),
+ );
buf.push(b'\n');
buf.extend_from_slice(
serde_json::to_string(&WorkerLine::End { truncated: true })
@@ -1330,7 +1338,11 @@ mod tests {
#[test]
fn parse_worker_output_rejects_a_missing_terminator() {
let mut buf = Vec::new();
- buf.extend_from_slice(serde_json::to_string(&WorkerLine::Rec(rec("Sales!r4"))).unwrap().as_bytes());
+ buf.extend_from_slice(
+ serde_json::to_string(&WorkerLine::Rec(rec("Sales!r4")))
+ .unwrap()
+ .as_bytes(),
+ );
buf.push(b'\n');
assert!(parse_worker_output(&buf).is_err());
// Garbage that is not our protocol is also rejected.
diff --git a/engine/crates/xerj-autoindex/tests/xls_isolation.rs b/engine/crates/xerj-autoindex/tests/xls_isolation.rs
index a3033c38f..604d62640 100644
--- a/engine/crates/xerj-autoindex/tests/xls_isolation.rs
+++ b/engine/crates/xerj-autoindex/tests/xls_isolation.rs
@@ -50,7 +50,10 @@ fn record(typ: u16, body: &[u8]) -> Vec<u8> {
/// normally and reaches the hostile one that follows.
fn bof() -> Vec<u8> {
// vers=0x0600, dt=0x0005 (globals), rupBuild, rupYear, + reserved.
- record(0x0809, &[0x00, 0x06, 0x05, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
+ record(
+ 0x0809,
+ &[0x00, 0x06, 0x05, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ )
}
fn drain(path: &Path) -> ExtractStats {
@@ -90,18 +93,30 @@ fn hostile_xls_yields_junk_and_the_parent_survives() {
// 3) SST, huge cstUnique — pre-filter DoS vector.
let mut sst_huge = vec![0u8; 8];
sst_huge[4..8].copy_from_slice(&0x7FFF_FFFFi32.to_le_bytes());
- let f3 = write_workbook(dir, "sst_huge.xls", &[bof(), record(0x00FC, &sst_huge)].concat());
+ let f3 = write_workbook(
+ dir,
+ "sst_huge.xls",
+ &[bof(), record(0x00FC, &sst_huge)].concat(),
+ );
// 4) SST, negative cstUnique — pre-filter DoS vector (calamine's unwrap).
let mut sst_neg = vec![0u8; 8];
sst_neg[4..8].copy_from_slice(&(-1i32).to_le_bytes());
- let f4 = write_workbook(dir, "sst_neg.xls", &[bof(), record(0x00FC, &sst_neg)].concat());
+ let f4 = write_workbook(
+ dir,
+ "sst_neg.xls",
+ &[bof(), record(0x00FC, &sst_neg)].concat(),
+ );
// 5) Lbl (0x0018) with an 8-byte body — calamine does `&r.data[14..]`.
let f5 = write_workbook(dir, "lbl.xls", &[bof(), record(0x0018, &[0u8; 8])].concat());
// 6) ExternSheet (0x0017) with a 0-byte body — calamine read_u16 on < 2 bytes.
- let f6 = write_workbook(dir, "externsheet.xls", &[bof(), record(0x0017, &[])].concat());
+ let f6 = write_workbook(
+ dir,
+ "externsheet.xls",
+ &[bof(), record(0x0017, &[])].concat(),
+ );
for path in [&f1, &f2, &f3, &f4, &f5, &f6] {
let stats = drain(path);