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.

fix(autoindex): #346 — surface files-skipped-after-plan-freeze distinctly, not below the noise floor

xerj-org319b7f06aa45
diff --git a/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rs b/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rs
index cddb5d447..b971e2ae2 100644
--- a/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rs
+++ b/engine/crates/xerj-autoindex/src/failure_resume_http_tests.rs
@@ -823,6 +823,11 @@ fn a_rerun_after_an_added_file_succeeds_and_fresh_absorbs_it() {
assert_eq!(code, 3);
let report = report.unwrap();
assert_eq!(report["files_junk"], 1, "{report}");
+ // #346: the file that appeared after the plan was frozen is surfaced
+ // DISTINCTLY as `skipped_appeared`, not just folded into `files_junk`, so a
+ // "make the index match the tree" re-run can see the index is incomplete
+ // instead of reading as an ordinary completed-with-junk success.
+ assert_eq!(report["skipped_appeared"], 1, "{report}");
// `records_total` is the live server-side count (#195), so it still reports
// the record the first run published. What must be zero is the run-local
// counter: this rerun indexed nothing, because the frozen plan cannot
diff --git a/engine/crates/xerj-autoindex/src/lib.rs b/engine/crates/xerj-autoindex/src/lib.rs
index e34206c83..9c6e00db6 100644
--- a/engine/crates/xerj-autoindex/src/lib.rs
+++ b/engine/crates/xerj-autoindex/src/lib.rs
@@ -4473,6 +4473,15 @@ pub fn run_index_report(cfg: IndexCfg) -> Result<(i32, Option<Value>)> {
stay idempotent)",
);
}
+ // #346: the count of files that appeared after the resume plan was frozen
+ // (and so were skipped, never indexed) is surfaced DISTINCTLY below — in the
+ // run summary and the terminal `xerj-done` line — not just as a mid-stream
+ // note folded into the generic `junk_files` total. Folding it in leaves a
+ // "make the index match the tree" re-run reading as an ordinary
+ // completed-with-junk success while the index is in fact incomplete, which
+ // is the below-the-noise-floor reporting #346 is about. Captured here before
+ // `new_unplanned` is drained into `plan.junk_files`.
+ let skipped_appeared = new_unplanned.len();
if resumed_with_plan {
// Legacy journals predate intent-before-publication and may have live
// partial records without either file_done or file_replace_start.
@@ -5933,6 +5942,13 @@ pub fn run_index_report(cfg: IndexCfg) -> Result<(i32, Option<Value>)> {
run_doc["catalog_alias_sweep_failed_paths"] = json!(alias_sweep_failed);
run_doc["catalog_alias_sweep_error"] = json!(error);
}
+ // #346: present only when files appeared after the plan was frozen, so a
+ // healthy run document is unchanged and any reader finding this key knows
+ // the index is incomplete for that many files (distinct from unparseable
+ // `junk`).
+ if skipped_appeared > 0 {
+ run_doc["skipped_appeared"] = json!(skipped_appeared);
+ }
push_doc(&format!("run:{run_id}"), &run_doc, &mut cat_buf);
if !cat_buf.is_empty() {
@@ -6116,6 +6132,12 @@ pub fn run_index_report(cfg: IndexCfg) -> Result<(i32, Option<Value>)> {
alias_sweep_failed.len() as u64,
));
}
+ // #346: surface files-skipped-because-they-appeared-after-freeze on the
+ // terminal line, distinct from `junk_files`, so a re-run whose index is
+ // silently incomplete is visible instead of below the noise floor.
+ if skipped_appeared > 0 {
+ done_fields.push(("skipped_appeared", skipped_appeared as u64));
+ }
pr.finish(
true,
code,