Skip to content

fix(search): preserve dynamic scan ordering#13

Merged
siriusctrl merged 1 commit into
fix/search-appends-v061from
review/search-appends-v061
Jul 22, 2026
Merged

fix(search): preserve dynamic scan ordering#13
siriusctrl merged 1 commit into
fix/search-appends-v061from
review/search-appends-v061

Conversation

@siriusctrl

Copy link
Copy Markdown
Owner

Summary

Independent review fixes for #12's dynamic search-span state machine.

  • defer independent Inserted history during forward wrap until the true older boundary is loaded
  • prioritize a newly appended range during backward search when an earlier append was only partially consumed
  • fill bounded search chunks across short ViewFile::read_window results, and reject zero/oversized reads instead of consuming the wrong coordinates
  • add focused regressions for huge tail records, multi-append ordering, exact insert boundaries, reset-tail/prefix order, short reads, and index rebuild/ordinal shifts

Root causes

A forward search starting at loaded line zero could consume a multi-chunk initial tail before the first older insert. With no Wrapped span to absorb that insert, the new Inserted span was scanned before the source's true prefix was known.

A backward search consumes an appended span from its high end. After partial consumption, a later append is no longer contiguous with that remainder and must be queued before it; the previous insertion point queued it after the older remainder.

A short reverse read_window returns the low side of the requested range, while the span consumer removes from the high side. Repeating bounded reads to fill the chunk keeps inspected and consumed coordinates identical.

Review evidence

The backward at == span.end boundary is covered directly: an inserted range is visited before the remaining wrapped span. The real nonzero reset boundary is also covered end-to-end: backward search visits the reset tail before its lazily inserted prefix. This path was already ordered correctly because the reset tail's Appended span stays above the insertion boundary.

Validation

  • cargo fmt --all --check
  • cargo check --workspace --all-targets --locked
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo test --workspace --all-targets --locked
  • cargo test --workspace --doc --locked
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked
  • git diff --check origin/fix/search-appends-v061...HEAD
  • benches/load-performance.sh --samples 1 --case timeline

Timeline smoke medians: tail open 0.676 ms, older prepend 1.640 ms, append refresh 2.404 ms, follow refresh/render 2.966 ms.

Defer independently inserted older history until a forward search reaches the true source prefix, and prioritize newer append ranges during backward scans even after an earlier append was partially consumed.

Fill bounded search windows across short ViewFile reads so reverse scans cannot consume different coordinates than they inspected. Add regressions for huge tail records, multi-append ordering, reset boundaries, short reads, and search-index rebuilds.
@siriusctrl
siriusctrl marked this pull request as ready for review July 22, 2026 11:09
@siriusctrl
siriusctrl merged commit d1f5365 into fix/search-appends-v061 Jul 22, 2026
1 check passed
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.

1 participant