8000 test(es-compat): lock the filtered-alias by-query over-delete safety + _update_by_query aggregate deleted:0 (#553) by xerj-org · Pull Request #556 · xerj-org/xerj · GitHub
[go: up one dir, main page]

Skip to content

test(es-compat): lock the filtered-alias by-query over-delete safety + _update_by_query aggregate deleted:0 (#553) - #556

Merged
xerj-org merged 1 commit into
mainfrom
fix/553-filtered-alias-by-query
Aug 21, 2026
Merged

xerj-org merged 1 commit into
mainfrom
fix/553-filtered-alias-by-query

Conversation

@xerj-org
Copy link
Copy Markdown
Owner

Closes #553 (fast-follow to #450 / PR #552).

The gap this closes

The 3-skeptic verification of #552 confirmed — by code inspection — that a _delete_by_query through a filtered alias removes only the slice the filter names (never the whole backing index, the #524 hazard), because the alias filter is ANDed into the query applied to every member. But two skeptics independently flagged that no test exercises it: the load-bearing over-delete-safety property was verified only by reading.

The test

A match_all _delete_by_query through a filtered 2-member alias (hot, filter: status=active, over idx-a/idx-b, each holding one active + one archived doc) must:

  • report deleted: 2 (only the in-slice active docs), and
  • leave each member's archived (out-of-slice) doc intact.

Non-vacuous: without the filter, match_all would delete all 4 and empty both members — so the test fails loudly the moment the alias filter is ever dropped. It passes on current main (the #450 fix is correct).

Nit (also flagged by the skeptics)

aggregate_by_query_results now emits "deleted": 0 for _update_by_query, matching the single-member update body — previously the 2+-member update response dropped a field the 1-member body has.

Verification (rustc 1.98.0)

Full xerj-api suite 468 passed, 0 failed; fmt --check, clippy --workspace --all-targets -D warnings clean. Test-only + a 6-line response-consistency fix.

…_by_query aggregate deleted:0 (#553)

Fast-follow to #450/#552. The 3-skeptic verification confirmed the filtered-alias
over-delete safety by code inspection but flagged it was untested. This adds the
execution test: a match_all _delete_by_query through a filtered 2-member alias deletes
only the 2 in-slice (active) docs and leaves the 2 out-of-slice (archived) docs — the
#524 hazard. Non-vacuous: without the filter, match_all would delete all 4 and empty
both members.

Also fixes the flagged nit: aggregate_by_query_results now includes deleted:0 for
_update_by_query, matching the single-member update body (2+-member updates dropped it).
@cla-bot cla-bot Bot added the cla-signed label Aug 21, 2026
@xerj-org
Copy link
Copy Markdown
Owner Author

Independent 3-skeptic verification (each REFUTES, own worktree, rustc 1.98.0)

Verdict: 0 BLOCKING — all three refuted=false / severity=none. Two skeptics independently ran a counterfactual that broke the alias-filter path and confirmed the safety test flips to failure.

correctness (none): The test builds a truly FILTERED alias (PUT /{member}/_alias/hot with filter: {term:{status:active}}), spans 2 members, asserts deleted==2 AND each member _count==1 (keeps its archived doc). Vacuity probe: replacing the alias body with {} (unfiltered) made it FAIL with deleted:4 — the filter is load-bearing. The nit (es_compat.rs:24463-24465) fires only when count_key=="updated"; the delete path (count_key=="deleted") never enters it, so delete responses are unaffected.

regression-risk (none): Full cargo test -p xerj-api — 468 passed, 0 failed; clippy -D warnings clean. The 6-line aggregate change is purely additive and guarded; the single-member update body already emits "deleted":0, so the 2+-member aggregate now matches it exactly. Zero regressions.

evidence-holds (none): Counterfactual: forced resolve_by_query_targets to ignore alias_filters → the match_all delete drained all 4 docs (deleted:4, total:4, both indices emptied), flipping the assertion — exactly the #524 hazard it guards. Restored → deleted:2, archived docs survive. Single-member responses byte-for-byte unchanged.

Gate: (a) checks green, none pending; (b) 0 BLOCKING; (c) CLEAN. Merging.

@xerj-org
xerj-org merged commit d11d255 into main Aug 21, 2026
18 checks passed
buger pushed a commit to probelabs/xerj that referenced this pull request Aug 22, 2026
Newest tag is now v1.0.0-rc.25 (includes xerj-org#555 fix xerj-org#451 class-B alias fan-out + xerj-org#556 fix xerj-org#553
filtered-alias over-delete safety lock). Footer XERJ.AI stamps + llms*.txt 'Current release'
bumped rc.24 -> rc.25 across landing/ (48 files). landing-constants-guard passes with
VERSION=1.0.0-rc.25.
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.

test(es-compat): #450 fast-follow — lock the filtered-alias by-query slice (over-delete safety) + minor response consistency

1 participant

0