8000 fix(autoindex): open section overlap on a word by xerj-org · Pull Request #1700 · xerj-org/xerj · GitHub
[go: up one dir, main page]

Skip to content

fix(autoindex): open section overlap on a word - #1700

Merged
xerj-org merged 1 commit into
mainfrom
cursor/section-overlap-word-3c2c
Oct 20, 2026
Merged

xerj-org merged 1 commit into
mainfrom
cursor/section-overlap-word-3c2c

Conversation

@xerj-org
Copy link
Copy Markdown
Owner

What this changes, and why

A retrieval section repeats 200 bytes of the previous paragraph so a match that sits on the boundary is still in both records. That tail was a raw byte slice snapped only to a char boundary. The hard-split path already cuts on whitespace; the paragraph-overlap path did not.

On a full-history tokio index (xerj autoindex /tmp/tokio --prefix tokio, 861 files, 11,246 records), xerj search --prefix tokio "cargo install --locked cargo-fuzz" printed docs/contributing/pull-requests.md:205 starting with le to use in tests. The stored section body began inside the word available. The same shape showed up on the previous section of that file (he Cargo features).

The overlap tail now walks back at most 64 bytes to the previous word, or forward to the next word when the token is longer than that window. Text with no whitespace is unchanged, so an unbroken CJK or z run still splits on a char boundary.

Evidence

Before: the tokio search above (binary xerj v1.0.0-rc.96 at /tmp/xerj-main, node http://127.0.0.1:9210) returned a passage whose _passage.text started le to use with start_offset 0.

After: paragraph_overlap_opens_on_a_word fails on the old tail (the slice utilities available… opened at ilable) and passes after the snap. section_tests (17) still pass, including the pre-#239 byte-for-byte oracle, which calls the same tail.

cargo +1.97.1 test --locked -p xerj-autoindex --lib section_tests
# 17 passed
cargo +1.97.1 clippy --locked -p xerj-autoindex --all-targets -- -D warnings
# exit 0
rustup run 1.97.1 rustfmt --edition 2021 --check crates/xerj-autoindex/src/extract/mod.rs
# exit 0

Fresh index of the same tree, for context, not as a before/after of this fix (the fix is in the splitter, and the indexed node was the previous binary): xerj-done ok=true exit=0 reason=completed wall=7.0s files=861 records=11246 datasets=1.

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: cargo fmt --all (rustfmt --check on the one edited file, edition 2021, toolchain 1.97.1). Scoped release build not run; tests and clippy used the dev profile. ES-YAML not run: the sectioner does not change the wire. No YAML case: not an ES request-shape change. Docs not updated: the overlap length is not a documented contract. Operational-recipe audit N/A: no runnable recipe or operational doc changed.

Provenance

  • Written by: AI agent (Cursor Grok 4.7), run by the account that opens this PR
  • Verified (commands run, output observed): the tokio search passage above; section_tests 17 passed; clippy -D warnings exit 0; fresh autoindex wall=7.0s files=861 records=11246
  • Assumed (not tested, and what would falsify it): a re-index with this binary would store available to use rather than le to use. Falsified if paragraph_overlap_opens_on_a_word fails or a spaced paragraph section still begins mid-token.
Open in Web Open in Cursor 

@cla-bot cla-bot Bot added the cla-signed label Oct 17, 2026
A retrieval section repeats 200 bytes of the previous paragraph so a
match on the boundary stays in both records. That tail was a raw byte
slice, so a markdown section could begin in the middle of a token.
On tokio, xerj search for "cargo install --locked cargo-fuzz" printed
docs/contributing/pull-requests.md:205 starting "le to use in tests"
— the overlap had landed inside "available".

The overlap tail now
walks back at most 64 bytes to the previous word, or forward to the
next word when the token is longer than that window. A run of text
with no whitespace is unchanged.

Verified: cargo +1.97.1 test --locked -p xerj-autoindex --lib
section_tests (17 passed). cargo +1.97.1 clippy --locked -p
xerj-autoindex --all-targets -- -D warnings (exit 0).

Rebased onto main after #1730 reverted #1623, which had defined
WORD_SNAP_BYTES; the constant now lives with this fix, and the
hard-split test that came with #1623 is dropped.
@xerj-org
xerj-org force-pushed the cursor/section-overlap-word-3c2c branch from 52116b9 to bec73b6 Compare October 20, 2026 06:52
@xerj-org
xerj-org merged commit 84d7ec4 into main Oct 20, 2026
23 of 24 checks passed
@xerj-org
Copy link
Copy Markdown
Owner Author

Xerj Merger made the fix: reviewed. The 200-byte paragraph-overlap tail now starts on a word: it walks back up to 64 bytes to whitespace, or forward past a longer token. Text with no whitespace is unchanged, and paragraph_overlap_opens_on_a_word covers both paths. I rebased this onto main: #1730 had reverted #1623, which defined WORD_SNAP_BYTES, so the constant now ships with this fix, #1623's hard-split test is dropped, and the doc no longer claims the hard split cuts on whitespace. Verified locally at bec73b6, merged with main 5585819 (in a combined tree with #1861, #1910, #1886 and #1746): fmt, clippy -D warnings and cargo test --profile ci-test --workspace are all green. That run was ahead of the CI backlog, on the owner's instruction.

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.

1 participant

0