Skip to content

test: derive native queue commands from the binary, not a hardcoded list#1366

Open
jd wants to merge 1 commit into
devs/jd/worktree-rust-port/port-queue-status-native-rust-phase-1-7--8cebcd32from
devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8
Open

test: derive native queue commands from the binary, not a hardcoded list#1366
jd wants to merge 1 commit into
devs/jd/worktree-rust-port/port-queue-status-native-rust-phase-1-7--8cebcd32from
devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8

Conversation

@jd
Copy link
Copy Markdown
Member

@jd jd commented May 5, 2026

Reviewer feedback (#1352): hardcoding the set of Rust-native queue
subcommands in mergify_cli/tests/queue/test_skill.py made the
skill-reference validation drift-prone — a port PR that forgot to
update NATIVE_QUEUE_COMMANDS would silently pass even though
the skill was referencing a command the binary couldn't handle.

Two changes make the binary the single source of truth:

  1. crates/mergify-cli/src/main.rs factors the
    (group, subcommand) pairs into a top-level
    NATIVE_COMMANDS const. looks_native iterates that
    const instead of a match arm. A new hidden flag
    --list-native-commands (intercepted before clap or the
    shim) prints one <group> <subcommand> pair per line and
    exits 0.

  2. test_skill.py queries the installed mergify binary via
    subprocess.run([…, "--list-native-commands"]) to discover
    the native set, replacing the NATIVE_QUEUE_COMMANDS
    frozenset. The test skips cleanly when the binary isn't on
    PATH (rare; uv run pytest installs it first).

The result: the next port PR adds an entry to NATIVE_COMMANDS
in main.rs as part of its normal wiring, and test_skill.py
picks it up automatically. No parallel list to maintain.

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

Depends-On: #1359

@jd
Copy link
Copy Markdown
Member Author

jd commented May 5, 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 5, 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,})

@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from 08a671e to 6eea6e2 Compare May 6, 2026 07:25
@jd
Copy link
Copy Markdown
Member Author

jd commented May 6, 2026

Revision history

# Type Changes Reason Date
1 initial 08a671e 2026-05-06 07:25 UTC
2 content 08a671e → 6eea6e2 2026-05-06 07:25 UTC
3 rebase 6eea6e2 → c376a33 2026-05-06 10:57 UTC
4 rebase c376a33 → 2ca6999 2026-05-06 13:00 UTC
5 rebase 2ca6999 → 41db42a 2026-05-07 13:40 UTC
6 rebase ae15b73 → 4a7622b 2026-05-07 18:21 UTC
7 rebase 4a7622b → da5a658 2026-05-11 07:13 UTC
8 rebase da5a658 → 0e20a86 2026-05-11 11:46 UTC
9 rebase 0e20a86 → 65e243f 2026-05-11 12:06 UTC
10 rebase 65e243f → 2b33674 2026-05-11 12:19 UTC
11 rebase 2b33674 → 5f46f32 2026-05-11 14:08 UTC
12 rebase 5f46f32 → fe2d5a6 2026-05-11 14:59 UTC
13 rebase fe2d5a6 → 04d5e60 2026-05-11 15:05 UTC
14 rebase 04d5e60 → 8c3dfb2 2026-05-11 20:59 UTC
15 rebase 8c3dfb2 → c2389e7 (rebase only) 2026-05-12 07:44 UTC
16 rebase c2389e7 → 16faa08 (rebase only) 2026-05-13 08:25 UTC

