Skip to content

feat(rust): port queue show to native Rust#1399

Open
jd wants to merge 1 commit into
devs/jd/worktree-rust-port/add-live-smoke-test-queue-show--944234bafrom
devs/jd/worktree-rust-port/port-queue-show-native-rust--6c265303
Open

feat(rust): port queue show to native Rust#1399
jd wants to merge 1 commit into
devs/jd/worktree-rust-port/add-live-smoke-test-queue-show--944234bafrom
devs/jd/worktree-rust-port/port-queue-show-native-rust--6c265303

Conversation

@jd
Copy link
Copy Markdown
Member

@jd jd commented May 11, 2026

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

Depends-On: #1408

@jd
Copy link
Copy Markdown
Member Author

jd commented May 11, 2026

This pull request is part of a Mergify stack:

# Pull Request Link
1 test(ci): add live smoke test for ci queue-info #1406
2 feat(rust): port ci queue-info to native Rust #1407
3 test(queue): add live smoke test for queue status #1409
4 feat(rust): port queue status to native Rust #1359
5 test: derive native queue commands from the binary, not a hardcoded list #1366
6 test(queue): add live smoke test for queue show #1408
7 feat(rust): port queue show to native Rust #1399 👈
8 test(skill): port the skill-references test to Rust #1414

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 11, 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 May 11, 2026 07:27
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-show-native-rust--6c265303 branch from 9b78873 to e00f387 Compare May 11, 2026 11:46
@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from da5a658 to 0e20a86 Compare May 11, 2026 11:46
@jd jd had a problem deploying to func-tests-live May 11, 2026 11:46 — with GitHub Actions Failure
@jd jd had a problem deploying to func-tests-live May 11, 2026 11:46 — with GitHub Actions Failure
@jd jd had a problem deploying to func-tests-live May 11, 2026 11:46 — with GitHub Actions Failure
@jd
Copy link
Copy Markdown
Member Author

jd commented May 11, 2026

Revision history

# Type Changes Reason Date
1 initial 9b78873 2026-05-11 11:46 UTC
2 rebase 9b78873 → e00f387 2026-05-11 11:46 UTC
3 rebase e00f387 → c783f0f 2026-05-11 12:06 UTC
4 rebase c783f0f → d96bb5e 2026-05-11 12:19 UTC
5 rebase d96bb5e → 47c76c0 2026-05-11 14:08 UTC
6 rebase 47c76c0 → 0d446e4 2026-05-11 14:59 UTC
7 rebase 0d446e4 → 40a75b9 2026-05-11 15:05 UTC
8 rebase 40a75b9 → d258905 2026-05-11 20:59 UTC
9 content d258905 → b9688d1 (raw) 2026-05-12 07:44 UTC
10 content b9688d1 → 72c4bf3 (raw) 2026-05-12 08:54 UTC
11 rebase 72c4bf3 → 9d67b7f (rebase only) 2026-05-13 08:25 UTC

@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 11, 2026 11:46 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-show-native-rust--6c265303 branch from e00f387 to c783f0f Compare May 11, 2026 12:06
@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from 0e20a86 to 65e243f Compare May 11, 2026 12:06
@jd jd changed the base branch from devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 to devs/jd/worktree-rust-port/add-live-smoke-test-queue-show--944234ba May 11, 2026 12:06
@jd jd had a problem deploying to func-tests-live May 11, 2026 12:06 — with GitHub Actions Failure
@jd jd had a problem deploying to func-tests-live May 11, 2026 12:06 — with GitHub Actions Failure
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 11, 2026 12:06 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-show-native-rust--6c265303 branch from c783f0f to d96bb5e Compare May 11, 2026 12:19
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 11, 2026 15:00 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-show-native-rust--6c265303 branch from 0d446e4 to 40a75b9 Compare May 11, 2026 15:05
@jd jd force-pushed the devs/jd/worktree-rust-port/add-live-smoke-test-queue-show--944234ba branch from ca322fe to bea6443 Compare May 11, 2026 15:05
@jd jd temporarily deployed to func-tests-live May 11, 2026 15:05 — with GitHub Actions Inactive
@jd jd temporarily deployed to func-tests-live May 11, 2026 15:05 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 11, 2026 15:06 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-show-native-rust--6c265303 branch from 40a75b9 to d258905 Compare May 11, 2026 20:59
@jd jd temporarily deployed to func-tests-live May 11, 2026 20:59 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 11, 2026 20:59 Failure
@jd jd marked this pull request as ready for review May 12, 2026 07:06
@jd jd requested a review from Copilot May 12, 2026 07:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ports mergify queue show <PR_NUMBER> from the Python Click implementation to the native Rust binary, and removes the now-redundant Python mergify_cli/queue/ package to keep a single source of truth for the queue command group.

