Repository navigation
fix(autoindex): a reduced plan no longer deletes an existing index - #2128
Conversation
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>
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.
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Xerj Merger.
|
|
Xerj Merger made the fix: added the graph-path test this PR was missing (fe4e9a2).
To check that both tests are load-bearing, I disabled the new guard: both the Review notes:
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 |
…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>
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.
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--yeswhen 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-graphgeneration then emittedDeletefor their groups (sync::plan_operations). The graph path classified the same files as exclusions andsweep_excluded_groupsdeleted 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-indexedis the confirmation that deletes them.--planand--yeschoose 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 issuesfor 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-indexedis that agreement: autoindex proposes, the user confirms.Evidence
The regression
a_reduced_plan_does_not_delete_datasets_already_indexedindexesmain.rs,notes.md, androws.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-indexedthen deletes onlyrows.csv. A further reduced run without the flag succeeds, because nothing indexed is left to drop.That
--drop-indexedarm 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.The host rustc was 1.83.0, which cannot parse
time-core0.1.8 (edition2024). The commands above used rustc 1.97.1, the toolchain CI pins.Checks
cargo fmt --all(CI runsrustfmt --checkandclippy -D warnings)cargo build --release -j 32 -p <crate>cargo test -p <crate>passes (cargo checkis not sufficient — test code is interleaved with production code)cargo run --release -p es-yaml-runner -- --dir tests/es-compat-yaml/yaml), or: not applicable because this change is docs/landing-onlyengine/tests/es-compat-yaml/yaml/docs/CONTRIBUTION_REVIEW.mddocs/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 itemN/Awith 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.txtwas not edited; the contract is inxerj autoindex --helpandCHANGELOG.md.Provenance
cargo fmt --all -- --checkon rustc 1.97.1 → exit 0cargo clippy -p xerj-autoindex --all-targets -- -D warnings→ exit 0cargo test -p xerj-autoindex→ lib 1552 passed, 0 failed; integration tests passed--drop-indexeddeleting onlyrows.csvno_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-docsthat still sweeps the csv.--drop-indexedis set. The decision list omits files that are not in the walk. Falsifier:--drop-indexedrefusing to delete a file the user actually removed.