feat(rust): port ci scopes to native Rust#1461
Open
Conversation
This was referenced May 26, 2026
Member
Author
|
This pull request is part of a Mergify stack:
|
This was referenced May 26, 2026
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
d233611 to
b1b850b
Compare
96a0757 to
14ce64c
Compare
This was referenced May 27, 2026
Member
Author
Revision history
|
b1b850b to
d3fd85c
Compare
d3fd85c to
2857e8a
Compare
46f9c59 to
ae16810
Compare
2857e8a to
b0d5709
Compare
`mergify ci scopes` is now handled by the Rust binary: load the
`.mergify.yml` `scopes:` block, resolve `(base, head)` via the
existing `git_refs::detect` machinery (or `--base`/`--head` for
"manual" mode), shell out to `git diff` for changed files, and
route each path through every scope's include/exclude globs to
produce the touched-scope set.
The implementation lands in `mergify-ci::scopes_detect` as a
five-file module:
- `config.rs` — YAML schema (`Scopes` / `Source::Files` / `Source::Manual`
/ `FileFilters`), with `BTreeMap` for sorted iteration that
keeps human output deterministic without `indexmap`.
- `matching.rs` — `globset`-backed file → scope routing, with
Python-equivalent `**` recursive semantics
(`literal_separator(false)`).
- `changed_files.rs` — `git diff base...head --name-only
--diff-filter=ACMRTD`, with the progressive `--deepen`
fetching dance Python uses to dig out a merge base on shallow
CI clones.
- `outputs.rs` — side effects: `$GITHUB_OUTPUT` JSON dict,
`buildkite-agent meta-data set`, `$GITHUB_STEP_SUMMARY`
markdown table, `buildkite-agent annotate` at job + build
scope. Each one is a no-op when its environment knob isn't
set.
- `mod.rs` — the `run()` entry point plus the
`--write <PATH>` JSON emitter consumed by
`ci scopes-send --scopes-json`.
Wired into the binary as a real `Subcommands::Ci(CiSubcommand::
Scopes(...))` variant (replacing the previous shim stub) and
added to `NATIVE_COMMANDS`. clap gains the `env` feature so
`MERGIFY_CONFIG_PATH` is honored on `--config` directly. Adds
`globset` and a workspace-internal edge `mergify-ci →
mergify-config` for the auto-detection of `.mergify.yml` /
`.mergify/config.yml` / `.github/mergify.yml`. Also makes
`git_refs::ReferencesSource::as_str` public so the markdown
emitter can reuse the wire-format names without re-encoding the
mapping.
Live smoke test from the previous commit
(`test_ci_scopes_select_all_when_no_base`) now exercises the
Rust binary's "no base provided" branch end-to-end. 88
`mergify-ci` unit tests pass (was 75; +13 for `scopes_detect`).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Change-Id: I635d39bc6a271e71663968912908bb2fb5c7aeeb
b0d5709 to
a7edc08
Compare
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.
mergify ci scopesis now handled by the Rust binary: load the.mergify.ymlscopes:block, resolve(base, head)via theexisting
git_refs::detectmachinery (or--base/--headfor"manual" mode), shell out to
git difffor changed files, androute each path through every scope's include/exclude globs to
produce the touched-scope set.
The implementation lands in
mergify-ci::scopes_detectas afive-file module:
config.rs— YAML schema (Scopes/Source::Files/Source::Manual/
FileFilters), withBTreeMapfor sorted iteration thatkeeps human output deterministic without
indexmap.matching.rs—globset-backed file → scope routing, withPython-equivalent
**recursive semantics(
literal_separator(false)).changed_files.rs—git diff base...head --name-only --diff-filter=ACMRTD, with the progressive--deepenfetching dance Python uses to dig out a merge base on shallow
CI clones.
outputs.rs— side effects:$GITHUB_OUTPUTJSON dict,buildkite-agent meta-data set,$GITHUB_STEP_SUMMARYmarkdown table,
buildkite-agent annotateat job + buildscope. Each one is a no-op when its environment knob isn't
set.
mod.rs— therun()entry point plus the--write <PATH>JSON emitter consumed byci scopes-send --scopes-json.Wired into the binary as a real
Subcommands::Ci(CiSubcommand:: Scopes(...))variant (replacing the previous shim stub) andadded to
NATIVE_COMMANDS. clap gains theenvfeature soMERGIFY_CONFIG_PATHis honored on--configdirectly. Addsglobsetand a workspace-internal edgemergify-ci → mergify-configfor the auto-detection of.mergify.yml/.mergify/config.yml/.github/mergify.yml. Also makesgit_refs::ReferencesSource::as_strpublic so the markdownemitter can reuse the wire-format names without re-encoding the
mapping.
Live smoke test from the previous commit
(
test_ci_scopes_select_all_when_no_base) now exercises theRust binary's "no base provided" branch end-to-end. 88
mergify-ciunit tests pass (was 75; +13 forscopes_detect).Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Depends-On: #1460