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
docs(autoindex): cite #380/#381 instead of asserting an unfiled follow-up
xerj-orge711dcc18abf
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a079b29fe..5c217a499 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -331,8 +331,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0first column header is `GIF8`, and prose opening `BM` were each measured toclassify as `binary`/`gif` and `binary`/`bmp` on `ca4d75a` **and** on thisbranch, identically. Fixing them changes behaviour unrelated to Unity, so it- is filed as a follow-up rather than smuggled in here. `GIF8` is listed- alongside `BM` so the next reader does not conclude `BM` is the only one.+ is filed as **#380** rather than smuggled in here, and today's wrong answers+ are pinned by `gif8_and_bm_are_still_taken_on_faith` so #380 has to flip that+ assertion deliberately. `GIF8` is listed alongside `BM` so the next reader+ does not conclude `BM` is the only one.- **A junk entry could overwrite a successfully indexed file's catalog row.**When phase B met a record group phase A never sampled, the worker pushed a@@ -363,7 +365,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0identical on `ca4d75a` and on this branch (`binary`/`gif` and `binary`/`bmp`in both) — and is left unchanged because fixing it is a behaviour change withno Unity content. Both names are recorded here on purpose: `BM` is the- obvious one and `GIF8` is the one a reader would otherwise miss. Follow-up.+ obvious one and `GIF8` is the one a reader would otherwise miss. Tracked as+ **#380**; `gif8_and_bm_are_still_taken_on_faith` pins the current behaviour.++- **A magic-less binary is still sectioned and indexed in full.** The two+ byte-statistics guards this branch removed (they junked non-Latin text) also+ caught NUL-free binary payloads that decode printable under the+ windows-1252 fallback. Nothing replaced them except `looks_like_tga_header`,+ which covers TGA only. Measured on this branch: a 4,194,495-byte printable+ NUL-free blob named `texture.bytes` sniffs `txt-prose` and expands into 2048+ indexed records. This is **not** the peak-RSS bug from #239 —+ `for_each_section` is still streaming and per-file memory is still bounded;+ the unbounded quantity is the record COUNT. Removing the guards was still+ right: they deleted CJK, Cyrillic, Greek, Hebrew and Arabic documents+ worldwide. Tracked as **#381**.## [1.0.0-rc.16] - 2026-08-13diff --git a/engine/crates/xerj-autoindex/src/sniff.rs b/engine/crates/xerj-autoindex/src/sniff.rsindex bcd4ac129..1dd745352 100644--- a/engine/crates/xerj-autoindex/src/sniff.rs+++ b/engine/crates/xerj-autoindex/src/sniff.rs@@ -195,8 +195,10 @@ fn sniff_bytes(// Two printable signatures remain unqualified — `GIF8` and `BM` — and both// have the same defect. They are NOT new: they are unchanged from// `ca4d75a` and were measured to classify identically on both trees, so- // fixing them is a separate behaviour change and is filed as a follow-up- // rather than smuggled into a Unity PR.+ // fixing them is a separate behaviour change and is filed as #380 rather+ // than smuggled into a Unity PR. Today's wrong answers are pinned by+ // `printable_magic_regression_tests::gif8_and_bm_are_still_taken_on_faith`,+ // so #380 has to come here and flip that assertion deliberately.//// Qualifying a magic number is the// rule Lucene applies to its own containers: `CodecUtil.checkHeader`@@ -381,8 +383,8 @@ pub const WINDOWS_1252_LOSSY: &str = "windows-1252 (lossy)";/// ASCII, so prose or a CSV header beginning with those characters is junked/// as an image. Both predate this branch — they are unchanged from `ca4d75a`/// and measured identical on both trees — so they are left alone here rather-/// than widened into an unrelated behaviour change, and are tracked as a-/// follow-up. Do not read this function as a proof that its callers are safe;+/// than widened into an unrelated behaviour change, and are tracked as #380.+/// Do not read this function as a proof that its callers are safe;/// it is only a statement that no *further* check is performed.fn accept(_prefix: &[u8]) -> bool {true@@ -648,9 +650,11 @@ fn txt_kind(nonblank: &[&str]) -> Family {// check ("mostly non-ASCII under the windows-1252 fallback") was tried and// removed in the same breath as this one and for the same reason: it// junked Cyrillic, Greek, Hebrew, Arabic and mixed Japanese prose.- // Bounding sectioning memory is the right fix for the RAM concern;- // silently deleting files that look unusual is not. Tracked as a- // follow-up.+ // Bounding what a magic-less binary costs is the right fix for the concern+ // those guards existed for; silently deleting files that look unusual is+ // not. Tracked as #381, which measures the gap this NOTE leaves open: a+ // 4,194,495-byte printable NUL-free blob sniffs `txt-prose` and expands+ // into 2048 indexed records.let avg_len = nonblank.iter().map(|l| l.len()).sum::<usize>() as f64 / nonblank.len() as f64;if avg_len > 60.0 {return Family::TxtProse;@@ -957,6 +961,20 @@ mod unity_sniff_tests {"Kaydara FBX Binary is the 20-byte magic that opens every binary \FBX file exported by Autodesk tools. ",),+ // The DOUBLE-space variant is the dangerous one and was previously+ // only measured by hand, never pinned. `fbx_header` requires the+ // real 23-byte header `Kaydara FBX Binary \x00\x1a\x00`, and the+ // two spaces ARE part of it — so this sentence satisfies 20 of+ // those 23 bytes and is refused only at offset 20, where the+ // header needs `\x00` and prose has a letter. The one-space+ // fixture above is refused one byte earlier, at offset 19. Both+ // match the 18-byte table entry itself in full; the qualifier is+ // the only thing that keeps either of them out of `Family::Binary`.+ (+ "fbx-two-space",+ "Kaydara FBX Binary is followed by a NUL and 0x1a in the real \+ header, which is what this note is about. ",+ ),] {let text = opener.repeat(30);let sn = sniff_bytes(@@ -1297,6 +1315,81 @@ mod unity_sniff_tests {}}+/// Characterisation of a KNOWN, PRE-EXISTING defect, tracked as #380.+///+/// Every other printable-ASCII signature in the magic table carries a+/// structural qualifier. `GIF8` and `BM` do not: they pass `accept`, which+/// returns `true` without looking at a single byte. So text beginning with+/// those characters is classified `Family::Binary` and `scan_file` junks it.+///+/// This module asserts the WRONG answer on purpose. The behaviour is not+/// introduced by this branch — on `origin/main` the same two entries sit in a+/// loop with no qualifier at all (`if prefix.starts_with(magic)`), so the+/// control flow to `Family::Binary` is identical and cannot differ — and+/// fixing it is a behaviour change with no Unity content. Pinning it here is+/// what stops the CHANGELOG's "known issue" wording from being the only record+/// of it: whoever fixes #380 must come to this file and flip these assertions,+/// which is the point.+#[cfg(test)]+mod printable_magic_regression_tests {+ use super::*;++ #[test]+ fn gif8_and_bm_are_still_taken_on_faith() {+ // Prose, and a well-formed CSV whose first column header happens to be+ // `GIF8`. All four are text. All four are reported as images.+ for (label, bytes, name, kind) in [+ (+ "gif8-prose",+ "GIF8 is the four byte magic that opens a GIF image file. "+ .repeat(30)+ .into_bytes(),+ "notes.txt",+ "gif",+ ),+ (+ "gif89a-prose",+ "GIF89a is the version string of the second GIF spec. "+ .repeat(30)+ .into_bytes(),+ "notes.txt",+ "gif",+ ),+ (+ "bm-prose",+ "BM is the two byte magic that opens a Windows bitmap file. "+ .repeat(30)+ .into_bytes(),+ "notes.txt",+ "bmp",+ ),+ (+ "gif8-csv",+ b"GIF8,name,value\n1,alpha,2\n3,beta,4\n5,gamma,6\n7,delta,8\n".to_vec(),+ "t.csv",+ "gif",+ ),+ ] {+ let p = Path::new(name);+ let sn = sniff_bytes(&bytes, p, p, false).unwrap();+ assert_eq!(+ sn.family,+ Family::Binary,+ "{label}: if this now says text, #380 has been fixed — delete \+ this module, drop the CHANGELOG known-issue bullet, clear the \+ remaining `#380` mentions in this file (`grep -n '#380'`), and \+ close the issue"+ );+ assert_eq!(+ sn.binary_kind.as_deref(),+ Some(kind),+ "{label}: pinned so a change in WHICH wrong answer is given is \+ also caught"+ );+ }+ }+}+#[cfg(test)]mod tests {use super::*;