Skip to content

test: add port-inventory guard to catch un-ported Python commands#1296

Draft
jd wants to merge 1 commit intodevs/jd/worktree-rust-port/port-config-validate-native-rust-phase-1-3--52ffe9ebfrom
devs/jd/worktree-rust-port/add-port-inventory-guard-catch-un-ported-python--4a71d672
Draft

test: add port-inventory guard to catch un-ported Python commands#1296
jd wants to merge 1 commit intodevs/jd/worktree-rust-port/port-config-validate-native-rust-phase-1-3--52ffe9ebfrom
devs/jd/worktree-rust-port/add-port-inventory-guard-catch-un-ported-python--4a71d672

Conversation

@jd
Copy link
Copy Markdown
Member

@jd jd commented 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

Depends-On: #1282

@jd
Copy link
Copy Markdown
Member Author

jd commented Apr 23, 2026

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(rust): add mergify-py-shim with embedded Python fallback #1272
2 feat(rust): add mergify-core foundation types (Phase 1.2a) #1280
3 feat(rust): add mergify-core::http with retry + typed errors (Phase 1.2b) #1281
4 feat(rust): port config validate to native Rust (Phase 1.3) #1282
5 test: add port-inventory guard to catch un-ported Python commands #1296 👈
6 ci: add Rust release workflow targeting GitHub Release assets #1297
7 feat(rust): port config simulate to native Rust (Phase 1.3b) #1298
8 feat(rust): port ci scopes-send to native Rust (Phase 1.4) #1300
9 feat(rust): port queue pause and unpause to native Rust (Phase 1.5) #1301
10 feat(rust): port ci git-refs and ci queue-info to native Rust (Phase 1.6) #1302

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 23, 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,})

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
@jd jd force-pushed the devs/jd/worktree-rust-port/add-port-inventory-guard-catch-un-ported-python--4a71d672 branch from b887a4a to fddda52 Compare April 23, 2026 19:02
@jd
Copy link
Copy Markdown
Member Author

jd commented Apr 23, 2026

Revision history

# Type Changes Date
1 initial b887a4a 2026-04-23 19:02 UTC
2 rebase b887a4a → fddda52 2026-04-23 19:02 UTC

@mergify mergify Bot had a problem deploying to Mergify Merge Protections April 23, 2026 19:03 Failure
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.

1 participant