test: add port-inventory guard to catch un-ported Python commands#1296
Conversation
Member
Author
|
This pull request is part of a Mergify stack:
|
This was referenced Apr 23, 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.
|
This was referenced Apr 23, 2026
During the Rust port, any new click command added to the Python CLI risks being silently missed if the Rust dispatch isn't updated in parallel. This adds a CI-enforced inventory at the repo root plus a pytest that walks the click tree and compares against it. ## How it works ``PORT_STATUS.toml`` lists every click subcommand with an explicit ``status`` of either ``native`` (handled by Rust's dispatch) or ``shimmed`` (forwarded to Python by the py-shim crate). ``mergify_cli/tests/test_port_status.py`` walks ``mergify_cli.cli.cli`` and fires four assertions: - Every discovered click command has an entry. - Every entry corresponds to a live click command (no stale rows). - Every entry uses a valid ``status`` value. - No entry carries extra keys (catches typos like ``stats``). Forgetting to update the file when adding a new Python command becomes a CI failure at test-time rather than a "why is this missing from the binary?" bug report months later. ## Current baseline All 30 click subcommands are listed. Only ``config validate`` is ``native`` today (from Phase 1.3 in the same stack). The remaining 29 are ``shimmed`` — each subsequent port PR flips its entry from ``shimmed`` to ``native`` in the same commit that adds the Rust dispatch, keeping the file and the code in lockstep. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Change-Id: I4a71d672f4795dbb3e2e9523ea01b8d7fbbfbcbe
b887a4a to
fddda52
Compare
Member
Author
Revision history
|
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.
During the Rust port, any new click command added to the Python CLI
risks being silently missed if the Rust dispatch isn't updated in
parallel. This adds a CI-enforced inventory at the repo root plus
a pytest that walks the click tree and compares against it.
How it works
PORT_STATUS.tomllists every click subcommand with an explicitstatusof eithernative(handled by Rust's dispatch) orshimmed(forwarded to Python by the py-shim crate).mergify_cli/tests/test_port_status.pywalksmergify_cli.cli.cliand fires four assertions:
statusvalue.stats).Forgetting to update the file when adding a new Python command
becomes a CI failure at test-time rather than a "why is this
missing from the binary?" bug report months later.
Current baseline
All 30 click subcommands are listed. Only
config validateisnativetoday (from Phase 1.3 in the same stack). The remaining29 are
shimmed— each subsequent port PR flips its entry fromshimmedtonativein the same commit that adds the Rustdispatch, keeping the file and the code in lockstep.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Depends-On: #1282