Conversation
Member
Author
|
This pull request is part of a Mergify stack:
|
This was referenced May 6, 2026
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 👀 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.
|
bd4d24c to
3697e5a
Compare
fef89f9 to
aa9b1b2
Compare
Member
Author
Revision history
|
…ands Reported by user: ``mergify queue status --help`` rejected the flag with ``error: unexpected argument '--help' found``. Root cause: ``CliRoot`` had ``disable_help_flag = true``, so clap's auto-generated ``--help`` machinery wasn't wired up — and our ``detect_native`` then surfaced the resulting parser error (because ``looks_native`` matched) instead of falling through. Three changes: 1. Drop ``disable_help_flag = true`` from ``CliRoot``. clap now auto-recognizes ``-h`` / ``--help`` at every level and generates its standard help blurb listing flags + subcommands. 2. ``detect_native`` catches the special help-error kinds (``DisplayHelp`` and ``DisplayHelpOnMissingArgumentOrSubcommand``) explicitly and calls ``err.exit()`` regardless of the ``looks_native`` heuristic. ``err.exit()`` prints help to stdout and calls ``process::exit(0)``. The previous flow also called ``err.exit()`` on parser errors when ``looks_native``, but it only fired when the argv contained a (group, subcommand) pair — root-level ``mergify --help`` had no such pair so it would have leaked to the Python shim. 3. Honor ``MERGIFY_CLI_TESTING_UTF8_MODE`` from the Rust binary. ``test_binary_build.py`` runs ``mergify --help`` against the wheel-installed binary to verify UTF-8 emoji output works (particularly on Windows). The marker used to be printed by ``mergify_cli/cli.py::main``, but now that ``--help`` is handled natively the Python path no longer fires. Mirror the marker from the Rust binary: the binary is UTF-8 native on every platform (no ``os.execv`` re-exec needed), so report ``utf8_mode=1`` on Windows (matching the post-re-exec value the test expects) and ``utf8_mode=0`` elsewhere. Verified locally: - ``mergify --help`` lists the three native top-level groups (``config`` / ``ci`` / ``queue``). - ``mergify queue --help`` lists the native queue subcommands (``pause`` / ``unpause`` / ``status``). - ``mergify queue status --help`` shows ``--branch`` / ``--json`` / ``--token`` / ``--api-url`` / ``--repository`` with their doc-strings. - ``MERGIFY_CLI_TESTING_UTF8_MODE=1 mergify --help`` prints ``utf8_mode=0`` and ``✅`` before the help text. Known follow-up: ``mergify queue --help`` doesn't list ``show`` because it's still shimmed (no clap variant). Fixable by registering opaque clap stubs for shimmed commands; deferred to the PR that ports ``queue show``. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Change-Id: I2922aa2d83af6c99cb551f2a95bf5a4959832375
aa9b1b2 to
544e9b2
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.
Reported by user:
mergify queue status --helprejected theflag with
error: unexpected argument '--help' found. Rootcause:
CliRoothaddisable_help_flag = true, so clap'sauto-generated
--helpmachinery wasn't wired up — and ourdetect_nativethen surfaced the resulting parser error(because
looks_nativematched) instead of falling through.Three changes:
Drop
disable_help_flag = truefromCliRoot. clap nowauto-recognizes
-h/--helpat every level andgenerates its standard help blurb listing flags + subcommands.
detect_nativecatches the special help-error kinds(
DisplayHelpandDisplayHelpOnMissingArgumentOrSubcommand) explicitly andcalls
err.exit()regardless of thelooks_nativeheuristic.
err.exit()prints help to stdout and callsprocess::exit(0). The previous flow also callederr.exit()on parser errors whenlooks_native, but itonly fired when the argv contained a (group, subcommand) pair
— root-level
mergify --helphad no such pair so it wouldhave leaked to the Python shim.
Honor
MERGIFY_CLI_TESTING_UTF8_MODEfrom the Rust binary.test_binary_build.pyrunsmergify --helpagainst thewheel-installed binary to verify UTF-8 emoji output works
(particularly on Windows). The marker used to be printed by
mergify_cli/cli.py::main, but now that--helpishandled natively the Python path no longer fires. Mirror the
marker from the Rust binary: the binary is UTF-8 native on
every platform (no
os.execvre-exec needed), so reportutf8_mode=1on Windows (matching the post-re-exec valuethe test expects) and
utf8_mode=0elsewhere.Verified locally:
mergify --helplists the three native top-level groups(
config/ci/queue).mergify queue --helplists the native queue subcommands(
pause/unpause/status).mergify queue status --helpshows--branch/--json/
--token/--api-url/--repositorywith theirdoc-strings.
MERGIFY_CLI_TESTING_UTF8_MODE=1 mergify --helpprintsutf8_mode=0and✅before the help text.Known follow-up:
mergify queue --helpdoesn't listshowbecause it's still shimmed (no clap variant). Fixable by
registering opaque clap stubs for shimmed commands; deferred to
the PR that ports
queue show.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com