Changes:

  • Add native Rust implementation of mergify queue show with human + --json output modes and verbose rendering.
  • Extend the shared Rust HTTP client with get_if_exists() (404 → None) to support “not in queue” as a caller branch.
  • Remove the Python queue command implementation and its unit tests; update the remaining Python skill test to validate against the native binary’s command list.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/mergify-queue/src/show.rs New Rust-native queue show command implementation + unit tests.
crates/mergify-queue/src/lib.rs Exposes the new show module.
crates/mergify-core/src/http.rs Adds Client::get_if_exists() and an internal 404→None request path.
crates/mergify-cli/src/main.rs Wires queue show into clap parsing, native dispatch, and native command listing.
mergify_cli/cli.py Removes registration of the Python queue Click group.
mergify_cli/queue/cli.py Deleted: legacy Python queue commands including show rendering helpers.
mergify_cli/queue/api.py Deleted: legacy Python API wrapper/types for queue show.
mergify_cli/queue/__init__.py Removed as part of deleting the mergify_cli.queue package.
mergify_cli/tests/queue/test_show.py Deleted: Python unit tests for queue show output and behaviors.
mergify_cli/tests/queue/test_cli.py Deleted: Python unit tests for _relative_time helper (no longer in Python queue package).
mergify_cli/tests/queue/test_skill.py Updates skill-command validation to rely solely on native command listing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/mergify-queue/src/show.rs Outdated
Comment thread crates/mergify-core/src/http.rs
Comment thread crates/mergify-core/src/http.rs Outdated
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-show-native-rust--6c265303 branch from d258905 to b9688d1 Compare May 12, 2026 07:44
@jd jd force-pushed the devs/jd/worktree-rust-port/add-live-smoke-test-queue-show--944234ba branch from 2d08ea5 to 9bbe2bc Compare May 12, 2026 07:44
@jd jd temporarily deployed to func-tests-live May 12, 2026 07:44 — with GitHub Actions Inactive
@jd jd temporarily deployed to func-tests-live May 12, 2026 07:44 — with GitHub Actions Inactive
@jd jd temporarily deployed to func-tests-live May 12, 2026 07:44 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 12, 2026 07:45 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-show-native-rust--6c265303 branch from b9688d1 to 72c4bf3 Compare May 12, 2026 08:54
@jd jd temporarily deployed to func-tests-live May 12, 2026 08:54 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 12, 2026 08:54 Failure
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
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-show-native-rust--6c265303 branch from 72c4bf3 to 9d67b7f Compare May 13, 2026 08:25
@jd jd force-pushed the devs/jd/worktree-rust-port/add-live-smoke-test-queue-show--944234ba branch from 9bbe2bc to 85a46d3 Compare May 13, 2026 08:25
@jd jd temporarily deployed to func-tests-live May 13, 2026 08:25 — with GitHub Actions Inactive
@jd jd temporarily deployed to func-tests-live May 13, 2026 08:25 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 13, 2026 08:25 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.

2 participants