Skip to content

fix(cli): surface clap's --help instead of erroring on native subcommands#1380

Merged
mergify[bot] merged 1 commit into
mainfrom
devs/jd/worktree-rust-port/surface-clap-s-help-instead-erroring-native--2922aa2d
May 11, 2026
Merged

fix(cli): surface clap's --help instead of erroring on native subcommands#1380
mergify[bot] merged 1 commit into
mainfrom
devs/jd/worktree-rust-port/surface-clap-s-help-instead-erroring-native--2922aa2d

Conversation

@jd
Copy link
Copy Markdown
Member

@jd jd commented May 6, 2026

Reported by user: mergify queue status --help rejected the
flag with error: unexpected argument '--help' found. Root
cause: CliRoot had disable_help_flag = true, so clap's
auto-generated --help machinery wasn't wired up — and our
detect_native then surfaced the resulting parser error
(because looks_native matched) instead of falling through.

Three changes:

  1. Drop disable_help_flag = true from CliRoot. clap now
    auto-recognizes -h / --help at every level and
    generates its standard help blurb listing flags + subcommands.

  2. detect_native catches the special help-error kinds
    (DisplayHelp and
    DisplayHelpOnMissingArgumentOrSubcommand) explicitly and
    calls err.exit() regardless of the looks_native
    heuristic. err.exit() prints help to stdout and calls
    process::exit(0). The previous flow also called
    err.exit() on parser errors when looks_native, but it
    only fired when the argv contained a (group, subcommand) pair
    — root-level mergify --help had no such pair so it would
    have leaked to the Python shim.

  3. Honor MERGIFY_CLI_TESTING_UTF8_MODE from the Rust binary.
    test_binary_build.py runs mergify --help against the
    wheel-installed binary to verify UTF-8 emoji output works
    (particularly on Windows). The marker used to be printed by
    mergify_cli/cli.py::main, but now that --help is
    handled natively the Python path no longer fires. Mirror the
    marker from the Rust binary: the binary is UTF-8 native on
    every platform (no os.execv re-exec needed), so report
    utf8_mode=1 on Windows (matching the post-re-exec value
    the test expects) and utf8_mode=0 elsewhere.

Verified locally:

  • mergify --help lists the three native top-level groups
    (config / ci / queue).
  • mergify queue --help lists the native queue subcommands
    (pause / unpause / status).
  • mergify queue status --help shows --branch / --json
    / --token / --api-url / --repository with their
    doc-strings.
  • MERGIFY_CLI_TESTING_UTF8_MODE=1 mergify --help prints
    utf8_mode=0 and before the help text.

Known follow-up: mergify queue --help doesn't list show
because it's still shimmed (no clap variant). Fixable by
registering opaque clap stubs for shimmed commands; deferred to
the PR that ports queue show.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

@jd
Copy link
Copy Markdown
Member Author

jd commented May 6, 2026

This pull request is part of a Mergify stack:

# Pull Request Link
1 fix(cli): surface clap's --help instead of erroring on native subcommands #1380 👈
2 feat(rust): port queue pause and unpause to native Rust #1352
3 feat(rust): port ci git-refs and ci queue-info to native Rust #1353
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 feat(rust): port queue show to native Rust #1399

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 6, 2026

Merge Protections

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

🟢 🤖 Continuous Integration

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

🟢 👀 Review Requirements

Wonderful, this rule succeeded.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🟢 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)(?:\(.+\))?:

🟢 🔎 Reviews

Wonderful, this rule succeeded.
  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

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

@jd jd force-pushed the devs/jd/worktree-rust-port/extract-reusable-terminal-ui-primitives-mergify--bbdbce1e branch from bd4d24c to 3697e5a Compare May 7, 2026 13:40
@jd jd force-pushed the devs/jd/worktree-rust-port/surface-clap-s-help-instead-erroring-native--2922aa2d branch from fef89f9 to aa9b1b2 Compare May 7, 2026 13:40
@jd
Copy link
Copy Markdown
Member Author

jd commented May 7, 2026

Revision history

# Type Changes Reason Date
1 initial fef89f9 2026-05-07 13:40 UTC
2 content fef89f9 → aa9b1b2 2026-05-07 13:40 UTC
3 content aa9b1b2 → 544e9b2 2026-05-07 15:17 UTC
4 rebase 544e9b2 → cbcac36 2026-05-11 07:13 UTC

@jd jd temporarily deployed to func-tests-live May 7, 2026 13:40 — with GitHub Actions Inactive
@jd jd temporarily deployed to func-tests-live May 7, 2026 13:40 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 7, 2026 13:40 Failure
@mergify mergify Bot requested a review from a team May 7, 2026 13:53
@jd jd marked this pull request as ready for review May 7, 2026 15:02
@jd jd changed the base branch from devs/jd/worktree-rust-port/extract-reusable-terminal-ui-primitives-mergify--bbdbce1e to main May 7, 2026 15:17
@jd jd force-pushed the devs/jd/worktree-rust-port/surface-clap-s-help-instead-erroring-native--2922aa2d branch from aa9b1b2 to 544e9b2 Compare May 7, 2026 15:17
@jd jd temporarily deployed to func-tests-live May 7, 2026 15:17 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 7, 2026 15:17 Failure
…ands

