Skip to content

fix(planner): match task input patterns as path globs - #174

Merged
adityankale190895 merged 2 commits into
DiffCI:mainfrom
FredApps:fix/planner-input-pattern-glob
Nov 18, 2026
Merged

adityankale190895 merged 2 commits into
DiffCI:mainfrom
FredApps:fix/planner-input-pattern-glob

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #173

Changed behavior

regexFrom in src/planner/planner.ts, which DefaultCIPlanner uses to match a task's inputPatterns against changed files, now compiles each glob character by character. It reads globs the same way as the research matcher fix for #178 (#179), so the two matchers agree:

  • **/ matches any number of leading directories, and a trailing /** matches anything below.
  • Any other **, such as **.js, src/**.ts or a bare **, matches across directories, as GitHub path filters do.
  • * and ? stay within one segment.
  • [...] and [!...] are character classes.
  • \ escapes the next character.
  • Every other character is literal: ( ) $ ^ | +. So app/(marketing)/**, app/routes/$slug.tsx and c++/** match themselves.
  • A pattern that still cannot compile, such as the range [z-a], counts as matching, so its task is RUN instead of plan() throwing. Failures go toward running more.

Validation

Related

Unsupported cases

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 DiffCI#173

Signed-off-by: FredApps <[email protected]>
@FredApps

Copy link
Copy Markdown
Contributor Author

CI note: the one failure, check (windows-latest, 24) in run 44124776197, isn't from this change. It's tests/repo/rust-adapter.test.ts:455, "Cargo feature-unified unit tests are recorded per crate instead of blocking the repository", failing in cleanup: rmSync got EPERM, Permission denied on its Windows temp dir diffci-rust-*, after 60 s. This PR only touches src/planner/planner.ts and a new planner test. The same job on Node 22, and every other check, passed. A maintainer re-run of that job should clear it; I can't re-run from the fork.

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]>
@FredApps

Copy link
Copy Markdown
Contributor Author

Cross-reference: #178 / #179 (Yandere-san) fix the same glob converter in src/research/baseline/matcher.ts. This PR fixes the copy in src/planner/planner.ts, reached through createTaskRegistry / DefaultCIPlanner and workflow path filters. Commit 98225f7 makes this matcher read globs exactly like #179 (+ literal, ? one character, [...]/[!...] classes, \\ escape), so the two agree. #182 only passes plain-glob workflow filters to inputPatterns; those land here, and **.js matches correctly only with this fix. Nothing extra is needed in #182 for the planner side.

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-review (Yandere-san). Head 98225f7.

Checked: regexFrom in planner.ts is the same reading as the research matcher in #179 (** mid-pattern, ?, classes, escapes, literal + ( ) $, invalid patterns count as a match so plan() does not throw). The new tests fail on main (including c++/** throwing and [z-a] crashing plan()) and pass here. All tests/planner/*.test.ts pass locally (102).

Overlap: #179 fixes the copy in src/research/baseline/matcher.ts; this PR fixes the planner copy. They agree. #182 only passes plain-glob workflow path filters into inputPatterns, which land here; **.js is correct only with this fix. No conflict.

Required hosted checks are green. DiffCI change impact is still in progress, which is the usual fork skip (neutral on the other PRs). The earlier windows-latest flake in rust-adapter.test.ts cleanup is #227 / #235, not this change.

No code changes from me. Nothing open on this PR.

@FredApps
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
…acters stay literal (#179)

* fix(research): compile globs character by character so regex metacharacters 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 #178

Signed-off-by: FredApps <[email protected]>

* fix(research): read a character class RegExp rejects as literal text

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]>

* fix(research): count a pattern RegExp rejects as matching

Read an invalid class like [z-a] the way the planner's matcher in #174 does:
it cannot rule a change out, so the task runs instead of being skipped.

Signed-off-by: FredApps <[email protected]>

---------

Signed-off-by: FredApps <[email protected]>
@adityankale190895
adityankale190895 merged commit a7df27c into DiffCI:main Nov 18, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Planner: task input patterns mis-match **.js, (group) and $route paths, and an invalid pattern crashes plan()

2 participants