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 origin/main into fix/issue-283-junk-shrink-invariant

xerj-orga6c41235e335
diff --cc engine/crates/xerj-autoindex/src/state.rs
index 0ec49d909,511a74001..d1d6d8588
--- a/engine/crates/xerj-autoindex/src/state.rs
+++ b/engine/crates/xerj-autoindex/src/state.rs
@@@ -565,19 -564,12 +564,24 @@@ fn read_plan_for_preflight
}
}
Some(kind) if crate::sync::is_sync_record_kind(kind) => {
+ // Same contract as the authoritative replay in
+ // `open_after_preflight` (#283): this preflight runs first, so
+ // an invariant that leaks here bare is the one the user sees.
- crate::sync::replay_record(&value, &mut committed_manifest, &mut pending_sync)
- .with_context(|| {
- format!(
- "the durable {kind} record at byte {record_start} in {} failed to \
- replay; the generation journal is not internally consistent, \
- and re-running will not repair it. No remote data was changed. \
- Rebuild with a new --state-dir and a new --prefix",
- path.display()
- )
- })?;
+ crate::sync::replay_durable_record(
+ &value,
+ record_bytes,
+ &mut committed_manifest,
+ &mut pending_sync,
- )?;
++ )
++ .with_context(|| {
++ format!(
++ "the durable {kind} record at byte {record_start} in {} failed to \
++ replay; the generation journal is not internally consistent, \
++ and re-running will not repair it. No remote data was changed. \
++ Rebuild with a new --state-dir and a new --prefix",
++ path.display()
++ )
++ })?;
if matches!(kind, "sync_bootstrap" | "sync_commit") {
plan = committed_manifest
.as_ref()
@@@ -850,26 -841,12 +853,27 @@@ impl Journal
embedding_identity_resumable = resumable;
}
Some(kind) if crate::sync::is_sync_record_kind(kind) => {
+ // A durable record that no longer re-validates
+ // is unrepairable by re-running; surface the
+ // rebuild route instead of a bare internal
+ // invariant, keeping the invariant as the
+ // cause (#283).
- crate::sync::replay_record(
+ crate::sync::replay_durable_record(
&v,
+ record_bytes,
&mut committed_manifest,
&mut pending_sync,
- )?;
+ )
+ .with_context(|| {
+ format!(
+ "the durable {kind} record at byte {record_start} in {} \
+ failed to replay; the generation journal is not \
+ internally consistent, and re-running will not repair \
+ it. No remote data was changed. Rebuild with a new \
+ --state-dir and a new --prefix",
+ jpath.display()
+ )
+ })?;
if matches!(kind, "sync_bootstrap" | "sync_commit") {
plan = committed_manifest
.as_ref()