Repository navigation
fix(research): compile globs character by character so regex metacharacters stay literal - #179
Merged
adityankale190895 merged 3 commits intoNov 18, 2026
Conversation
…acters stay literal regexFrom escaped only backslash and dot, so ( ) | ^ $ reached the RegExp as operators, + threw, ? was a quantifier, and a ** not next to a slash could not cross directories. Fixes DiffCI#178 Signed-off-by: FredApps <[email protected]>
FredApps
added a commit
to FredApps/core
that referenced
this pull request
Nov 17, 2026
Align regexFrom with the research matcher fix for DiffCI#178 (PR DiffCI#179): + is literal, ? is one character within a segment, [...] and [!...] are character classes, and a backslash escapes the next character. c++/** now matches c++/ only instead of failing to compile. Refs DiffCI#173, DiffCI#178 Signed-off-by: FredApps <[email protected]>
This was referenced Nov 17, 2026
A reversed range such as [z-a] compiled to an invalid RegExp, so matchesAny still threw for some patterns. Fall back to a literal [ when the class does not compile, and cover it with example tests. Signed-off-by: FredApps <[email protected]>
Read an invalid class like [z-a] the way the planner's matcher in DiffCI#174 does: it cannot rule a change out, so the task runs instead of being skipped. Signed-off-by: FredApps <[email protected]>
FredApps
commented
Nov 17, 2026
FredApps
left a comment
Contributor
Author
There was a problem hiding this comment.
Cross-review at c4530ec.
Checked:
- The four example tests and the fast-check property fail without the change, and
tests/planner/path-baseline.test.tsstill passes. - The branch is up to date with main, and typecheck passes.
Fixed:
- The "never throws" claim didn't hold. A class that RegExp rejects, such as
[z-a]or[a-\], threw "Range out of order". fast-check rarely generates one, so the property passed anyway.
CI is green on c4530ec.
Open: src/planner/planner.ts still has its own copy of this matcher. #174 rewrites it the same way, so the two should stay in step or share one module.
FredApps
marked this pull request as ready for review
November 18, 2026 00:56
adityankale190895
pushed a commit
that referenced
this pull request
Nov 18, 2026
* fix(planner): match task input patterns as path globs A bare or mid-segment ** (GitHub's **.js example) now matches at any depth, ( ) $ ^ | are literal so app/(marketing)/** and routes/$slug.tsx match themselves, and a pattern that cannot compile triggers its task instead of throwing out of plan(). Fixes #173 Signed-off-by: FredApps <[email protected]> * fix(planner): read task input globs the way the research matcher does Align regexFrom with the research matcher fix for #178 (PR #179): + is literal, ? is one character within a segment, [...] and [!...] are character classes, and a backslash escapes the next character. c++/** now matches c++/ only instead of failing to compile. Refs #173, #178 Signed-off-by: FredApps <[email protected]> --------- Signed-off-by: FredApps <[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.
Fixes #178
What changed
regexFrominsrc/research/baseline/matcher.tsbuilt its RegExp by escaping only\and.and then rewriting*. It now compiles the glob one character at a time:(,),|,^,$,++threw)?/**not next to/(**,**.js)*\xxx[a-z],[!a-z]!)[is literal**/, trailing/**,*,{a,b}Regression tests
tests/research/baseline/matcher.test.tsadds four example tests: literal metacharacters (app/(shop)/**,c++/*),?, classes and escapes (app/\[id\]/*), and**away from a slash. It also adds a fast-check property thatmatchesAnynever throws for any path and pattern. All four example tests fail onmain. The three existing tests andtests/planner/path-baseline.test.tsstill pass.Validation
npm run typecheck,npm testandnpm run audit:boundarypass.Not covered
src/planner/planner.ts:13-46has an identical copy of this matcher, whichDefaultCIPlanneruses. That file is outside this change. It needs the same fix, or it could import this one.