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 unblock-258-local

xerj-org84749615d760
diff --cc CHANGELOG.md
index 0277b7723,ef625a381..a1928ccaa
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -98,68 -29,55 +98,117 @@@ and this project adheres to [Semantic V
`pdf_extraction_reuse` block so the behaviour is observable rather than
inferred from timing. Original work by Leonid Bugaev (@buger).
+ ### Changed — autoindex refuses reruns that would strand documents
+
+ - **Deleting an indexed file and rerunning `xerj autoindex` now fails instead
+ of exiting 0.** Nothing in the pipeline removes the documents, aliases,
+ graph edges or catalog entries that the deleted file published, so a rerun
+ that ignored the deletion left them live and searchable with no source file
+ behind them. The rerun is now refused before any remote call other than the
+ endpoint-readiness ping: no mapping, delete-by-query, bulk, refresh, graph
+ or catalog write is attempted, and the journal is not appended to. The error
+ names the removed files and their content keys — the first ten, then an
+ `… and N more` tail, since a whole unmounted subtree can vanish at once —
+ and gives three recovery routes: restore the files and rerun, rebuild in
+ place by deleting the named indices and the state directory, or rebuild
+ under a new state directory, prefix and brain. `--fresh` is refused for the
+ same case, because it does not delete those documents either. `--json` emits
+ the same facts — every removed entry, uncapped — as
+ `xerj.autoindex.unsupported_sync_delta.v1` on stdout with exit 1. Deleting a
+ file that was only ever *skipped* is not refused: a junk file publishes no
+ documents, and the stale junk-catalog sweep removes its one catalog row, so
+ nothing is stranded.
+ - **Files added after a plan was frozen are now called out on stderr.** They
+ are still not indexed by a rerun that resumes an existing plan — the plan is
+ a crash-resume boundary, not a folder-sync generation — but the run now
+ lists them, records them as skipped (exit 3, completed-with-junk) and points
+ at `--fresh`, which rebuilds the plan in place and picks them up. Adding or
+ changing files and rerunning keeps working; only removals are refused.
+ - **`xerj brain` no longer turns an absent or zero node-count probe into an
+ automatic reset.** Journal/server disagreement now fails with the journal,
+ URL, prefix, and brain identity plus recovery instructions, including the
+ explicit `--fresh` rerun for a genuinely wiped data directory. Probe
+ transport and malformed-response failures remain errors instead of being
+ reported as an empty destination. A nodes index that was deleted out from
+ under a surviving brain meta doc reads as absence and reaches that recovery
+ text, rather than surfacing as a raw HTTP 404.
+ - **`--fresh` still recovers a state directory whose journal cannot be
+ parsed.** The rerun gate reads the durable plan before the run starts, and a
+ plan that is malformed, or recorded for a different root/URL/prefix, is fatal
+ to a resume — but not to `--fresh`, which deletes that journal unread. The
+ preflight is now no more fatal than the open it precedes: under `--fresh` the
+ unreadable plan is reported on stderr and rebuilt from the current folder.
+ Without `--fresh` the refusal is unchanged. Because the removal gate has no
+ comparison basis in that case, the warning says so: documents already
+ published for files that are now gone cannot be identified from an unreadable
+ plan and are not deleted.
+ - **Refusal and skip listings are capped at ten entries plus an "and N more"
+ tail.** Unmounting a bind mount under an indexed root vanishes every content
+ group at once, so the uncapped listing was one rendered entry per journalled
+ file. `--json` still carries every entry.
+
+### 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; `set.override` defaulted to `false` where Elasticsearch
+ defaults it to `true`; 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 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.
+
+ **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}`
+ returns the ES body with no runnability signal, so an operator only learns at
+ write time; a write addressed to an **alias** does not pick up the backing
+ index's `default_pipeline`; and `_update_by_query` reports a `drop`
+ processor as a per-document failure, because it updates in place and has no
+ delete path.
## [1.0.0-rc.14] - 2026-08-10