Reported by user: ``mergify queue status --help`` rejected the
flag with ``error: unexpected argument '--help' found``. Root
cause: ``CliRoot`` had ``disable_help_flag = true``, so clap's
auto-generated ``--help`` machinery wasn't wired up — and our
``detect_native`` then surfaced the resulting parser error
(because ``looks_native`` matched) instead of falling through.

Three changes:

1. Drop ``disable_help_flag = true`` from ``CliRoot``. clap now
   auto-recognizes ``-h`` / ``--help`` at every level and
   generates its standard help blurb listing flags + subcommands.

2. ``detect_native`` catches the special help-error kinds
   (``DisplayHelp`` and
   ``DisplayHelpOnMissingArgumentOrSubcommand``) explicitly and
   calls ``err.exit()`` regardless of the ``looks_native``
   heuristic. ``err.exit()`` prints help to stdout and calls
   ``process::exit(0)``. The previous flow also called
   ``err.exit()`` on parser errors when ``looks_native``, but it
   only fired when the argv contained a (group, subcommand) pair
   — root-level ``mergify --help`` had no such pair so it would
   have leaked to the Python shim.

3. Honor ``MERGIFY_CLI_TESTING_UTF8_MODE`` from the Rust binary.
   ``test_binary_build.py`` runs ``mergify --help`` against the
   wheel-installed binary to verify UTF-8 emoji output works
   (particularly on Windows). The marker used to be printed by
   ``mergify_cli/cli.py::main``, but now that ``--help`` is
   handled natively the Python path no longer fires. Mirror the
   marker from the Rust binary: the binary is UTF-8 native on
   every platform (no ``os.execv`` re-exec needed), so report
   ``utf8_mode=1`` on Windows (matching the post-re-exec value
   the test expects) and ``utf8_mode=0`` elsewhere.

Verified locally:

- ``mergify --help`` lists the three native top-level groups
  (``config`` / ``ci`` / ``queue``).
- ``mergify queue --help`` lists the native queue subcommands
  (``pause`` / ``unpause`` / ``status``).
- ``mergify queue status --help`` shows ``--branch`` / ``--json``
  / ``--token`` / ``--api-url`` / ``--repository`` with their
  doc-strings.
- ``MERGIFY_CLI_TESTING_UTF8_MODE=1 mergify --help`` prints
  ``utf8_mode=0`` and ``✅`` before the help text.

Known follow-up: ``mergify queue --help`` doesn't list ``show``
because it's still shimmed (no clap variant). Fixable by
registering opaque clap stubs for shimmed commands; deferred to
the PR that ports ``queue show``.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Change-Id: I2922aa2d83af6c99cb551f2a95bf5a4959832375
@jd jd force-pushed the devs/jd/worktree-rust-port/surface-clap-s-help-instead-erroring-native--2922aa2d branch from 544e9b2 to cbcac36 Compare May 11, 2026 07:13
@jd jd temporarily deployed to func-tests-live May 11, 2026 07:13 — with GitHub Actions Inactive
@mergify mergify Bot deployed to Mergify Merge Protections May 11, 2026 07:14 Active
@mergify mergify Bot requested a review from a team May 11, 2026 08:29
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 11, 2026

Merge Queue Status

This pull request spent 14 minutes 37 seconds in the queue, including 14 minutes 14 seconds running CI.

Required conditions to merge

mergify Bot added a commit that referenced this pull request May 11, 2026
@mergify mergify Bot added the queued label May 11, 2026
mergify Bot added a commit that referenced this pull request May 11, 2026
@mergify mergify Bot merged commit 445c4fa into main May 11, 2026
19 checks passed
@mergify mergify Bot deleted the devs/jd/worktree-rust-port/surface-clap-s-help-instead-erroring-native--2922aa2d branch May 11, 2026 10:04
jd added a commit that referenced this pull request 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>
Change-Id: I6c265303a37642529dbbcef6f255eb429407a1d2
jd added a commit that referenced this pull request 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>
Change-Id: I6c265303a37642529dbbcef6f255eb429407a1d2
jd added a commit that referenced this pull request 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>
Change-Id: I6c265303a37642529dbbcef6f255eb429407a1d2
jd added a commit that referenced this pull request 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>
Change-Id: I6c265303a37642529dbbcef6f255eb429407a1d2
jd added a commit that referenced this pull request 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>
Change-Id: I6c265303a37642529dbbcef6f255eb429407a1d2
jd added a commit that referenced this pull request 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>
Change-Id: I6c265303a37642529dbbcef6f255eb429407a1d2
jd added a commit that referenced this pull request 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>
Change-Id: I6c265303a37642529dbbcef6f255eb429407a1d2
jd added a commit that referenced this pull request May 12, 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>
Change-Id: I6c265303a37642529dbbcef6f255eb429407a1d2
jd added a commit that referenced this pull request May 12, 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>
Change-Id: I6c265303a37642529dbbcef6f255eb429407a1d2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants