test: derive native queue commands from the binary, not a hardcoded list#1366
Conversation
This was referenced May 5, 2026
Member
Author
|
This pull request is part of a Mergify stack:
|
This was referenced May 5, 2026
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
08a671e to
6eea6e2
Compare
Member
Author
Revision history
|
6eea6e2 to
c376a33
Compare
e7ad85a to
4be1b66
Compare
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
c376a33 to
2ca6999
Compare
4be1b66 to
d75104b
Compare
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.
Reviewer feedback (#1352): hardcoding the set of Rust-native queue
subcommands in
mergify_cli/tests/queue/test_skill.pymade theskill-reference validation drift-prone — a port PR that forgot to
update
NATIVE_QUEUE_COMMANDSwould silently pass even thoughthe skill was referencing a command the binary couldn't handle.
Two changes make the binary the single source of truth:
crates/mergify-cli/src/main.rsfactors the(group, subcommand)pairs into a top-levelNATIVE_COMMANDSconst.looks_nativeiterates thatconst instead of a
matcharm. A new hidden flag--list-native-commands(intercepted before clap or theshim) prints one
<group> <subcommand>pair per line andexits
0.test_skill.pyqueries the installedmergifybinary viasubprocess.run([…, "--list-native-commands"])to discoverthe native set, replacing the
NATIVE_QUEUE_COMMANDSfrozenset. The test skips cleanly when the binary isn't on
PATH(rare;uv run pytestinstalls it first).The result: the next port PR adds an entry to
NATIVE_COMMANDSin main.rs as part of its normal wiring, and
test_skill.pypicks it up automatically. No parallel list to maintain.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Depends-On: #1359