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
Merge remote-tracking branch 'origin/main' into fix/issue-204-fallback-sweep
xerj-orgb4306a11b07f
diff --cc CHANGELOG.mdindex e2dc2404f,4c45bf407..6bd31b162--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -153,376 -178,211 +178,579 @@@ and this project adheres to [Semantic Vfrom the moment it is allowlisted. Seed the target with snapshot/restorefirst if it needs the existing documents.+### Changed++- **BREAKING — `PUT /{index}` now refuses an `analysis` block XERJ cannot+ honour, instead of accepting it and analysing differently**+ ([#204](https://github.com/xerj-org/xerj/issues/204)).+ `AnalyzerRegistry::apply_settings` is total by design (it also runs when an+ existing index is opened, where a hard failure would brick it), so an+ unresolvable tokenizer silently became `standard` and an unresolvable token+ filter was dropped — the index was created, `GET /_settings` echoed the block+ back, and the field was analysed in a way nobody asked for. Index creation+ now validates the block and answers `400` with the exact constructs it cannot+ build. `PUT /{index}/_settings` with an `analysis` block is likewise refused+ (it only ever changed what `GET /_settings` echoed; the registry is built+ once, at create/open, and there is no rebuild path — Elasticsearch also+ refuses analysis updates on an open index). That refusal covers every+ spelling this handler *accepts*, not just the nested one: the flat dotted+ `{"index.analysis.analyzer.x.type": "custom"}` and half-dotted+ `{"index": {"analysis.analyzer.x.type": "custom"}}` forms that ES clients+ routinely send used to walk straight past it into the display copy, and+ `GET /_settings` then echoed back an analyzer that analysed nothing.++ **This rejects settings blocks that XERJ used to accept with a `200`, and the+ ES-YAML conformance suite does not cover them — CI being green is not+ evidence that your index still creates.** What is honoured:++ | | honoured (still `200`) |+ |---|---|+ | `analysis.filter.*.type` | `synonym`, `length`, `shingle`, `asciifolding` |+ | `analysis.tokenizer.*.type` | `ngram`, `edge_ngram`, `pattern` |+ | `analysis.analyzer.*.type` (non-custom) | any name the built-in registry resolves — measured: `standard`, `english`, `whitespace`, `keyword` |+ | `analysis.char_filter` | nothing — the char-filter slot is hard-coded empty |+ | `analysis.normalizer` | nothing — never built |++ Anything else in those positions is now a `400`. There is one important+ exception to read first: XERJ resolves a declared filter or tokenizer by+ **name**, not by `type`, so a declaration whose *name* is a built-in is still+ honoured whatever its type says. Measured, all still `200`:+ `{"english_stop": {"type": "stop", "stopwords": "_english_"}}`,+ `{"lowercase": {"type": "lowercase"}}`,+ `{"stemmer"|"english_stemmer": {"type": "stemmer", "language": "english"}}`+ — the canonical Elasticsearch-docs `rebuilt_english` block among them, which+ has a regression test pinning it. Naming a built-in analyzer on a field+ (`"analyzer": "english"`) needs no `analysis` block at all and is unaffected.++ What now fails is a declaration under a name that does NOT resolve — which is+ the usual ES habit of naming filters after what they do in *your* index.+ Measured blocks that returned `200` in rc.14 and return `400` from this+ release:++ - a `keyword` field's `normalizer` (any);+ - a `char_filter` (any, including `html_strip` and `mapping`), declared+ either under `analysis.char_filter` or as an analyzer's `char_filter`;+ - a custom-named token filter whose `type` is `lowercase`, `stop`, `stemmer`,+ `snowball`, `kstem`, `porter_stem`, `ngram`, `edge_ngram`,+ `word_delimiter_graph`, `trim`, `unique`, `elision`, `decimal_digit`,+ `apostrophe`, `limit`, `truncate`, `pattern_replace`, `keyword_marker`,+ `uppercase` or `reverse` — e.g. `{"my_lowercase": {"type": "lowercase"}}`,+ which never lowercased anything, because the analyzer referencing+ `my_lowercase` found no such filter and dropped it;+ - a custom-named tokenizer whose `type` is `standard`, `whitespace`,+ `keyword`, `classic`, `uax_url_email`, `path_hierarchy`, `char_group`,+ `letter`, `lowercase` or `simple_pattern`;+ - an analyzer whose non-custom `type` is `simple`, `stop`, `pattern`,+ `fingerprint`, or a language other than `english`;+ - a `synonym` filter whose `synonyms` is a bare string rather than an array+ (it built a filter with zero rules).++ **The gate covers every spelling, at create as well as at update.** An+ `analysis` declaration written with flat dotted keys+ (`{"index.analysis.filter.my_lower.type": "lowercase"}`) or half-dotted ones+ (`{"index": {"analysis.analyzer.a.type": "custom"}}`) is the same request as+ the nested form to an Elasticsearch client, and this handler already parses+ dotted keys for other settings (`index.sort.field`). The analyzer registry+ resolves the nested spellings only, so a dotted declaration was accepted,+ echoed back by `GET /{index}/_settings`, and applied to nothing. It is now a+ `400` naming the offending key, on both `PUT /{index}` and+ `PUT /{index}/_settings`. Measured on this release, the same+ `my_lower`/`lowercase` declaration in four spellings — nested, `index.`-+ namespaced, fully dotted, half-dotted — answers `400`, `400`, `400`, `400`;+ a settings body with no analysis in it (`index.number_of_shards`,+ `index.sort.field`) still answers `200`. Nothing already on disk changes+ meaning: the dotted form is refused, not newly honoured, so no existing+ index's analysis is re-derived on reopen.++ **Upgrading:** there is no opt-out flag. Either remove the analysis block and+ name a built-in analyzer on the field (`"analyzer": "english"`), or keep only+ the constructs in the table. The `400` names every offending construct in one+ response, so one round-trip is enough to see the whole list. **Two paths are+ not covered and still accept these blocks silently: an index template's+ `template.settings.analysis` is dropped wholesale before the gate ever sees+ it, and option-level divergence inside a supported type (`synonyms_path`,+ `length.min`, `asciifolding.preserve_original`) is not checked at all.**++- **BREAKING — `PUT /_ingest/pipeline/{id}` refuses processor configuration+ XERJ cannot honour, so a pipeline that used to be acknowledged can now be a+ `400`, and a stored one can start refusing writes**+ ([#204](https://github.com/xerj-org/xerj/issues/204)). This is the same+ change as the "`200 acknowledged` … means we will run this" entry under+ *Fixed* below, stated from the upgrader's side, because it converts `201`+ into `400` for any pipeline using an ES processor or option this build does+ not implement. Read that entry for the full list.++ **What is NOT broken, deliberately.** A definition persisted by a build with+ **no gate** was accepted by whichever build wrote it, and there is no caller+ left to answer `400` at boot. Boot replay therefore compiles *those*+ definitions in a compatibility mode that reproduces the previously shipped+ behaviour for every check this sweep added (unknown `grok` pattern name,+ unknown `convert` target, a bare string where an array is required,+ `set.copy_from`, a processor-level `if`/`on_failure`/`ignore_failure`), so+ **an upgrade alone never turns a running cluster's writes from `201` into+ `400`**. Each one is logged at ERROR naming the pipeline and the offending+ config, and recorded in `Engine::degraded_pipelines`; a re-`PUT` of the same+ definition answers `400` with the same reason, which is the repair path. A+ definition that did not compile before the upgrade either (unknown stage+ type, missing required field) still fails at boot and is recorded unrunnable,+ as before.++ **Which definitions those are is decided by provenance, not by the calendar.**+ A definition THIS build refused at `PUT` time is recorded in+ `<data_dir>/ingest-pipeline-refusals.json` and replayed at *definition*+ strictness, so the refusal survives a restart. Without that marker the replay+ could not tell "written by an older, laxer build" from "written by this build+ and answered `400`", and a plain restart overturned the answer the operator+ had already been given: measured, `PUT` a `{"remove": {"field": "secret"}}`+ pipeline, add an `if` guard to it (refused — every write `400`s), restart the+ node and nothing else, and the identical write answered `201` with `secret`+ dropped from a document the guard EXCLUDES. It covered every check the sweep+ added; only an unimplemented *stage* survived a restart, because the raw ES+ body it stores does not deserialise. This is the same pattern as an index's+ `<index>/analysis-binding.json`: the marker's ABSENCE is the load-bearing+ signal.++ The marker is provenance, not a tombstone. A marked definition that compiles+ cleanly on the new build — because that build implements what the refusing+ one could not — clears its own marker at boot and runs, with an INFO line; a+ successful re-`PUT` or a `DELETE` clears it too. If the file exists but+ cannot be read or parsed, no pipeline's provenance is known, so **every**+ persisted pipeline is replayed at definition strictness and any that fails is+ recorded unrunnable with the file named in the reason — fail closed and+ loudly, rather than silently reopening the hole. **In that state a refusal is+ also not acknowledged:** the file is written whole from the in-memory map,+ which a failed load leaves empty, so the next refused `PUT` would have+ replaced it with a one-entry map and erased every refusal it still held —+ after which it parses cleanly, every earlier refusal reads as "no provenance",+ and the fail-closed behaviour converts itself into the hole it exists to+ close after exactly one process lifetime. `PUT /_ingest/pipeline/{id}` now+ answers `500` naming the file instead, and the file is left byte-for-byte as+ found; move it aside and restart to clear the state. An older binary reading a+ data dir written by this one simply ignores the file; it is a sidecar+ precisely because `cluster_state.json`'s format-1 envelope is+ `deny_unknown_fields` and widening it would break downgrades.++ **The marker survives concurrent refusals, not just sequential ones.** The+ sidecar is rewritten whole, so two refused `PUT`s in flight at once were a+ lost update rather than a merge: each snapshotted the map, and whichever+ wrote second with the older snapshot erased the other's marker — while both+ callers were told `{"acknowledged": true}`. Measured at a live node against+ the first cut of this work: 40 concurrent refused `PUT`s, 40 acknowledged, 37+ markers on disk, and after a plain restart the three that were lost answered+ `201` and dropped `secret` from a document their `if` guard excludes. The+ snapshot and the write now happen under the same `cluster_state_write` mutex+ that `flush_cluster_state` has always taken. Measured on this release: 40+ concurrent refused `PUT`s, 40 acknowledged, 40 markers on disk, plain restart,+ 40 of 40 still `400`.++ The same rule applies one level up. Teaching the analysis resolver the+ canonical `settings.index.analysis` nesting (see the analysis entry above) is+ a fix at index *create* and a data bug at index *open*: `settings.json` keeps+ the caller's nesting verbatim, so an index created before this release with+ the canonical shape has postings that were written with `standard`, and+ honouring the declaration on reopen would tokenise every new write+ differently from everything already on disk. An index now records the+ analysis binding it was created with (`<index>/analysis-binding.json`) and+ keeps it for life. An index with no marker and analyzers declared *only*+ under `index.analysis` keeps the legacy binding if it holds documents — with+ an ERROR naming the index and saying a reindex is the repair — and adopts the+ canonical binding if it is empty, recording that so a later restart cannot+ disagree.+### Fixed+- **`200 acknowledged` on an ingest pipeline now means "we will run this", and+ every write path enforces it**+ ([#204](https://github.com/xerj-org/xerj/issues/204)).+ `PUT /_ingest/pipeline/{id}` used to store the raw body first and only+ warn-log a compile failure, so a pipeline that could never run was+ acknowledged and echoed back by `GET`. It now compiles first, with three+ outcomes: compiled → stored and acknowledged; a processor config we refuse →+ `400`; a processor or option this build cannot honour → accepted (as+ Elasticsearch does) but recorded as **unrunnable**, so the write refuses+ rather than storing an untransformed document.++ Defects this surfaced, each of which answered `200`/`201` and did something+ smaller than asked: **every** ES `rename` processor failed to compile (the+ handler emitted `{from, to}`, the plugin requires `{mappings: {…}}`) and+ renamed nothing; ES `append` was executed as `set`, replacing the field+ instead of extending it, and disagreeing with `_simulate`, which implemented+ a real append; an ES `set` processor did not override an existing value where+ Elasticsearch does (the ES→XERJ translation now writes `"override": true`+ explicitly when the processor omits it — the **native** `type: "set"` stage+ keeps its long-standing `override: false` default, because native definitions+ are recompiled from `cluster_state.json` at every boot and flipping the stage+ default would have changed what an already-running cluster's pipelines do to+ documents on a binary upgrade alone); an unknown `pii_redaction` type built an+ empty pattern set and redacted nothing; an unknown `grok` pattern name+ silently became the+ catch-all; an unknown `convert` target left the field unconverted per+ document; array-typed keys given as a bare string were dropped and the stage+ behaved as if unconfigured; and `DELETE /_ingest/pipeline/{id}` removed the+ definition while leaving the compiled pipeline live under the same name.+ ES `convert` `long`/`double` now map to XERJ's equivalent `integer`/`float`+ rather than being refused.++ Two more of the same, at the definition's own edges: a **pipeline-level**+ `on_failure` block (the top-level body key, not the processor-level one) was+ accepted, echoed by `GET`, and never run — the pipeline is now recorded+ unrunnable, exactly as its processor-level twin already was; and `set` with+ Elasticsearch's `copy_from` is reported as an unsupported *option* (accepted+ at `PUT`, refused at the write) rather than as `mapper_parsing_exception:+ missing value`, which told the caller their valid ES pipeline was malformed.++ **The refusal reads the value, not the key.** A processor-level option is+ refused only when what the caller *wrote* asks for behaviour this build does+ not have; writing the value XERJ already implements is the same as omitting+ it. `ignore_failure: false` is Elasticsearch's own default and ES clients emit+ it verbatim — a presence check made that pipeline register and then `400`+ every write through it, while the byte-identical processor without the key+ indexed fine. Accepted: `ignore_failure: false`, an empty `on_failure: []`,+ `ignore_missing: true` (which is exactly what `remove`/`rename`/`convert`/+ `date` already do — they pass the document through unchanged when the field+ is absent), `ignore_empty_value: false`, `allow_duplicates: true`. Refused:+ the opposite value in each case, and any `if` at all. (Modelled on Lucene's+ consume-then-complain: `AbstractAnalysisFactory.getBoolean(args, name,+ default)` at `lucene/core/src/java/org/apache/lucene/analysis/AbstractAnalysisFactory.java:213-217`+ removes the key and returns the default only when it was absent, and+ `ArabicStemFilterFactory` at+ `lucene/analysis/common/src/java/org/apache/lucene/analysis/ar/ArabicStemFilterFactory.java:44-51`+ then throws on whatever is left. Lucene is Apache-2.0, the same licence as+ XERJ; no code is reproduced.)++ **`remove` and `rename` no longer walk around the gate.** Their ES→XERJ+ translation built a fresh config object holding only the translated keys, so+ a processor-level `if` / `on_failure` / `ignore_failure` / `ignore_missing` on+ them was dropped *before* the gate ran: `{"remove": {"field": "secret", "if":+ "ctx.tenant == 'a'"}}` compiled, was acknowledged, and dropped the field on+ every document — while the identical `if` on `set` was refused. Every branch+ of the translation now edits the caller's config instead of rebuilding it.++ **`_simulate` speaks Elasticsearch's vocabulary again.** It walks the+ *stored* pipeline, and once ES `rename` started compiling the stored form+ became XERJ's internal `stages` shape — whose stage names leaked straight into+ the response, so `processor_type` read `field_rename` where ES reports+ `rename`. The stages→processors conversion now inverts both halves of the+ translation, name and config.++- **`GET /_ingest/pipeline[/{id}]` answers in Elasticsearch's `processors`+ vocabulary instead of XERJ's internal `stages` shape**+ ([#204](https://github.com/xerj-org/xerj/issues/204)). Two shapes reach the+ store: the translated `stages` body (everything that compiles) and the raw ES+ body (kept verbatim for a definition XERJ stores but cannot run). Only the+ second was ever ES-shaped, so `GET` spoke XERJ's vocabulary for every pipeline+ that *worked* — measured before this release, an ES `rename` pipeline came+ back as+ `{"p":{"description":"d","stages":[{"type":"field_rename","config":{"mappings":{"a":"b"}}}]}}`.+ This is a wire-visible change on both `GET /_ingest/pipeline/{id}` and+ `GET /_ingest/pipeline`. It also mattered beyond cosmetics: `GET`'s output is+ what an operator edits and `PUT`s back, and a `stages`-shaped body takes the+ handler's pass-through branch — which is exactly how the restart hole+ described under *Changed* was reached in ordinary use.++ `set` is rendered with an explicit `"override"`, always, because it is the one+ key whose default differs between the two vocabularies (Elasticsearch `true`,+ XERJ's native `set` stage `false`). Emitting a bare ES `set` for a native+ stage would claim it overwrites when it preserves. A pipeline created through+ `PUT /_ingest/pipeline` therefore shows `"override": true` even when the+ caller omitted it — that is the value XERJ applies, and it round-trips: PUTting+ `GET`'s own output back cannot silently flip the stage's behaviour. Relatedly,+ `_simulate`'s `set` interpreter honoured no `override` at all and always+ overwrote, so it reported a document the ingest path would never produce; it+ now applies Elasticsearch's rule (default `true`; `false` leaves an existing+ non-null value alone).++ **This is also the only read endpoint for a pipeline created through+ `PUT /v1/pipelines/{name}`** — the native surface registers no `GET` — so the+ round trip has to be lossless in xerj's own vocabulary too, and it was not.+ `PUT /_ingest/pipeline/{id}` rebuilt the stored definition as+ `{description, stages}` and dropped every other top-level key, so PUTting+ `GET`'s own output back silently discarded a natively-defined pipeline's+ `on_error` and `timeout_ms`: the error policy reverted from `pass` (keep the+ document) to the `Drop` default (discard it) under a+ `200 {"acknowledged": true}`. The translation now edits the body instead of+ rebuilding it — the same rule already applied to `remove`/`rename` one level+ down. Measured on this release, `{"description":"n3","on_error":"pass",+ "timeout_ms":250,"stages":[…]}` reads back with both keys intact, and PUTting+ that body back leaves them intact, before and after a restart. Elasticsearch's+ own pipeline metadata (`version`, `_meta`, `deprecated`) rides along the same+ way and is now echoed back rather than dropped. `PUT /v1/pipelines/{name}`+ given that ES-shaped body used to answer `500` with `internal error: missing+ field stages`; it now answers `400` naming `/_ingest/pipeline/{name}` as the+ endpoint that accepts it.++- **Four wire-visible refusals that were fixed in this sweep but not written+ down** ([#204](https://github.com/xerj-org/xerj/issues/204)). All four+ replace a silent fallback with an error, which is the point of the issue, but+ each changes a status code:+ `POST /v1/admin/backup` answers `400` on a request body that is present but+ unparseable, where it previously ran a *default* backup under a success+ response; `GET /{index}/_stats` and `GET /_all/_stats` carry an added+ non-Elasticsearch key `primaries.mappings.schema_persist_failures` inside an+ otherwise ES-shaped response; the authorization layer's response pruning+ answers `500` when it cannot parse the body it was asked to filter, instead+ of falling back to the unfiltered bytes; and the bundled console's+ `DELETE /_xerj-console/api/v1/auth/passkeys/{id}` propagates a failed delete+ instead of discarding it — it answered `204 No Content` unconditionally, so a+ revoke refused by the engine (index write block, disk flood stage, storage+ error) reported success while the passkey stayed on disk and kept+ authenticating. An already-absent credential is still a `204`; only a genuine+ failure now surfaces.++ **The refusal now covers every ingest path, not only `PUT /{index}/_doc`.**+ `POST /_bulk?pipeline=`, `index.default_pipeline` under `_bulk`,+ `_reindex` `dest.pipeline` and `POST /{index}/_update_by_query?pipeline=`+ previously read the instruction and dropped it — a redaction pipeline that+ the single-document endpoint refused was ignored in bulk, and the document+ was stored verbatim under `errors: false`. All four now run the pipeline, and+ refuse when it cannot run. `_reindex` and `_update_by_query` validate the+ name before touching a single document, so a bad pipeline fails the request+ instead of half of it.++ Two related honesty fixes on the same paths: `_clone` / `_shrink` / `_split`+ copied at most 10,000 documents and swallowed every per-document write error+ before answering `{"acknowledged": true}` (now full keyset paging, and any+ failed write — or a failed source flush — fails the request); and a failed+ `_bulk` item no longer reports `"result": "deleted"` alongside its own+ `status: 400`, which claimed a deletion that never happened.++ **`ignore_missing: false` is refused on purpose, and it is not the same call+ as `ignore_failure: false`.** Both are Elasticsearch defaults that ES clients+ emit verbatim, so the difference is worth stating plainly: the rule is *accept+ the value this build actually implements*, and the two land on opposite sides+ of it. `ignore_failure: false` means "a failing processor is not ignored",+ which is exactly what XERJ does, so it is accepted. `ignore_missing: false`+ means "FAIL the document when the field is absent", which XERJ cannot do at+ all — `ProcessAction` has no error variant, and every field-reading stage+ passes the document through untouched. Accepting it would be precisely the+ silent lie this issue exists to remove, so it is refused: a `remove` /+ `rename` / `convert` / `date` processor that spells out `ignore_missing:+ false` registers and then `400`s every write through it. **Omitting the key+ is accepted** and behaves as `true`. That asymmetry — omission accepted,+ the ES default written out refused — is deliberate but is a hard `400` for+ ES-generated pipelines; strip the key, or set it to `true`, to state what+ XERJ will actually do. `ignore_empty_value` is the mirror image: omitting it+ or writing `false` is honoured exactly, `true` is refused.++ **Known gaps, stated rather than closed:** `_simulate` interprets the stored+ ES body directly and covers processors the compiled path does not, so a+ pipeline recorded as unrunnable can still show a transformation under+ `_simulate` that ingest refuses to perform; `GET /_ingest/pipeline/{id}`+ carries no runnability signal — it renders the stored definition in ES+ vocabulary whether or not this build can run it, so an operator only learns+ at write time; a write addressed to an **alias** does not pick up the+ backing index's `default_pipeline`; `_update_by_query` reports a `drop`+ processor as a per-document failure, because it updates in place and has no+ delete path; `Engine::degraded_pipelines` is in-memory only and has no+ HTTP surface yet, so a boot-replay degradation is visible in the startup log+ and nowhere else — unlike a definition-time refusal, which is now durable+ (see *Changed*); and a refusal marker is only read back at boot, so a data+ dir opened by two processes at once is outside what the sidecar can promise+ (the node lock already prevents that).++ - **Unity assets were sampled through a 4 MiB cap, silently junking whole+ object classes.** Unity YAML is a grouped family — each `unity_class` is its+ own dataset and a class's first document can sit anywhere in a scene that+ `extract/unity.rs` itself says can exceed 200 MB. A class first appearing+ past the cap was never sampled, got no entry in the plan, and phase B then+ had nowhere to route its records: they became `file_junk` with nothing said.+ The cap is now 512 MiB for this family, **and** any record whose group was+ never sampled is now reported by name and count instead of silently counted+ as junk.++ - **A `script_guid` that failed to resolve produced no counter, no warning and+ no report line.** `build_unity_guid_map` discarded `extract_meta`'s `Result`,+ so an unreadable `.meta` was indistinguishable from a script nothing+ references — on the feature's own headline query. Unreadable sidecars,+ sidecars carrying no usable guid, and unresolvable `script_guid`s are now+ each reported.++ - **`script_path`/`script_class` were mapped only when the phase-A sample+ happened to contain a `script_guid`**, while phase B stamps them whenever a+ guid resolves. A cluster whose sampled window held no `m_Script` therefore+ got them dynamic-mapped at index time, feeding the field-budget overshoot in+ #312. They are now registered for every Unity cluster, and the enrichment+ runs *before* `coerce_record` rather than after it, so the fields it stamps+ are validated like every other field instead of bypassing coercion.++ - **`build_unity_guid_map` ran serially, unmetered, on the critical path of+ every run** — including a resumed no-op incremental, which otherwise has no+ work to do. A real Unity project has 10k-500k `.meta` sidecars. It now runs+ on `crate::pool` under the progress meter (the unattributed-stretch pattern+ of #241).++ - **A `--stub` file was named from the content path**, which under durable+ preparation is a content-addressed blob — so every stub's one and only field+ would have been titled after a blob ordinal (the #294 failure class).+ It now uses `Sniffed::logical_name`.++ - **`order::band_from_family_str` disagreed with `order::band`.** The string+ form's catch-all ranked `binary` as `Bulk` where the enum form ranks it+ `Vendored`, so a resumed run could order work differently from the run that+ planned it. Both now agree for every family, pinned by a test that iterates+ the whole enum.++ - **The autoindex use-case README documented three flags and behaviours that+ do not exist.** `--no-default-excludes` and `--no-gitignore` are spelled+ `--no-default-ignores` and `--no-ignore`, and `cli::parse` hard-errors on an+ unknown argument — so a reader who copied the documented invocation got an+ error instead of an index. The marker-gated pruning of `node_modules/` and+ `target/` was described but had been dropped from the branch. A test now+ parses every `--flag` named in that README and fails if the CLI would reject+ it.++ - **`stub_matcher_tests::an_invalid_pattern_fails_loudly_at_startup` did not+ test its own name** — it asserted only that a *valid* pattern compiles.+ `glob_to_regex` escapes every metacharacter, so no glob can produce a+ syntactically invalid regex; the one reachable failure is the compiled-size+ limit, which `?` and `**` reach at ~10^5 characters. Over-long patterns are+ now rejected explicitly with a message naming the flag and the limit, and the+ test exercises that path.++ ### Changed++ - **Two proposed byte-statistics binary heuristics were dropped before they+ shipped; raw TGA is detected by its header instead.** Both were attempts to+ recognise a raw texture that decodes into printable characters, and both+ turned out to be tests for "not written in Latin script".++ The first, from PR #274, classified any text over 4 KiB with under 5%+ whitespace as binary. `nonblank` is built from `text.lines()`, so newlines+ are already stripped and only intra-line whitespace counts — which means+ Chinese, Japanese, Korean, Thai, Lao, Khmer and Burmese prose, base64 blobs,+ FASTA sequences and minified single-line files all score 0%. This repo's own+ `failure_resume_http_tests::legacy_key_collision_fails_before_visibility_with_scoped_guidance`+ builds a 65,537-byte fixture of one repeated ASCII letter; with that guard+ reinstated the test fails with `left: 3, right: 0` — the run exits 3 instead+ of 0.++ The second was introduced by the first attempt to reland #274 and is+ **removed here**: "decoded via lossy windows-1252 AND over 30% non-ASCII is+ pixel soup". windows-1252 is the fallback every legacy 8-bit codepage decodes+ through, so it is not a test for image data. Measured through `sniff()` on+ `ca4d75a` versus that branch, with identical fixtures:++ | fixture | `ca4d75a` | with the guard |+ |---|---|---|+ | windows-1251 Russian, 13,000 B | `txt-prose` | `binary` |+ | KOI8-R Russian, 13,000 B | `txt-prose` | `binary` |+ | windows-1253 Greek, 12,200 B | `txt-prose` | `binary` |+ | windows-1255 Hebrew, 11,000 B | `txt-prose` | `binary` |+ | windows-1256 Arabic, 10,800 B | `txt-prose` | `binary` |+ | Shift-JIS Japanese, 22,401 B (byte pad 1; likewise pad 3) | `txt-prose` | `binary` |+ | Shift-JIS Japanese + ASCII code, 13,360 B | `txt-lines` | `binary` |+ | Shift-JIS Japanese + ASCII code, 66,800 B | `txt-lines` | `binary` |++ `scan_file` turns `Family::Binary` into `junk: binary content (unknown)`, so+ each of those files stopped being indexed. A `looks_like_legacy_cjk` escape+ hatch shipped with it and could not carry the weight: single-byte codepages+ never form valid Shift-JIS/GBK/Big5/EUC-KR double-byte pairs, so Cyrillic,+ Greek, Hebrew and Arabic were never rescued at all; it required a *lossless*+ trial decode while `sniff()` sees only the first 8192 bytes, so the same+ Japanese document was text at byte-offset pads 0 and 2 and binary at pads 1+ and 3; and a realistic Japanese technical document (prose around ASCII code+ fences) sits below its 30% ideograph floor while sitting above the guard's+ 30% non-ASCII ceiling. Every fixture in the table above now classifies+ exactly as it does on `ca4d75a`.++ What replaces it is `looks_like_tga_header`: TGA has no magic number, but its+ 18-byte header is constrained enough that bytes 1 and 2 of the file must both+ be control characters. **Headerless raw payloads (`.raw`, `.bytes`,+ uncompressed PCM) still classify as text**, exactly as they do on `ca4d75a`.+ Bounding what a magic-less binary costs is the fix for that and is not+ attempted here — see [#381](https://github.com/xerj-org/xerj/issues/381);+ `for_each_section` already streams, so the unbounded quantity is the record+ count, not resident memory.++ - **The new magic-byte signatures now require structural confirmation.** Nine+ signatures (PSD, both TIFF byte orders, RIFF, OGG, FLAC, MP3, FBX and EXR)+ were added by the first reland attempt as bare `starts_with` tests. **Six** of+ them are entirely printable ASCII — `8BPS`, `RIFF`, `OggS`, `fLaC`, `ID3` and+ the 18 letters `Kaydara FBX Binary` — so they matched ordinary text. Measured+ through the real `sniff()` on `ca4d75a` vs this branch with identical+ fixtures:++ | fixture | `ca4d75a` | first reland |+ | --- | --- | --- |+ | CSV whose first column header is `ID3` | `csv` | `binary`/`mp3` |+ | prose opening `RIFF is a container format used by WAV files. …` | `txt-prose` | `binary`/`riff` |+ | prose opening `OggS pages carry the packets of an Ogg stream …` | `txt-prose` | `binary`/`ogg` |+ | prose opening `fLaC is the four byte magic of a FLAC audio …` | `txt-prose` | `binary`/`flac` |+ | prose opening `8BPS is the magic of an Adobe Photoshop …` | `txt-prose` | `binary`/`psd` |+ | `.md` note opening `Kaydara FBX Binary is the 20-byte magic …` | `txt-prose` | `binary`/`fbx` |++ Each of the six is now qualified by what must follow it: PSD version, RIFF+ FORM type, Ogg stream-structure version, FLAC block type, ID3v2 major version+ and synchsafe size, and for FBX the full 23-byte header (`Kaydara FBX+ Binary`, two spaces, NUL, `0x1A`, `0x00`). The FBX case was missed by the+ first pass at this fix and caught in review — at 18 printable characters it is+ the likeliest of the six to open a real sentence, and likeliest precisely+ inside the Unity/3D-asset corpus this feature targets. Every fixture in the+ table above now classifies exactly as it does on `ca4d75a`. The true positives+ are unchanged and still covered; the FBX true-positive fixture was corrected+ to the real 23-byte header, which is what any Autodesk tool emits.++ This is what Lucene's `CodecUtil.checkHeader` does with `CODEC_MAGIC`+ (`lucene/core/src/java/org/apache/lucene/codecs/CodecUtil.java:183`, which+ hands straight to `checkHeaderNoMagic` at `:202` and refuses the file unless+ the codec name *and* a version in range follow — the magic alone is never+ taken as proof). Apache-2.0, same licence as XERJ; adapted, not copied.++ **Not fixed here, deliberately:** `GIF8` and `BM` are printable-ASCII+ signatures with exactly the same defect, but they are **pre-existing** — they+ are unchanged from `ca4d75a`, and prose opening `GIF8`/`GIF89a`, a CSV whose+ first column header is `GIF8`, and prose opening `BM` were each measured to+ classify as `binary`/`gif` and `binary`/`bmp` on `ca4d75a` **and** on this+ branch, identically. Fixing them changes behaviour unrelated to Unity, so it+ 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+ whole-file junk entry while leaving `send_err` unset — so the file also+ reached `journal.file_done`, and both passes wrote `catalog::file_doc` under+ the same `file:{file_key}` id into the same bulk. The junk document landed+ second and won: a file that indexed records was reported in the catalog as+ status `junk` with `records: 0`, `files_junk` counted it, and+ `CodeCoverage::observe` ran for it twice. Reachable with no Unity involved,+ via a >64 MiB SQL dump whose first row for some table starts past+ `SQLDUMP_SAMPLE_LIMIT`. The unsampled group is now reported on the progress+ meter instead, the dropped records stay on that file's own completion where+ they already were, and the disjointness the code claimed in a comment is now+ enforced at the one place that holds both sets (`shadowed_junk_entries`).++ ### Known issues++ - `ref_guids` (Unity) and `joints` (BVH) are multi-valued keyword arrays, and+ #332 means array elements are joined into one FTS token, so a post-flush+ `term`/`match` on a single element does not hit. `script_guid`,+ `script_path` and `script_class` are single-valued and unaffected, so the+ documented "which scenes use this script?" query is not impacted. Fixing+ #332 is an engine-side change to the FTS writer input type.++ - **`GIF8` and `BM` are still unqualified printable-ASCII magic signatures**, so+ a text file whose first characters are `GIF8`, `GIF89a` or `BM` is classified+ `binary` and junked. This is **pre-existing, not introduced here** — measured+ identical on `ca4d75a` and on this branch (`binary`/`gif` and `binary`/`bmp`+ in both) — and is left unchanged because fixing it is a behaviour change with+ no Unity content. Both names are recorded here on purpose: `BM` is the+ 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-13Both rc.15 known issues (the progress-stream forgery and the outer-`.gitignore`