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
fix(autoindex): make --no-graph --dry-run refuse a changed option (#2684) (#2692)
Jake Elbirt59a461741625
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 39c45d495..fac84924e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -160,6 +160,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0generation state is not internally consistent", although the state wasintact and the original options still updated the corpus (#2577).+- `xerj autoindex --no-graph --dry-run` now refuses a changed option the way+ the real run does, naming the option, instead of printing a plan and exiting+ 0 for a run that would then be refused. The `--max-minutes` note on this+ route recommends `--dry-run` as the way to check a plan first (#2684).+## [1.0.0-rc.100] - 2026-10-26**rc.100: faster autoindex and search, shaped by your field reports.** Thisdiff --git a/engine/crates/xerj-autoindex/src/incremental_reconcile_http_tests.rs b/engine/crates/xerj-autoindex/src/incremental_reconcile_http_tests.rsindex 67df308fa..528ab8161 100644--- a/engine/crates/xerj-autoindex/src/incremental_reconcile_http_tests.rs+++ b/engine/crates/xerj-autoindex/src/incremental_reconcile_http_tests.rs@@ -7457,3 +7457,70 @@ fn changed_option_is_refused_before_sealing_and_named() {}assert_eq!(endpoint.data_docs().len(), 2);}++/// #2684: the `--dry-run` preview of a `--no-graph` rerun must refuse a+/// changed option the way the real run does. It used to print the plan (or+/// "already describes this folder") and exit 0 for a run that the real+/// command then refused, although this route's `--max-minutes` note points+/// callers at `--dry-run` to check a plan first.+#[test]+fn dry_run_refuses_a_changed_option_like_the_real_run() {+ let _guard = HTTP_E2E_LOCK.lock().unwrap_or_else(|p| p.into_inner());+ let _replay_guard = sync_executor::REPLAY_FAILPOINT_TEST_LOCK+ .lock()+ .unwrap_or_else(|p| p.into_inner());+ let corpus = tempfile::tempdir().unwrap();+ let state_dir = tempfile::tempdir().unwrap();+ fs::write(corpus.path().join("a.csv"), "id,value\n1,alpha\n").unwrap();+ let endpoint = HttpEndpoint::start();+ let config = cfg(corpus.path(), state_dir.path(), &endpoint.url, false);+ assert_eq!(run_index(config.clone()).unwrap(), 0);+ let bulks = endpoint.data_bulk_requests();+ let snapshots = snapshot_names(state_dir.path());+ let journal_before = fs::read(state_dir.path().join("journal.ndjson")).unwrap();++ let mut sample = config.clone();+ sample.sample += 1;+ sample.dry_run = true;+ let mut symlinks = config.clone();+ symlinks.follow_symlinks = true;+ symlinks.dry_run = true;+ let cases = [+ (sample, "build fingerprints them differently (--sample"),+ (symlinks, "--follow-symlinks was off and is now on"),+ ];+ for (changed, named) in cases {+ // Both preview arms: an unchanged folder and an edited one.+ for edit in [false, true] {+ let rows = if edit {+ "1,alpha\n2,edit\n"+ } else {+ "1,alpha\n"+ };+ fs::write(corpus.path().join("a.csv"), format!("id,value\n{rows}")).unwrap();+ let error = format!("{:#}", run_index(changed.clone()).unwrap_err());+ let context = format!("edit={edit}: {error}");+ assert!(+ error.contains("execution configuration changed since the committed generation"),+ "{context}"+ );+ assert!(error.contains(named), "{context}");+ assert_eq!(endpoint.data_bulk_requests(), bulks, "{context}");+ assert_eq!(snapshot_names(state_dir.path()), snapshots, "{context}");+ assert_eq!(+ fs::read(state_dir.path().join("journal.ndjson")).unwrap(),+ journal_before,+ "{context}"+ );+ }+ }++ // The preview with the committed options still works on both arms.+ let mut dry = config.clone();+ dry.dry_run = true;+ assert_eq!(run_index(dry.clone()).unwrap(), 0);+ fs::write(corpus.path().join("a.csv"), "id,value\n1,alpha\n").unwrap();+ assert_eq!(run_index(dry).unwrap(), 0);+ assert_eq!(endpoint.data_bulk_requests(), bulks);+ assert_eq!(journal_events(state_dir.path(), "sync_commit"), 1);+}diff --git a/engine/crates/xerj-autoindex/src/lib.rs b/engine/crates/xerj-autoindex/src/lib.rsindex 9d8ac5624..76ebce6f3 100644--- a/engine/crates/xerj-autoindex/src/lib.rs+++ b/engine/crates/xerj-autoindex/src/lib.rs@@ -6352,6 +6352,52 @@ fn contract_identity_changes(Ok(changes)}+/// #2577: refuse a `--no-graph` run whose options differ from the ones the+/// committed generation pinned. Runs before the reconcile plan is projected;+/// the real run and its `--dry-run` preview share it (#2684).+fn refuse_changed_no_graph_options(+ base: &sync::CommittedManifest,+ cfg: &IndexCfg,+ root_identity: &str,+) -> Result<()> {+ match &base.execution {+ Some(expected) => refuse_execution_changes(+ base.generation,+ no_graph_option_changes(expected, cfg, root_identity)?,+ ),+ None => Ok(()),+ }+}++/// #2577: refuse a projected plan whose schema, index or embedder identity+/// differs from the committed generation's. Shared by the real run and its+/// `--dry-run` preview (#2684); only reads from the node.+fn refuse_changed_planned_execution(+ es: &Es,+ base: &sync::CommittedManifest,+ plan: &Plan,+) -> Result<()> {+ let Some(expected) = &base.execution else {+ return Ok(());+ };+ refuse_execution_changes(base.generation, contract_identity_changes(expected, plan)?)?;+ if plan+ .datasets+ .iter()+ .any(|dataset| dataset.semantic_field.is_some())+ {+ let current = es.embedding_execution_identity()?;+ ensure_embedding_execution_unchanged_and_resumable(+ ¤t,+ &expected.embedding_identity_sha256,+ &expected.embedding_backend,+ expected.embedding_dimension,+ &expected.embedding_semantic_contract,+ )?;+ }+ Ok(())+}+fn refuse_execution_changes(generation: u64, changes: Vec<String>) -> Result<()> {if changes.is_empty() {return Ok(());@@ -9431,6 +9477,9 @@ fn run_index_report_inner(.committed_manifest.as_ref().context("branch guard proved a committed manifest")?;+ // #2684: preview the refusal the real run below would make, rather+ // than a plan it will not commit.+ refuse_changed_no_graph_options(base, &cfg, &root_str)?;let mut plan = project_reconcile_plan(&inventory,&base.plan,@@ -9441,6 +9490,7 @@ fn run_index_report_inner(tally,)?;record_unreadable_skips(&mut plan, &inventory.unreadable);+ refuse_changed_planned_execution(&es, base, &plan)?;let unchanged = serde_json::to_value(&plan)? == serde_json::to_value(&base.plan)?;let sizes = inventory_size_map(&inventory);let changed_bytes = if unchanged {@@ -9515,13 +9565,9 @@ fn run_index_report_inner(// #2577: refuse a changed option before reconciling or sealing// anything. Both arms below require these fields to match; the// changed arm used to find out only after copying the corpus, as a- // false "state not internally consistent" error.- if let Some(expected) = &base.execution {- refuse_execution_changes(- base.generation,- no_graph_option_changes(expected, &cfg, &root_str)?,- )?;- }+ // false "state not internally consistent" error. The `--dry-run`+ // preview above runs the same two checks (#2684).+ refuse_changed_no_graph_options(&base, &cfg, &root_str)?;let mut plan = project_reconcile_plan(&inventory,&base.plan,@@ -9532,23 +9578,7 @@ fn run_index_report_inner(tally,)?;record_unreadable_skips(&mut plan, &inventory.unreadable);- if let Some(expected) = &base.execution {- refuse_execution_changes(base.generation, contract_identity_changes(expected, &plan)?)?;- if plan- .datasets- .iter()- .any(|dataset| dataset.semantic_field.is_some())- {- let current = es.embedding_execution_identity()?;- ensure_embedding_execution_unchanged_and_resumable(- ¤t,- &expected.embedding_identity_sha256,- &expected.embedding_backend,- expected.embedding_dimension,- &expected.embedding_semantic_contract,- )?;- }- }+ refuse_changed_planned_execution(&es, &base, &plan)?;// Say out loud that the decision gate is not on this route. It is an// incremental reconcile of an already-committed generation, so the work// is the *changed* set and is published from a sealed snapshot rather