Skip to content

Commit 09264ae

Browse files
committed
feat(rust): port ci git-refs and ci queue-info to native Rust (Phase 1.6)
Adds `github_event` (GitHub Actions event payload deserialization) and `queue_metadata` (MQ YAML fenced-block extraction) shared modules to the mergify-ci crate, and ports two commands on top of them: - `ci queue-info` — prints MQ batch metadata as pretty JSON; errors INVALID_STATE (exit 7) outside an MQ context. Appends to `$GITHUB_OUTPUT` with the same `ghadelimiter_<uuid>` heredoc the Python version uses. - `ci git-refs` — detects base/head refs from Buildkite env, GitHub event payload, `refs/notes/mergify/<branch>` git notes, MQ PR body, or falls back to `HEAD^..HEAD`. Supports `text`/`shell`/`json` output formats, writes `base`/`head` to `$GITHUB_OUTPUT`, and calls `buildkite-agent meta-data set` when `BUILDKITE=true`. The notes reader is injected as a trait-object callback so unit tests can exercise the note-driven detection path without touching a real git repository; the production path shells out via `real_notes_reader`. PORT_STATUS.toml flips both entries to `native`. The looks-native heuristic in `main.rs` learns the two new subcommand names so argv errors surface as clap exit 2 instead of silently falling through to the Python shim. Adds `serde_yaml_ng` (YAML parser) and `uuid` (ghadelimiter) deps to the mergify-ci crate. Binary grows ~100KB to 8.6MB. 19 new Rust tests (8 event/metadata, 3 queue-info, 12 git-refs + 2 format round-trips merged in). Full workspace: 79 tests green, compat harness 4/4, port-inventory guard 4/4. Change-Id: I8d3f96e6cb4eb51e6cd195951b3e622cee7efdd4
1 parent 7b512c5 commit 09264ae

13 files changed

Lines changed: 1273 additions & 308 deletions

File tree

Cargo.lock

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PORT_STATUS.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727
# this file surfaces as a CI failure rather than a silent unshipped
2828
# port.
2929

30-
[[command]]
31-
path = ["ci", "git-refs"]
32-
status = "shimmed"
33-
3430
[[command]]
3531
path = ["ci", "junit-process"]
3632
status = "shimmed"
@@ -39,10 +35,6 @@ status = "shimmed"
3935
path = ["ci", "junit-upload"]
4036
status = "shimmed"
4137

42-
[[command]]
43-
path = ["ci", "queue-info"]
44-
status = "shimmed"
45-
4638
[[command]]
4739
path = ["ci", "scopes"]
4840
status = "shimmed"

crates/mergify-ci/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ publish = false
1313
mergify-core = { path = "../mergify-core" }
1414
serde = { version = "1.0", features = ["derive"] }
1515
serde_json = "1.0"
16+
serde_yaml_ng = "0.10"
1617
url = "2"
18+
uuid = { version = "1", features = ["v4"] }
1719

1820
[dev-dependencies]
1921
tempfile = "3.14"

0 commit comments

Comments
 (0)