You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix narrowing for concatenated alternations - #230
↑ CI passes on Linux, macOS and Windows; query regressions cover nested-capture short-circuiting and scan parity. ↓ macOS initially hit an intermittent managed collection race; its rerun passed.
Diagnosis confidence
10/10
↑ The pre-fix regression reproduced prefix-only candidates; concat planning dropped OR children, and follow-up review identified literal-order regressions after flattening nested captures.
Evidence fit
9/10
↑ The issue's exact regex now returns two indexed candidates; regression tests confirm no-hit patterns skip alternation lookups even when literals are nested in captures. ↓ The original 700k-file monorepo was not available.
Summary
Preserve alternation constraints in concatenations using nested conjunctions without distributing branch combinations.
Evaluate literal constraints first, including after flattening nested captures, so no-hit searches short-circuit before fetching alternation postings.
Cover query planning and indexed, server and scan behavior; update query-plan diagnostics.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Evaluating alternation branches before the literal conjunction can unnecessarily materialize large posting lists and slow no-hit searches that could otherwise short-circuit.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Flattening nested conjunctions can undo literal-first ordering, causing both executors to fetch and union common postings before detecting a missing literal; ordering must be restored after flattening and the nested-capture case added to regression coverage.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Prioritize literal-first ordering after flattening nested conjunctions
tgrep-core/src/query.rs:563
Flattening nested conjunctions can undo literal-first ordering: (the|and)(QZX(foo|bar)) produces All([Or(the,and), And(QZX), Or(foo,bar)]). Even when QZX has no postings, both executors fetch and union the common the/and postings before discovering the miss, so the nested-capture case still regresses. Prioritize And children after flattening, and add this pattern to the short-circuit regression.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Nested captures can place mandatory literals after alternations, causing both executors to fetch and union common-term postings unnecessarily even when the mandatory literal has no hits.
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
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
8d996c95291850e8500ca1156c321fd4c21c4d3b↓ macOS initially hit an intermittent managed collection race; its rerun passed.
↓ The original 700k-file monorepo was not available.
Summary
Closes #229
Validation
cargo test --locked -p tgrep-core --lib query::testscargo test --locked -p tgrep-cli --test ripgrep_compat indexed_ -- --test-threads=2cargo test --locked -p tgrep-cli --test max_resultscargo test --locked -p tgrep-cli --test ripgrep_compat match_context -- --test-threads=2cargo fmt --all -- --checkcargo metadata --locked --format-version 1 --no-deps --manifest-path fuzz\Cargo.toml