feat(rust): port ci queue-info to native Rust#1407
Conversation
|
This pull request is part of a Mergify stack:
|
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 ⛓️ Depends-On RequirementsWonderful, this rule succeeded.Requirement based on the presence of
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 👀 Review RequirementsWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 ReviewsWonderful, this rule succeeded.
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
1d4e970 to
78d8f46
Compare
Revision history
|
78d8f46 to
3718941
Compare
3718941 to
86bfde8
Compare
86bfde8 to
d4d2fb9
Compare
There was a problem hiding this comment.
Pull request overview
Ports mergify ci queue-info from the Python CLI into the Rust-native mergify binary, removing the legacy Python implementation and migrating coverage to Rust while preserving the INVALID_STATE (7) contract outside merge-queue context.
Changes:
- Add Rust-native
ci queue-infosubcommand wiring in the Rust CLI entrypoint. - Implement
queue-infoinmergify-ci(pretty JSON + optional$GITHUB_OUTPUTheredoc output). - Remove the Python
queue-infoimplementation and its Python-unit tests in favor of Rust tests (while keeping the live smoke/contract test elsewhere).
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
mergify_cli/tests/test_exit_code_contract.py |
Removes Python-level exit code contract coverage for ci queue-info (now covered by native path + live smoke). |
mergify_cli/tests/ci/test_cli.py |
Removes Python queue-info functional tests (port-and-delete). |
mergify_cli/tests/ci/test_cli_exit_codes.py |
Removes Python exit-code test for ci queue-info (native path now). |
mergify_cli/ci/cli.py |
Deletes the Click queue-info command implementation and related imports. |
crates/mergify-cli/src/main.rs |
Adds native command detection + clap subcommand for ci queue-info and dispatches to mergify-ci. |
crates/mergify-ci/src/queue_info.rs |
New Rust implementation + unit tests for MQ metadata detection, JSON printing, and $GITHUB_OUTPUT appending. |
crates/mergify-ci/src/lib.rs |
Exposes the new queue_info module. |
crates/mergify-ci/Cargo.toml |
Adds uuid dependency for randomized GitHub Actions heredoc delimiter. |
Cargo.lock |
Locks new uuid dependency transitive graph. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d4d2fb9 to
26cefe3
Compare
Pins the contract for ``mergify ci queue-info`` so the upcoming Rust port can be validated against the same test that exercises the Python implementation. Lands first; the port commit on top re-runs this test against Rust — same contract, both ends. The test doesn't need ``live_token`` (the command is locally evaluated). The conftest fixture scrubs every event env var and runs in a tmp dir, so the detector always reports "no MQ context". The assertion checks for exit code 7 (``INVALID_STATE``) and an MQ-context message in stdout or stderr. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Change-Id: Idff72acfc1f35f7f64051a4f62a3fe625d2b802f
The Rust binary now serves ``mergify ci queue-info`` natively. The Python implementation (``mergify_cli/ci/cli.py:queue_info``) and its tests are removed in the same PR — port-and-delete keeps a single live copy. The previous commit landed a live-smoke test pinning the ``INVALID_STATE`` exit code outside an MQ context. That same test now exercises the Rust path. ``ci queue-info`` prints the merge-queue batch metadata embedded in the current draft PR as pretty JSON. Outside an MQ context (no event payload, no PR body fenced block) it exits ``INVALID_STATE`` (exit 7). When ``$GITHUB_OUTPUT`` is set (GitHub Actions runner), the command also appends the metadata as ``queue_metadata`` under a random ``ghadelimiter_<uuid>`` heredoc, matching the pattern GitHub Actions expects for multi-line workflow outputs. The implementation reuses the shared ``queue_metadata`` and ``github_event`` modules introduced by the previous (git-refs) port commit. Adds the ``uuid`` dep (v4 random UUIDs for the ghadelimiter) to the ``mergify-ci`` crate. 3 new queue-info tests in the ``mergify-ci`` crate. The Python queue-info tests in ``test_cli.py``, ``test_cli_exit_codes.py``, and ``test_exit_code_contract.py`` are removed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Change-Id: If0cdc5a06685387f6a9379b237eb5d184b071dc4
26cefe3 to
d5d3847
Compare
Merge Queue Status
This pull request spent 15 minutes 26 seconds in the queue, including 15 minutes 2 seconds running CI. Required conditions to merge
|
The Rust binary now serves
mergify ci queue-infonatively.The Python implementation (
mergify_cli/ci/cli.py:queue_info)and its tests are removed in the same PR — port-and-delete keeps
a single live copy.
The previous commit landed a live-smoke test pinning the
INVALID_STATEexit code outside an MQ context. That sametest now exercises the Rust path.
ci queue-infoprints the merge-queue batch metadata embeddedin the current draft PR as pretty JSON. Outside an MQ context
(no event payload, no PR body fenced block) it exits
INVALID_STATE(exit 7).When
$GITHUB_OUTPUTis set (GitHub Actions runner), thecommand also appends the metadata as
queue_metadataunder arandom
ghadelimiter_<uuid>heredoc, matching the patternGitHub Actions expects for multi-line workflow outputs.
The implementation reuses the shared
queue_metadataandgithub_eventmodules introduced by the previous (git-refs)port commit.
Adds the
uuiddep (v4 random UUIDs for the ghadelimiter) tothe
mergify-cicrate.3 new queue-info tests in the
mergify-cicrate. The Pythonqueue-info tests in
test_cli.py,test_cli_exit_codes.py,and
test_exit_code_contract.pyare removed.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Depends-On: #1406