Skip to content

fix(rg): skip indexed prefilter for --crlf searches#1753

Merged
chaliy merged 1 commit into
mainfrom
2026-05-25-propose-fix-for-rg-crlf-issue
May 25, 2026
Merged

fix(rg): skip indexed prefilter for --crlf searches#1753
chaliy merged 1 commit into
mainfrom
2026-05-25-propose-fix-for-rg-crlf-issue

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 25, 2026

Motivation

  • The indexed prefilter (try_indexed_search) could run when --crlf is enabled, but SearchQuery has no CRLF-aware flag, allowing indexed providers to incorrectly omit candidate files and cause false-negative matches for patterns like needle$ on CRLF files.
  • The change forces fallback to the linear CRLF-aware matching path to preserve correctness when CRLF semantics are requested.

Description

  • Disable the indexed prefilter for CRLF-aware searches by adding || opts.crlf to the early-return conditions in try_indexed_search in crates/bashkit/src/builtins/rg/mod.rs.
  • Add a regression test test_rg_crlf_skips_indexed_prefilter_and_falls_back_to_linear_scan that constructs an IndexedTestFs with no index matches and verifies rg --crlf 'needle$' still finds the CRLF-terminated line via the linear scan.
  • Adjusted the test assertion to match actual rg output for the linear path (needle\r\n).

Testing

  • Ran the added test with cargo test -p bashkit test_rg_crlf_skips_indexed_prefilter_and_falls_back_to_linear_scan -- --nocapture, which initially surfaced the failing expectation and then passed after the assertion fix.
  • Ran the package test suite; the new test passed and the test run completed without failures.

Codex Task

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 25, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit c950eb6 Commit Preview URL May 25 2026, 02:41 AM

@chaliy chaliy merged commit 28ad8d6 into main May 25, 2026
34 checks passed
@chaliy chaliy deleted the 2026-05-25-propose-fix-for-rg-crlf-issue branch May 25, 2026 15:01
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