Skip to content

feat(rust): port ci git-refs and ci queue-info to native Rust (Phase 1.6)#1302

Draft
jd wants to merge 1 commit intodevs/jd/worktree-rust-port/port-queue-pause-unpause-native-rust-phase-1-5--dba6fa38from
devs/jd/worktree-rust-port/port-ci-git-refs-ci-queue-info-native-rust-phase--8d3f96e6
Draft

feat(rust): port ci git-refs and ci queue-info to native Rust (Phase 1.6)#1302
jd wants to merge 1 commit intodevs/jd/worktree-rust-port/port-queue-pause-unpause-native-rust-phase-1-5--dba6fa38from
devs/jd/worktree-rust-port/port-ci-git-refs-ci-queue-info-native-rust-phase--8d3f96e6

Conversation

@jd
Copy link
Copy Markdown
Member

@jd jd commented Apr 23, 2026

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.

Depends-On: #1301

@jd
Copy link
Copy Markdown
Member Author

jd commented Apr 23, 2026

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(rust): add mergify-core foundation types (Phase 1.2a) #1280
2 feat(rust): add mergify-core::http with retry + typed errors (Phase 1.2b) #1281
3 feat(rust): port config validate to native Rust (Phase 1.3) #1282
4 test: add port-inventory guard to catch un-ported Python commands #1296
5 ci: add Rust release workflow targeting GitHub Release assets #1297
6 feat(rust): port config simulate to native Rust (Phase 1.3b) #1298
7 feat(rust): port ci scopes-send to native Rust (Phase 1.4) #1300
8 feat(rust): port queue pause and unpause to native Rust (Phase 1.5) #1301
9 feat(rust): port ci git-refs and ci queue-info to native Rust (Phase 1.6) #1302 👈

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 23, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🔴 ⛓️ Depends-On Requirements

Waiting for:

This rule is failing.

Requirement based on the presence of Depends-On in the body of the pull request

🔴 👀 Review Requirements

Waiting for:

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

🔴 🔎 Reviews

Waiting for:

  • #review-requested = 0
This rule is failing.
  • #review-requested = 0
  • #changes-requested-reviews-by = 0
  • #review-threads-unresolved = 0

🟢 🤖 Continuous Integration

Wonderful, this rule succeeded.
  • all of:
    • check-success=ci-gate

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

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

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

🟢 📕 PR description

Wonderful, this rule succeeded.
  • body ~= (?ms:.{48,})

@mergify mergify Bot requested a review from a team April 23, 2026 19:12
…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
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-pause-unpause-native-rust-phase-1-5--dba6fa38 branch from c9705cd to 9117fc7 Compare April 24, 2026 13:41
@jd jd force-pushed the devs/jd/worktree-rust-port/port-ci-git-refs-ci-queue-info-native-rust-phase--8d3f96e6 branch from 8cb0904 to 45e5380 Compare April 24, 2026 13:41
@jd
Copy link
Copy Markdown
Member Author

jd commented Apr 24, 2026

Revision history

# Type Changes Date
1 initial 8cb0904 2026-04-24 13:41 UTC
2 rebase 8cb0904 → 45e5380 2026-04-24 13:41 UTC

@mergify mergify Bot had a problem deploying to Mergify Merge Protections April 24, 2026 13:41 Failure
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.

1 participant