merge queue: embarking main (bd7a116), #1316 and #1298 together#1319
Closed
mergify[bot] wants to merge 4 commits intomainfrom
Closed
merge queue: embarking main (bd7a116), #1316 and #1298 together#1319mergify[bot] wants to merge 4 commits intomainfrom
mergify[bot] wants to merge 4 commits intomainfrom
Conversation
`CommandError.__str__` decoded captured stdout as strict UTF-8, so any non-UTF-8 bytes from a subprocess (legacy locales, binary diff fragments, truncated multi-byte sequences) would turn `str(error)` into a `UnicodeDecodeError`. Every error-formatting site is affected — the top-level CLI handler in `cli.py:104`, log messages, etc. — converting the failure into an unhandled traceback instead of a clean message. Switch to `decode(errors="replace")`. Invalid bytes become the U+FFFD replacement character; all other formatting is preserved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Change-Id: I3e3fd853218a6c4294b17e9529794320288124e5
Completes the config pilot. Second native command, flipped in PORT_STATUS.toml from ``shimmed`` to ``native``. ## What ports natively ``mergify config simulate PULL_REQUEST_URL [-f PATH] [-t TOKEN] [-u URL]``: 1. Parses the PR URL into ``(owner/repo, number)``. Invalid URLs are rejected by clap's ``value_parser``, which exits 2 (matching Python's ``click.BadParameter``). 2. Resolves the config file (same three-location search as ``config validate`` — shared helper in ``paths.rs``). 3. Reads the YAML as a raw string (no parsing — the simulator API accepts the text verbatim). 4. Resolves the bearer token: explicit ``--token`` → ``MERGIFY_TOKEN`` → ``GITHUB_TOKEN`` → error. Matches Python's precedence; the ``gh auth token`` subprocess fallback isn't ported yet. 5. Resolves the API URL: explicit ``--api-url`` → ``MERGIFY_API_URL`` → ``https://api.mergify.com`` default. 6. POSTs ``{"mergify_yml": <content>}`` to ``/v1/repos/<repo>/pulls/<number>/simulator`` via the 1.2b HTTP client (auth + retry + typed errors). 7. Prints the returned title + summary to stdout. Rich Markdown rendering of ``summary`` is deliberately deferred — we print raw Markdown today. Human output drift is allowed by the compat contract; machine-readable paths aren't affected because ``config simulate`` has no ``--json`` flag in Python either. ## Dispatch ``mergify-cli/src/main.rs`` now carries two clap subcommands (``validate`` + ``simulate``). The dispatch logic got a light reshape: on clap parse failure we distinguish "obvious native intent" (argv contains ``config`` + one of ``validate``/``simulate``) from "unrecognized command, fall through". Native-intent parse errors surface clap's formatted error and exit 2; anything else falls through to the Python shim so unported commands keep working. ## Refactor The config-path resolver moved from ``validate.rs`` into a shared ``paths.rs`` module so both commands share a single source of truth for the ``[".mergify.yml", ".mergify/config.yml", ".github/mergify.yml"]`` search list. ## Tests 24 tests in ``mergify-config`` (up from 11 in Phase 1.3): - 3 for the shared path resolver (moved out of ``validate.rs``) - 6 for PR URL parsing (happy path + 5 rejection cases) - 4 for token resolution (explicit, env fallback, error) - 2 for API URL resolution - 1 end-to-end wiremock test: POST + JSON body + auth header + response rendering Covered by the port-inventory guard: ``PORT_STATUS.toml`` flips ``config simulate`` from ``shimmed`` to ``native``. Binary size: 8.0 MB → 8.3 MB (small bump from simulate.rs). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Change-Id: If9194bb015c12c14cf71a9e831c4e1d67391793e
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.
🎉 This pull request has been checked successfully and will be merged soon. 🎉
Branch main (bd7a116), #1316 and #1298 are embarked together for merge.
This pull request has been created by Mergify to speculatively check the mergeability of #1298.
You don't need to do anything. Mergify will close this pull request automatically when it is complete.
Required conditions of queue rule
defaultfor merge:title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?:#approved-reviews-by>=2author = dependabot[bot]author = mergify-ci-botauthor = renovate[bot]body ~= (?ms:.{48,})#changes-requested-reviews-by = 0#review-requested = 0#review-threads-unresolved = 0check-success=ci-gateRequired conditions to stay in the queue:
base=mainlabel!=manual mergetitle ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?:#approved-reviews-by>=2author = dependabot[bot]author = mergify-ci-botauthor = renovate[bot]body ~= (?ms:.{48,})#changes-requested-reviews-by = 0#review-requested = 0#review-threads-unresolved = 0check-success=ci-gate