Skip to content

Avoid content-bearing sorts in line-local find - #5425

Merged
Widthdom merged 4 commits into
mainfrom
fix-issue5415
Sep 23, 2026
Merged

Widthdom merged 4 commits into
mainfrom
fix-issue5415

Conversation

@Widthdom

@Widthdom Widthdom commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Line-local literal/regex find previously sorted chunk content in SQLite before yielding the first line. It now selects chunk metadata in index order, or in 64-row keyset pages on older indexes, and fetches source content separately per chunk. Overlap ownership, missing-source failures, counts, scan limits and continuation positions are preserved without a schema migration or reindex.

The legacy sort retains only bounded scalar metadata. Legacy pages and the NULL-content compatibility check may still scan file metadata; individual chunk content is still read in full. No peak-memory or latency benchmark is claimed.

Validation:

  • Release net8.0: 638 related find, cursor, bounded-output, envelope, response-budget and MCP regression tests passed with the current main integration.
  • Release net9.0: 628 passed; 10 existing framework/platform skips.
  • make lint passed.
  • Shared command-guard tests: 49 passed. Focused Release chunk-read regressions: 4 passed on each of net8.0 and net9.0 after the latest main integration.
  • Many-chunk regressions cover current/read-only legacy query plans, bounded pages, reversed insertion, overlaps, missing/live source, NULL content, literal/exact/trigram/regex variants and row/count replay.
  • Real-index query plan: the old query uses USE TEMP B-TREE FOR ORDER BY; the new ordered query uses idx_chunks_file_start_chunk_nonnull without a temporary sort.
  • dotnet run --project tools/CodeIndex.Changelog -- check and git diff --check passed.
  • Codex adversarial reviews: No blocking/actionable issues found. Coverage includes the bounded legacy metadata sort, formatting fix, and current main integration; the merge review verified that both parents' bilingual documentation was preserved and non-conflicting files match their respective parents.
  • Rebuilt the local CLI, refreshed the root index after the commit, and verified both root and workspace status checks are healthy.

Documentation is updated in English and Japanese in docs/find-scan-controls.md and TESTING_GUIDE.md. Changelog fragment: changelog.d/unreleased/5415.fixed.md.

Fixes #5415

@Widthdom
Widthdom merged commit 78850cb into main Sep 23, 2026
11 checks passed
@Widthdom
Widthdom deleted the fix-issue5415 branch September 23, 2026 00:07
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.

Avoid content-bearing temporary sorts in line-local find chunk reads

1 participant