fix(rg): skip indexed prefilter for --no-unicode non-literal queries#1747
Merged
chaliy merged 1 commit intoMay 25, 2026
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 2fd17dd | Commit Preview URL | May 25 2026, 04:30 PM |
Indexed prefilter could return incomplete candidate set under ASCII-mode searches when --no-unicode combined with non-literal indexed queries (e.g. -F -w), causing false-negative results. The fast path was only disabled for --no-unicode when fixed_strings was false, but -F -w still hit the indexed path with non-literal index query. Hoist index_can_use_literal computation up and skip indexed prefilter whenever ASCII semantics required but index query is not pure literal. Rebased on current main; original PR #1747 by chaliy.
c998e3c to
2fd17dd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
--no-unicodewas combined with non-literal indexed queries (e.g.-F -w), causing false-negative search results.--no-unicodewhenfixed_stringswas false, while-F -wproduces a non-literal index query but still hit the indexed path.Description
index_can_use_literalearlier and use it in the fast-path eligibility check insidetry_indexed_searchso the indexed prefilter is skipped when!opts.unicode && !index_can_use_literal(file:crates/bashkit/src/builtins/rg/mod.rs).SearchQueryusage but ensure the code does not trust indexed results for cases the index cannot faithfully represent under ASCII regex semantics.test_rg_indexed_search_skipped_for_no_unicode_non_literal_queriesthat exercises--no-unicode -F -w cafagainst an indexed provider that returns no candidates and asserts the final ASCII-mode matching still findscafé(file:crates/bashkit/src/builtins/rg/mod.rs).Testing
cargo test -p bashkit test_rg_indexed_search_skipped_for_no_unicode_non_literal_queries -- --nocaptureand the test passed (ok).bashkittest suite.Codex Task