8000 fix(autoindex): a reduced plan no longer deletes an existing index by xerj-org · Pull Request #2128 · xerj-org/xerj · GitHub
[go: up one dir, main page]

Skip to content

fix(autoindex): a reduced plan no longer deletes an existing index - #2128

Merged
xerj-org merged 2 commits into
mainfrom
cursor/reduced-plan-keeps-index-0cfc
Oct 22, 2026
Merged

xerj-org merged 2 commits into
mainfrom
cursor/reduced-plan-keeps-index-0cfc

Conversation

@xerj-org
Copy link
Copy Markdown
Owner

Written by an AI coding agent (Grok 4.7, Cursor cloud agent). The account that opens this pull request is the reviewer of record.

A reduced disk-budget plan (--plan code-and-docs, or --yes when the default plan does not fit) was applied to the walk before reconcile. Files that plan left out were still on disk and, on a re-run, already published, but they were absent from the inventory. The --no-graph generation then emitted Delete for their groups (sync::plan_operations). The graph path classified the same files as exclusions and sweep_excluded_groups deleted their documents. Re-indexing a folder that was already fully indexed could silently drop the datasets the smaller plan excludes.

The run now stops before hashing when that would happen. Stdout is one JSON decision (xerj: autoindex-plan-removal, exit 4) listing the files and the datasets that would be left empty. --drop-indexed is the confirmation that deletes them. --plan and --yes choose what to index; they do not agree to the deletion. A file that is already gone from the folder is not part of this decision.

No existing issue turned up (gh search issues for the reduced-plan deletion). This environment's GitHub CLI cannot open issues, so none was filed.

What this changes, and why

PR #2102 chooses a reduced plan before hashing and retains only that plan's files. That filter sits in front of both reconcile paths and was not itself a deletion check, so a later run treated plan-excluded files as removed. A reduced plan must not delete data that is already indexed unless the operator agrees. Exit 4 plus --drop-indexed is that agreement: autoindex proposes, the user confirms.

Evidence

The regression a_reduced_plan_does_not_delete_datasets_already_indexed indexes main.rs, notes.md, and rows.csv, re-runs with --plan code-and-docs, and requires exit 4 with the csv documents, the journal bytes, the snapshot names, the delete-by-query count, and the data-bulk count unchanged. A full re-run after the refusal still reconciles. The same plan with --drop-indexed then deletes only rows.csv. A further reduced run without the flag succeeds, because nothing indexed is left to drop.

That --drop-indexed arm is the old filter-then-reconcile path. It deletes the csv, which is the mechanism the unconfirmed path used to take on every reduced re-run. I did not revert the gate and re-run the test against the unfixed tree.

rustup run 1.97.1 cargo fmt --all -- --check
# exit 0

rustup run 1.97.1 cargo clippy -p xerj-autoindex --all-targets -- -D warnings
# Finished `dev` profile, exit 0

rustup run 1.97.1 cargo test -p xerj-autoindex -- --test-threads=8
# lib: 1552 passed; 0 failed; 2 ignored
# integration tests passed (one live-feed test ignored)
# exit 0

The host rustc was 1.83.0, which cannot parse time-core 0.1.8 (edition2024). The commands above used rustc 1.97.1, the toolchain CI pins.

Checks

  • cargo fmt --all (CI runs rustfmt --check and clippy -D warnings)
  • Scoped release build of the crates touched: cargo build --release -j 32 -p <crate>
  • cargo test -p <crate> passes (cargo check is not sufficient — test code is interleaved with production code)
  • ES-YAML conformance suite at 0 failed (cargo run --release -p es-yaml-runner -- --dir tests/es-compat-yaml/yaml), or: not applicable because this change is docs/landing-only
  • New ES-compatible behaviour has a matching YAML case under engine/tests/es-compat-yaml/yaml/
  • Docs updated if user-visible behaviour changed
  • For non-trivial changes: the applicable audit in docs/CONTRIBUTION_REVIEW.md
  • For non-trivial changes: if this PR changes an operational document or runnable recipe, complete the operational audit in docs/CONTRIBUTION_REVIEW.md. Record a negative control that exits non-zero with no artifact extracted, installed, published, or served. Keep verification and its action in one block; rerun the control with the failing exit discarded and with the next documented block appended, and require that neither reaches an artifact or unsafe/privileged path. List tested variants and unsupported variants separately, and verify every publication copy. Otherwise mark this item N/A with a reason.

Not run: release build (cargo build --release -p xerj-autoindex). Debug tests and clippy cover the crate; a release rebuild was not needed to observe the refusal. ES-YAML is N/A: this is the autoindex client, not the engine wire protocol, and there is no new ES-compatible response. Operational-recipe audit is N/A: no install, publish, or serve recipe changed. landing/llms.txt was not edited; the contract is in xerj autoindex --help and CHANGELOG.md.

Provenance

  • Written by: AI agent (Grok 4.7, Cursor cloud agent), run by the account that opens this pull request, who has to review it
  • Verified (commands run, output observed):
    • cargo fmt --all -- --check on rustc 1.97.1 → exit 0
    • cargo clippy -p xerj-autoindex --all-targets -- -D warnings → exit 0
    • cargo test -p xerj-autoindex → lib 1552 passed, 0 failed; integration tests passed
    • The regression above, including the refusal leaving journal bytes and documents unchanged and --drop-indexed deleting only rows.csv
  • Assumed (not tested, and what would falsify it):
    • The graph path (no_graph: false) is protected by the same return, which is before the shared keep-set filter. Falsifier: a graph-path re-run with --plan code-and-docs that still sweeps the csv.
    • A genuine on-disk deletion during the same reduced run is still reconciled once --drop-indexed is set. The decision list omits files that are not in the walk. Falsifier: --drop-indexed refusing to delete a file the user actually removed.
Open in Web Open in Cursor 

A folder indexed in full, then re-run with --plan code-and-docs (or --yes
when the default plan does not fit), filtered the walk before reconcile.
Files the plan left out were still on disk and already published, but they
were absent from the inventory. The --no-graph generation then emitted
Delete for their groups; the graph path classified them as exclusions and
swept their documents.

Stop before hashing when that would happen. Stdout is a JSON decision
(exit 4) listing the files and the datasets that would be left empty.
--drop-indexed is the confirmation that deletes them. --plan and --yes
choose what to index and do not agree to the deletion.

Verified on rustc 1.97.1: cargo fmt --all -- --check, cargo clippy -p
xerj-autoindex --all-targets -- -D warnings, and cargo test -p
xerj-autoindex (1552 lib tests, 0 failed). The regression indexes
rs+md+csv, refuses the reduced re-run with the journal and documents
unchanged, then deletes only the csv after --drop-indexed.

Co-authored-by: xerj-org <xerj-org@users.noreply.github.com>
@cla-bot cla-bot Bot added the cla-signed label Oct 22, 2026
The PR's HTTP test covers --no-graph only. The default graph path keeps the
prior plan in plan.json and deletes through its exclusion sweep, so it gets
its own test: a reduced --plan exits 4 with nothing deleted, --yes does not
agree, and --drop-indexed removes the csv while code and prose stay. Both
HTTP tests fail with the guard disabled.
@cla-bot
cla-bot Bot commented Oct 22, 2026
Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Xerj Merger.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@cla-bot cla-bot Bot removed the cla-signed label Oct 22, 2026
@xerj-org
xerj-org marked this pull request as ready for review October 22, 2026 03:04
@xerj-org
Copy link
Copy Markdown
Owner Author

Xerj Merger made the fix: added the graph-path test this PR was missing (fe4e9a2).

a_reduced_plan_on_the_graph_path_does_not_delete_indexed_data runs the same scenario on the default graph path (no_graph: false), where the prior plan is the legacy plan.json and the deletion would come from the exclusion sweep:

  • a full index, then a re-run with --plan code-and-docs, exits 4 with nothing deleted (no DELETE or delete_by_query);
  • --yes with that plan also exits 4;
  • --drop-indexed removes the csv and keeps the code and prose.

To check that both tests are load-bearing, I disabled the new guard: both the --no-graph HTTP test and the graph HTTP test then fail.

Review notes:

  • The refusal happens before the journal opens for write, so a refused run commits no generation and seals no snapshot.
  • --drop-indexed is refused on watch/map/status and round-trips through the legacy-rebuild argv.

Local CI ran on main plus this PR plus the other release-bound PRs (#2123, #2124, #2125, #2126, #2127) and the release stamp: fmt, clippy -D warnings, cargo test --profile ci-test --workspace and the ES-YAML gate all passed.

@xerj-org
xerj-org merged commit f887ff4 into main Oct 22, 2026
22 of 24 checks passed
xerj-org added a commit that referenced this pull request Oct 22, 2026
…r sweep (#2136)

* release(rc.98): version stamp, CHANGELOG, ROADMAP roll, landing footer sweep

Window since v1.0.0-rc.97 (about 120 PR merges on main's first-parent line,
every one cited in [1.0.0-rc.98]; the release-notes gate passes locally).

Stamp: workspace 1.0.0-rc.97 -> 1.0.0-rc.98 (Cargo.toml + Cargo.lock).
CHANGELOG: [Unreleased] moves into [1.0.0-rc.98], plus the window's uncited
merges grouped by area; the rc.97 heading gets its tag date (2026-10-19).
ROADMAP review line + roll: open defects stay at five. Landing footer sweep
RC.97 -> RC.98, the data-latest-tag fallback, and the regenerated sitemap.

* release(rc.98): cite #2124, #2126 and #2127

* Merge main into release/rc98

* release(rc.98): one #2124 entry

* release(rc.98): intro names #2128 and #2126

* release(rc.98): regenerate sitemap after the merges

---------

Co-authored-by: Xerj Merger <merger@xerj.org>
Jarvis636431 added a commit to Jarvis636431/xerj that referenced this pull request Oct 22, 2026
Upstream merged xerj-org#2123, xerj-org#2124, xerj-org#2125 and xerj-org#2128 while the prefix work was
being validated. xerj-org#2125 changes the same mapping pre-read in xerj_search.
Resolve that overlap by keeping upstream's plain-query detection and
response demotion, while passing the already-validated prefix scope to the
mapping read. Preserve the upstream authorship and history through a merge.

Add a custom-prefix/code-corpus regression proving the test-path penalty
still applies. On the composed tree the MCP crate suite passes 123 tests
(116 library and 7 integration/schema tests); scoped strict Clippy passes.
The effective diff against upstream still contains only prefix support,
its tests, README/changelog text, and the generated schema. Build and
conformance evidence is recorded in the pull request.

Written by an AI coding agent (OpenAI Codex), run by Jarvis636431.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0