Repository navigation
Fix Unicode case folding in indexed fixed-string searches - #174
Merged
Merged
Conversation
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 1
What changed in this PR
Fixes incorrect Unicode case-fold handling for case-insensitive fixed-string (-F -i) indexed searches by reusing the Unicode-aware regex planner on escaped literals, ensuring candidates aren’t incorrectly excluded while preserving existing fast paths.
Changes:
- Route case-insensitive literal planning through the regex planner using
regex_syntax::escapeto keep Unicode-aware decomposition and conservative candidate selection. - Add core and CLI regressions covering accented/fullwidth letters, long-s/Kelvin folds, short patterns, multiple patterns, metacharacters, and backend parity.
- Document the conservative behavior when no safe trigrams can be derived (scan all indexed candidates).
| File | Description |
|---|---|
| tgrep-core/src/query.rs | Updates literal query planning for -i to escape and delegate to the regex planner; expands test coverage for Unicode case folds and candidate preservation. |
| tgrep-cli/tests/ripgrep_compat.rs | Adds end-to-end CLI regression ensuring -F -i preserves Unicode case-fold matches consistently across backends. |
| README.md | Documents the new conservative candidate selection behavior for case-insensitive fixed strings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
baopingz
approved these changes
Oct 5, 2026
Co-authored-by: Copilot App <[email protected]>
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.

Summary
Fixes #173.
Like regex searches, case-insensitive fixed strings now narrow using only safe literal runs. Patterns without safe trigrams scan all indexed candidates rather than losing Unicode matches.
Validation
The new core and CLI regressions failed before the fix by dropping
CAFÉfor-F -i café, then passed afterward.cargo test -p tgrep-core --lib query::tests --quiet— 37 passedcargo test -p tgrep-core --test case_insensitive_roundtrip --quiet— 1 passedcargo test -p tgrep-cli --test ripgrep_compat --quiet— 235 passed, including explicit scan/local-index/server paritycargo clippy --workspace --benches --quiet -- -D warningscargo fmt --all -- --checkgit diff --check