feat(rust): port queue show to native Rust#1399
Merged
mergify[bot] merged 2 commits intoMay 20, 2026
Merged
Conversation
Member
Author
|
This pull request is part of a Mergify stack:
|
This was referenced May 11, 2026
Contributor
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.
|
9b78873 to
e00f387
Compare
da5a658 to
0e20a86
Compare
This was referenced May 11, 2026
Member
Author
Revision history
|
e00f387 to
c783f0f
Compare
0e20a86 to
65e243f
Compare
This was referenced May 11, 2026
c783f0f to
d96bb5e
Compare
ceb14f3 to
43451ed
Compare
77ebbfc to
f15a0d7
Compare
This was referenced May 19, 2026
This was referenced May 19, 2026
f15a0d7 to
ede38fd
Compare
43451ed to
5a75bc2
Compare
Pins the contract for ``mergify queue show`` 404 handling before the Rust port lands on top. Same test exercises Python at this PR's CI and Rust on the port commit's rebase. Uses a PR number far above the test repo's actual PR count to force the 404 path. That's robust against the test repo's queue state (PR #1 may or may not be queued at any given moment) and exercises the parts that would silently break on URL or schema drift: endpoint reachability, auth, and 404 → ``MERGIFY_API_ERROR`` exit code (6) mapping with the ``not in the merge queue`` message. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Change-Id: I944234ba2d22d99b410f4b8c91e56f0d8a49a9f7
The Rust binary now serves ``mergify queue show <PR_NUMBER>`` natively. The Python implementation (``mergify_cli/queue/cli.py:show`` plus the eight rendering helpers it depended on, plus ``mergify_cli/queue/api.py``) is removed in the same PR — the port-and-delete rule keeps a single live copy of every command. This is the last command in the ``queue`` group, so the whole ``mergify_cli/queue/`` Python package goes away. Closes the gap noted in #1380's commit message: ``mergify queue --help`` now lists ``show`` alongside ``pause`` / ``unpause`` / ``status``. ``mergify queue show <PR_NUMBER> [-v] [--json] [-r REPO] [-t TOKEN] [-u URL]``: 1. Resolves repository / token / API URL via the shared ``mergify_core::auth`` resolver. 2. Fetches ``GET /v1/repos/<repo>/merge-queue/pull/<pr_number>`` through the new ``HttpClient::get_if_exists`` helper. On 404 the command exits with ``MERGIFY_API_ERROR`` and the message ``PR #<n> is not in the merge queue``, matching the Python implementation. Other 4xx/5xx surface as normal API errors. 3. With ``--json``: pretty-prints the raw response. Schema is the Mergify API contract, so unknown fields survive verbatim. 4. Without ``--json``: renders the metadata block (position / priority / queue rule / queued / ETA), then a CI-state line and a checks section, then a conditions section. ``--verbose`` switches the checks summary to a full table and the conditions summary to a tree (``├── └── │ ``) instead of the compact ``N/M met`` summary with bullet-listed failures. New plumbing in ``mergify-core::http``: - ``Client::get_if_exists<T>(&path) -> Result<Option<T>, _>`` — GET that returns ``None`` on 404. Mirrors ``delete_if_exists`` for read-only endpoints where "not found" is a meaningful caller branch rather than a server failure. Reuses the same retry policy, bearer-auth injection, and flavor-aware error mapping as ``get`` / ``post`` / ``put``. Tests: - 7 new unit tests in ``crates/mergify-queue/src/show.rs``: compact metadata + checks summary + failing-conditions block; verbose checks table + conditions tree; JSON passthrough with a synthetic ``future_field`` to verify unknown fields survive; 404 → ``MergifyApi`` error with the right message; missing ``mergeability_check`` falls through to "Waiting for mergeability check..."; condition-group summarization (two labels joined with ``or``; truncation at 3+ labels); aggregator recursion (``any of`` / ``all of`` / ``not`` falls through to the first leaf). Wiring: - ``crates/mergify-cli/src/main.rs``: adds ``Show(ShowCliArgs)`` to ``QueueSubcommand``, dispatch to ``mergify_queue::show::run``. Adds ``("queue", "show")`` to ``NATIVE_COMMANDS``. ``ShowCliArgs`` carries the positional ``pr_number: u64`` plus ``--verbose`` and ``--json`` flags. Python deletions: - ``mergify_cli/queue/__init__.py`` / ``cli.py`` / ``api.py``: removed entirely. The whole package goes away — all four ``queue`` subcommands are now Rust-native. - ``mergify_cli/cli.py``: drops the ``from mergify_cli.queue import cli as queue_cli_mod`` import and the ``cli.add_command(queue_cli_mod.queue)`` call. - ``mergify_cli/tests/queue/test_cli.py``: deleted entirely (it only covered ``_relative_time``, which lives in ``mergify-tui::time`` now). - ``mergify_cli/tests/queue/test_show.py``: deleted entirely. - ``mergify_cli/tests/queue/test_skill.py``: drops the click import; the skill-reference check now consults the binary alone (no parallel click-command list to merge). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Change-Id: I6c265303a37642529dbbcef6f255eb429407a1d2
This was referenced May 19, 2026
JulianMaurin
approved these changes
May 20, 2026
kozlek
approved these changes
May 20, 2026
Contributor
Merge Queue Status
This pull request spent 16 minutes 31 seconds in the queue, including 15 minutes 45 seconds running CI. Required conditions to merge
|
38 tasks
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.
The Rust binary now serves
mergify queue show <PR_NUMBER>natively. The Python implementation
(
mergify_cli/queue/cli.py:showplus the eight renderinghelpers it depended on, plus
mergify_cli/queue/api.py) isremoved in the same PR — the port-and-delete rule keeps a single
live copy of every command.
This is the last command in the
queuegroup, so the wholemergify_cli/queue/Python package goes away. Closes the gapnoted in #1380's commit message:
mergify queue --helpnowlists
showalongsidepause/unpause/status.mergify queue show <PR_NUMBER> [-v] [--json] [-r REPO] [-t TOKEN] [-u URL]:mergify_core::authresolver.GET /v1/repos/<repo>/merge-queue/pull/<pr_number>through the new
HttpClient::get_if_existshelper. On 404the command exits with
MERGIFY_API_ERRORand the messagePR #<n> is not in the merge queue, matching the Pythonimplementation. Other 4xx/5xx surface as normal API errors.
--json: pretty-prints the raw response. Schema is theMergify API contract, so unknown fields survive verbatim.
--json: renders the metadata block (position /priority / queue rule / queued / ETA), then a CI-state line
and a checks section, then a conditions section.
--verboseswitches the checks summary to a full table andthe conditions summary to a tree (
├── └── │) insteadof the compact
N/M metsummary with bullet-listedfailures.
New plumbing in
mergify-core::http:Client::get_if_exists<T>(&path) -> Result<Option<T>, _>—GET that returns
Noneon 404. Mirrorsdelete_if_existsfor read-only endpoints where "not found"is a meaningful caller branch rather than a server failure.
Reuses the same retry policy, bearer-auth injection, and
flavor-aware error mapping as
get/post/put.Tests:
crates/mergify-queue/src/show.rs:compact metadata + checks summary + failing-conditions block;
verbose checks table + conditions tree; JSON passthrough with
a synthetic
future_fieldto verify unknown fields survive;404 →
MergifyApierror with the right message; missingmergeability_checkfalls through to "Waiting formergeability check..."; condition-group summarization (two
labels joined with
or; truncation at 3+ labels);aggregator recursion (
any of/all of/notfallsthrough to the first leaf).
Wiring:
crates/mergify-cli/src/main.rs: addsShow(ShowCliArgs)to
QueueSubcommand, dispatch tomergify_queue::show::run. Adds("queue", "show")toNATIVE_COMMANDS.ShowCliArgscarries the positionalpr_number: u64plus--verboseand--jsonflags.Python deletions:
mergify_cli/queue/__init__.py/cli.py/api.py:removed entirely. The whole package goes away — all four
queuesubcommands are now Rust-native.mergify_cli/cli.py: drops thefrom mergify_cli.queue import cli as queue_cli_modimportand the
cli.add_command(queue_cli_mod.queue)call.mergify_cli/tests/queue/test_cli.py: deleted entirely (itonly covered
_relative_time, which lives inmergify-tui::timenow).mergify_cli/tests/queue/test_show.py: deleted entirely.mergify_cli/tests/queue/test_skill.py: drops the clickimport; the skill-reference check now consults the binary
alone (no parallel click-command list to merge).
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Depends-On: #1408