Skip to content

Commit 4806e0c

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 149f5ae commit 4806e0c

9 files changed

Lines changed: 1275 additions & 9 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
[[command]]
3131
path = ["ci", "git-refs"]
32-
status = "shimmed"
32+
status = "native"
3333

3434
[[command]]
3535
path = ["ci", "junit-process"]
@@ -41,7 +41,7 @@ status = "shimmed"
4141

4242
[[command]]
4343
path = ["ci", "queue-info"]
44-
status = "shimmed"
44+
status = "native"
4545

4646
[[command]]
4747
path = ["ci", "scopes"]

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)