@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 6, 2026 07:25 Failure
@mergify mergify Bot requested a review from a team May 6, 2026 07:35
@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from 6eea6e2 to c376a33 Compare May 6, 2026 10:57
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-status-native-rust-phase-1-7--8cebcd32 branch from e7ad85a to 4be1b66 Compare May 6, 2026 10:57
@jd jd temporarily deployed to func-tests-live May 6, 2026 10:57 — with GitHub Actions Inactive
@jd jd temporarily deployed to func-tests-live May 6, 2026 10:57 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 6, 2026 10:57 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from c376a33 to 2ca6999 Compare May 6, 2026 13:00
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-status-native-rust-phase-1-7--8cebcd32 branch from 4be1b66 to d75104b Compare May 6, 2026 13:00
@jd jd temporarily deployed to func-tests-live May 6, 2026 13:00 — with GitHub Actions Inactive
@jd jd temporarily deployed to func-tests-live May 6, 2026 13:00 — with GitHub Actions Inactive
@jd jd temporarily deployed to func-tests-live May 6, 2026 13:00 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 6, 2026 13:01 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from 2ca6999 to 41db42a Compare May 7, 2026 13:40
@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
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-status-native-rust-phase-1-7--8cebcd32 branch from e7408de to e9b1c70 Compare May 7, 2026 15:17
@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from 65e243f to 2b33674 Compare May 11, 2026 12:19
@jd jd had a problem deploying to func-tests-live May 11, 2026 12:19 — with GitHub Actions Failure
@jd jd had a problem deploying to func-tests-live May 11, 2026 12:19 — with GitHub Actions Failure
@jd jd had a problem deploying to func-tests-live May 11, 2026 12:19 — with GitHub Actions Failure
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 11, 2026 12:19 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-status-native-rust-phase-1-7--8cebcd32 branch from 6080692 to 76f551a Compare May 11, 2026 14:07
@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from 2b33674 to 5f46f32 Compare May 11, 2026 14:07
@jd jd had a problem deploying to func-tests-live May 11, 2026 14:08 — with GitHub Actions Failure
@jd jd had a problem deploying to func-tests-live May 11, 2026 14:08 — with GitHub Actions Failure
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 11, 2026 14:08 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from 5f46f32 to fe2d5a6 Compare May 11, 2026 14:59
@jd jd temporarily deployed to func-tests-live May 11, 2026 14:59 — with GitHub Actions Inactive
@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/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from fe2d5a6 to 04d5e60 Compare May 11, 2026 15:05
@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-status-native-rust-phase-1-7--8cebcd32 branch from cefce9c to e7ff17e Compare May 11, 2026 20:59
@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from 04d5e60 to 8c3dfb2 Compare May 11, 2026 20:59
@jd jd temporarily deployed to func-tests-live May 11, 2026 20:59 — with GitHub Actions Inactive
@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:05
@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

This PR makes the Rust mergify binary the single source of truth for which queue subcommands are handled natively, and updates the skill-reference test to query that information from the installed binary instead of maintaining a parallel hardcoded list.

Changes:

  • Add a NATIVE_COMMANDS const in crates/mergify-cli/src/main.rs and expose it via a hidden --list-native-commands flag.
  • Update looks_native to consult NATIVE_COMMANDS rather than a hardcoded match pattern.
  • Update mergify_cli/tests/queue/test_skill.py to call mergify --list-native-commands to determine native queue commands.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
mergify_cli/tests/queue/test_skill.py Replaces hardcoded native queue command list with a subprocess query to the installed mergify binary.
crates/mergify-cli/src/main.rs Introduces NATIVE_COMMANDS + a hidden listing flag and reuses the const for native-command detection.

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

Comment thread crates/mergify-cli/src/main.rs
@jd jd force-pushed the devs/jd/worktree-rust-port/derive-native-queue-cmds-binary-hardcoded-list--74502fe8 branch from 8c3dfb2 to c2389e7 Compare May 12, 2026 07:44
@jd jd force-pushed the devs/jd/worktree-rust-port/port-queue-status-native-rust-phase-1-7--8cebcd32 branch from e7ff17e to b6f9bf8 Compare May 12, 2026 07:44
Reviewer feedback (#1352): hardcoding the set of Rust-native queue
subcommands in ``mergify_cli/tests/queue/test_skill.py`` made the
skill-reference validation drift-prone — a port PR that forgot to
update ``NATIVE_QUEUE_COMMANDS`` would silently pass even though
the skill was referencing a command the binary couldn't handle.

Two changes make the binary the single source of truth:

1. ``crates/mergify-cli/src/main.rs`` factors the
   ``(group, subcommand)`` pairs into a top-level
   ``NATIVE_COMMANDS`` const. ``looks_native`` iterates that
   const instead of a `match` arm. A new hidden flag
   ``--list-native-commands`` (intercepted before clap or the
   shim) prints one ``<group> <subcommand>`` pair per line and
   exits ``0``.

2. ``test_skill.py`` queries the installed ``mergify`` binary via
   ``subprocess.run([…, "--list-native-commands"])`` to discover
   the native set, replacing the ``NATIVE_QUEUE_COMMANDS``
   frozenset. The test skips cleanly when the binary isn't on
   ``PATH`` (rare; ``uv run pytest`` installs it first).

The result: the next port PR adds an entry to ``NATIVE_COMMANDS``
in main.rs as part of its normal wiring, and ``test_skill.py``
picks it up automatically. No parallel list to maintain.

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

Change-Id: I74502fe8affcc58f26eaaa9d058668eb36fec83b
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