8000 fix(corpus): retire stale index generations; never read a failed listing as empty by xerj-org · Pull Request #1156 · xerj-org/xerj · GitHub
[go: up one dir, main page]

Skip to content

fix(corpus): retire stale index generations; never read a failed listing as empty - #1156

Merged
xerj-org merged 2 commits into
mainfrom
fix/corpus-generation-hygiene
Oct 5, 2026
Merged

xerj-org merged 2 commits into
mainfrom
fix/corpus-generation-hygiene

Conversation

@xerj-org
@xerj-org xerj-org commented Oct 5, 2026
Copy link
Copy Markdown
Owner

Closes #1136.

Both halves of the leak, measured on the corpus-hub nodes:

  1. Legacy runs never retired anything. A corpus whose state names no build re-indexed under the bare xc-<corpus> namespace and left every stamped generation live forever (tldr-pages: an unstamped 38,554-doc generation beside two stamped ones; kafka-protocol: ~120 indices; unicode-cldr: 2.18M docs). Since the ledger names no build, those generations are unreachable by construction while xerj code queries the namespace — a measured top-5 mixed current-mirror and dead-clone hits.
  2. A listing the node never answered read as "nothing to retire". corpus_indices swallowed list_indices errors into an empty Vec; the build arm verified its replacement and retired an empty set in silence.

Changes (xerj corpus index / xerj code):

  • A successful legacy run now retires every live xc-<name>-b<stamp>-* index by exact name plus one catalog-scope delete per generation; its own unstamped output is kept.
  • corpus_indices returns (indices, listed_ok); every arm says loudly when the node never answered a listing and retires nothing.
  • Every verified --fresh swap ends with an epilogue that re-lists the namespace and names whatever sits outside the prefix readers are pinned to (the issue's visibility knob).
  • xerj code prints a stderr notice when a corpus has no verified build recorded and the query widens to the whole namespace.

One deliberate deviation from the issue's fix direction: index_prefix=null is warned-at, not refused — seven corpora run in legacy state today and their only index is the bare namespace; refusing would break seven working corpora to close a leak the retirement fix already drains.

Tests: three new FakeNode cases (legacy retirement + per-generation catalog deletes, never-answered-listing deletes nothing blind, refused delete named by the epilogue); 47/47 xc tests, xerj-common green, fmt + clippy clean. The ES wire path is untouched — this PR's conformance run is the gate.

…ing as empty

Issue #1136, both halves of the leak, measured on the corpus-hub nodes:

1. LEGACY RUNS NEVER RETIRED ANYTHING. A corpus whose state file names no
   build (legacy mode, or a lost state file beside live indices) re-indexed
   under the bare xc-<corpus> namespace and left every stamped generation
   live forever. Measured: tldr-pages carried an unstamped 38,554-doc
   generation beside b1790965276-* (3,111) and b1791124662-* (4,706);
   kafka-protocol ~120 indices across three generations; unicode-cldr
   2.18M docs. Because the ledger names no build, those stamped
   generations are unreachable BY CONSTRUCTION while xerj code queries
   the namespace — a top-5 was measured mixing current-mirror and
   dead-clone hits, failing 3 of 5 grade resolutions.

   Now: after a successful legacy run, every live xc-<name>-b<stamp>-*
   index is retired by exact name plus its catalog scope (one per
   generation, BTreeSet-deduped). The run's own unstamped output is kept.

2. A LISTING THE NODE NEVER ANSWERED READ AS 'NOTHING TO RETIRE'.
   corpus_indices swallowed list_indices errors into an empty Vec; the
   build arm then verified its replacement and retired an empty set in
   silence. Now corpus_indices returns (indices, listed_ok); the build
   arm says loudly that nothing will be retired, the post-failure
   cleanup says it kept rather than deleted blind, and the legacy arm
   skips its retirement with a message instead of a shrug.

Visibility (#1136 knob 3): every verified --fresh swap ends with an
epilogue that re-lists the namespace and NAMES whatever sits outside the
prefix readers are pinned to (first 5 + count) — a half-failed retire is
now on sight instead of a poison the next G7-grade query measures. And
xerj code prints a stderr notice when a corpus has no verified build
recorded, since the query then widens to the whole namespace (stdout is
the parsed hit list, so the notice goes to stderr).

Deliberate deviation from the issue's fix direction: index_prefix=null is
warned-at, not refused. Seven corpora run in legacy state today and their
only index IS the bare namespace; refusing would break seven working
corpora to close a leak the retirement fix already drains.

Tests (FakeNode harness, xc::tests): a legacy run retires stamped
generations and keeps its own index, with exactly one catalog delete per
generation; a never-answered listing retires nothing and deletes
nothing blind; a refused delete leaves the old generation live under the
new epilogue. 47/47 xc tests pass; xerj-common green; fmt + clippy clean.
The ES wire path is untouched — the PR's conformance run is the gate.

Files:
- crates/xerj-autoindex/src/xc.rs (corpus_indices, stamped_prefix,
  retire_stamped, report_leftovers, corpus_index_flow build/legacy arms)
- crates/xerj-common/src/xccode/mod.rs (legacy widening notice)
@cla-bot cla-bot Bot added the cla-signed label Oct 5, 2026
@xerj-org
xerj-org merged commit a6b3d43 into main Oct 5, 2026
22 checks passed
Ravandevil25 pushed a commit to Ravandevil25/xerj that referenced this pull request Oct 6, 2026
- engine 1.0.0-rc.82 -> 1.0.0-rc.83 (Cargo.toml + cargo update -w, 17 lock entries)
- landing: data-latest-tag + all 91 footer brand spans -> RC.83 (the xerj-org#1155 guard now enforces this at cut)
- CHANGELOG: rc.83 section — xerj-org#1155 (version-roll guard + xxhash 0.8.19), xerj-org#1153 (xerj-org#1145/xerj-org#1148), xerj-org#1156 (xerj-org#1136), xerj-org#1154, xerj-org#1159 (EPUB), xerj-org#1160 (redundant-overlap section), xerj-org#1161 via xerj-org#1162 (notebooks + data-file naming)
- ROADMAP: cut-roll — shortlist re-verified live: 8 open (xerj-org#1091 xerj-org#1092 xerj-org#1094 xerj-org#1100 xerj-org#1146 xerj-org#1147 xerj-org#1158 xerj-org#1122); xerj-org#1136/xerj-org#1145/xerj-org#1148 closed in-window, de-linked here and moved to CHANGELOG; rc.83 paragraph in the GA window record
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

corpus namespace: stale index generations survive --fresh swaps and state files with index_prefix=null query all of them

1 participant

0