test: derive native queue commands from the binary, not a hardcoded list#1366
Conversation
|
This pull request is part of a Mergify stack:
|
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
Revision history
|
6eea6e2 to
c376a33
Compare
e7ad85a to
4be1b66
Compare
c376a33 to
2ca6999
Compare
4be1b66 to
d75104b
Compare
2ca6999 to
41db42a
Compare
e7408de to
e9b1c70
Compare
65e243f to
2b33674
Compare
6080692 to
76f551a
Compare
2b33674 to
5f46f32
Compare
5f46f32 to
fe2d5a6
Compare
fe2d5a6 to
04d5e60
Compare
cefce9c to
e7ff17e
Compare
04d5e60 to
8c3dfb2
Compare
There was a problem hiding this comment.
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_COMMANDSconst incrates/mergify-cli/src/main.rsand expose it via a hidden--list-native-commandsflag. - Update
looks_nativeto consultNATIVE_COMMANDSrather than a hardcodedmatchpattern. - Update
mergify_cli/tests/queue/test_skill.pyto callmergify --list-native-commandsto 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.
8c3dfb2 to
c2389e7
Compare
e7ff17e to
b6f9bf8
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
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