Skip to content

fix(ci): compile scope globs exactly as the engine does - #1888

Merged
mergify[bot] merged 1 commit into
mainfrom
devs/sileht/mrgfy-10075-scopes-glob-port/compile-scope-globs-exactly-engine--67724907
Oct 6, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
devs/sileht/mrgfy-10075-scopes-glob-port/compile-scope-globs-exactly-engine--67724907

Conversation

@sileht

@sileht sileht commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

mergify ci scopes matched scope globs with globset, the engine with
its own brace expansion plus Python's glob.translate. Even with *
bounded and ? matching characters, the two dialects still disagreed on
ASCII patterns, so one config could select different files in CI and in
the merge queue:

  • [^x] negated in globset, it is a class holding ^ and x for the
    engine;
  • a class spanning a separator (x[a/b]y) was a class in globset, the
    engine splits the pattern on separators first, so it is literal text;
  • \ was an escape in globset, it is a path separator for the engine.

Replace globset with engine_glob, a port of the engine's
globs.expand_braces and of glob.translate(recursive=True, include_hidden=True, seps=["/", "\\"]), emitting a regex crate
pattern. engine_glob_cases.json holds patterns and paths with the
verdicts the engine itself gives, generated by engine_glob_cases.py
from the engine's globs.py on Python 3.14 with the regex module,
and a test checks this side reproduces every one. A local run of the
same comparison over ~190,000 random pattern/path pairs found no other
difference.

The one deliberate divergence: the regex module reads [:name:]
inside a set as a POSIX class, which swallows the glob class's closing
bracket. The engine then rejects the pattern or matches something
meaningless; the CLI refuses it as a configuration error. A regex that
fails to compile is a bug in the port, so it is reported as such rather
than as the user's config.

This also matches ? and [...] per character on non-ASCII paths,
which #1883 (MRGFY-10066)
did on top of globset; that pull request is closed in favour of this one.

Fixes MRGFY-10075
Fixes MRGFY-10066

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

Copilot AI balanced review requested due to automatic review settings October 5, 2026 22:28
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections October 5, 2026 22:29 Failure
@sileht
sileht deployed to func-tests-live October 5, 2026 22:29 — with GitHub Actions Active
@mergify

mergify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 6 merge protections satisfied — ready to merge.

Show 6 satisfied protections

🟢 🤖 Continuous Integration

  • all of:
    • check-success=ci-gate

🟢 👀 Review Requirements

  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|internal|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?!?:

🟢 🔎 Reviews

  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The cross-language compiler controls CI job selection, so its engine-parity guarantees warrant final human validation.

Review effort: Balanced
Findings: None

What changed in this PR

Aligns mergify ci scopes glob matching with the engine so CI and the merge queue select files consistently.

Changes:

  • Replaces globset with a compiler supporting engine brace, separator, and Unicode semantics, with explicit POSIX-class rejection.
  • Adds engine-generated parity fixtures and a regeneration script.
File Description
crates/​mergify-ci/​src/​scopes_detect/​mod.rs Registers the compiler module.
crates/​mergify-ci/​src/​scopes_detect/​matching.rs Integrates regex matching and compiler errors.
crates/​mergify-ci/​src/​scopes_detect/​engine_glob.rs Implements engine-compatible translation and parity tests.
crates/​mergify-ci/​src/​scopes_detect/​engine_glob_cases.py Generates expected engine verdicts.
crates/​mergify-ci/​src/​scopes_detect/​engine_glob_cases.json Records matching and rejection cases.
crates/​mergify-ci/​src/​scopes_detect/​changed_files.rs Updates Unicode-matching documentation only.
crates/​mergify-ci/​Cargo.toml Replaces globset with regex.
Cargo.toml Removes the workspace globset dependency.
Cargo.lock Updates dependencies accordingly.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mergify
mergify Bot requested a review from a team October 5, 2026 22:36
@sileht
sileht marked this pull request as ready for review October 6, 2026 05:48
`mergify ci scopes` matched scope globs with globset, the engine with
its own brace expansion plus Python's `glob.translate`. Even with `*`
bounded and `?` matching characters, the two dialects still disagreed on
ASCII patterns, so one config could select different files in CI and in
the merge queue:

- `[^x]` negated in globset, it is a class holding `^` and `x` for the
  engine;
- a class spanning a separator (`x[a/b]y`) was a class in globset, the
  engine splits the pattern on separators first, so it is literal text;
- `\` was an escape in globset, it is a path separator for the engine.

Replace globset with `engine_glob`, a port of the engine's
`globs.expand_braces` and of `glob.translate(recursive=True,
include_hidden=True, seps=["/", "\\"])`, emitting a `regex` crate
pattern. `engine_glob_cases.json` holds patterns and paths with the
verdicts the engine itself gives, generated by `engine_glob_cases.py`
from the engine's `globs.py` on Python 3.14 with the `regex` module,
and a test checks this side reproduces every one. A local run of the
same comparison over ~190,000 random pattern/path pairs found no other
difference.

The one deliberate divergence: the `regex` module reads `[:name:]`
inside a set as a POSIX class, which swallows the glob class's closing
bracket. The engine then rejects the pattern or matches something
meaningless; the CLI refuses it as a configuration error. A regex that
fails to compile is a bug in the port, so it is reported as such rather
than as the user's config.

This also matches `?` and `[...]` per character on non-ASCII paths,
which #1883 (MRGFY-10066)
did on top of globset; that pull request is closed in favour of this one.

Fixes MRGFY-10075
Fixes MRGFY-10066

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: I67724907949c50cfc3f10f37dd968cc2e68dab2e
@sileht
sileht force-pushed the devs/sileht/mrgfy-10075-scopes-glob-port/compile-scope-globs-exactly-engine--67724907 branch from 706de25 to a639e45 Compare October 6, 2026 05:50
@sileht

sileht commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

Revision history

# Type Changes Reason Date
1 initial 706de25 2026-10-06 05:50 UTC
2 rebase 706de25 → a639e45 (rebase only) 2026-10-06 05:50 UTC

@sileht
sileht deployed to func-tests-live October 6, 2026 05:50 — with GitHub Actions Active
@mergify
mergify Bot deployed to Mergify Merge Protections October 6, 2026 05:51 Active
@mergify
mergify Bot requested a review from a team October 6, 2026 06:44
@mergify

mergify Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-06 07:39 UTC · Rule: default · triggered by merge protections
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-10-06 07:39 UTC · at 1d677f94d7fb07502ac738c072de0fc7973bb337 · squash

This pull request spent 11 seconds in the queue, including 1 second running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 1d677f9 into main Oct 6, 2026
23 checks passed
@mergify mergify Bot added the queued label Oct 6, 2026
@mergify
mergify Bot deleted the devs/sileht/mrgfy-10075-scopes-glob-port/compile-scope-globs-exactly-engine--67724907 branch October 6, 2026 07:39
@mergify mergify Bot removed the queued label Oct 6, 2026

This branch was successfully deployed

2 active deployments
Mergify Merge Protections — a639e451 Deployed Oct 6, 2026 by mergify[bot]
func-tests-live — a639e451 Deployed Oct 6, 2026 by sileht via live-tests #1983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants