Skip to content

fix(config): surface an invalid simulate config as a config error#1679

Merged
mergify[bot] merged 2 commits into
mainfrom
devs/JulianMaurin/feat/rust-cli-excellence/surface-invalid-simulate-config-config-error--e77d8f68
Jun 25, 2026
Merged

fix(config): surface an invalid simulate config as a config error#1679
mergify[bot] merged 2 commits into
mainfrom
devs/JulianMaurin/feat/rust-cli-excellence/surface-invalid-simulate-config-config-error--e77d8f68

Conversation

@JulianMaurin

Copy link
Copy Markdown
Contributor

A schema-invalid config uploaded by config simulate came back as
the simulator's HTTP 422 and was reported as a Mergify API failure
(exit 6) — even though the same fixture fails config validate
client-side with exit 8. The drift meant a local-config problem
looked like a service problem to scripts.

Add HttpClient::post_classifying, which lets a caller remap a
terminal status before the default flavor mapping, and use it in
simulate to map the simulator's 422 to a configuration error
(exit 8).

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Depends-On: #1678

@JulianMaurin

JulianMaurin commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 fix(queue): treat a not-queued PR as a normal state, not an API error #1678
2 fix(config): surface an invalid simulate config as a config error #1679 👈
3 fix(ci): return a runtime error when scopes --write fails #1680
4 fix(stack): exit not-found when checkout finds no stack #1681
5 feat(cli): support the git-style help subcommand #1682
6 docs(cli): correct stack reorder and scopes-send help text #1683

@mergify

mergify Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 7 merge protections satisfied — ready to merge.

Show 7 satisfied protections

🟢 ⛓️ Depends-On Requirements

Requirement based on the presence of Depends-On in the body of the pull request

🟢 🤖 Continuous Integration

  • all of:
    • check-success=ci-gate

🟢 👀 Review Requirements

  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🟢 Enforce conventional commit

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)(?:\(.+\))?:

🟢 🔎 Reviews

  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

@mergify mergify Bot requested a review from a team June 23, 2026 18:36
@JulianMaurin JulianMaurin force-pushed the devs/JulianMaurin/feat/rust-cli-excellence/surface-invalid-simulate-config-config-error--e77d8f68 branch from 987a30e to f18b064 Compare June 25, 2026 07:49
@JulianMaurin JulianMaurin force-pushed the devs/JulianMaurin/feat/rust-cli-excellence/treat-queued-pr-normal-state-api-error--6f7ca3cf branch from 9ef5865 to 62bec7d Compare June 25, 2026 07:49
@mergify mergify Bot had a problem deploying to Mergify Merge Protections June 25, 2026 07:49 Failure
@JulianMaurin

JulianMaurin commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 987a30e 2026-06-25 07:49 UTC
2 rebase 987a30e → f18b064 (rebase only) 2026-06-25 07:49 UTC
3 rebase f18b064 → 23baf94 (rebase only) 2026-06-25 07:56 UTC
4 rebase 23baf94 → 75d611c (rebase only) 2026-06-25 08:51 UTC

@JulianMaurin JulianMaurin force-pushed the devs/JulianMaurin/feat/rust-cli-excellence/surface-invalid-simulate-config-config-error--e77d8f68 branch from f18b064 to 23baf94 Compare June 25, 2026 07:56
@JulianMaurin JulianMaurin force-pushed the devs/JulianMaurin/feat/rust-cli-excellence/treat-queued-pr-normal-state-api-error--6f7ca3cf branch from 62bec7d to 0dd17d0 Compare June 25, 2026 07:56
@mergify mergify Bot had a problem deploying to Mergify Merge Protections June 25, 2026 07:56 Failure
JulianMaurin and others added 2 commits June 25, 2026 10:51
`queue show` mapped a PR that isn't in the merge queue to exit 6
(Mergify API error) with empty stdout — so `--json` consumers got
nothing parseable for the most common case, and scripts saw an
API-failure code for a routine state.

Report it on stdout and exit 0 instead: a `{"number": N, "queued":
false}` document under `--json`, the `PR #N is not in the merge
queue` line in human mode.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Change-Id: I6f7ca3cf3cffb83ba129a1c48d2aab218dabd989
A schema-invalid config uploaded by `config simulate` came back as
the simulator's HTTP 422 and was reported as a Mergify API failure
(exit 6) — even though the same fixture fails `config validate`
client-side with exit 8. The drift meant a local-config problem
looked like a service problem to scripts.

Add `HttpClient::post_classifying`, which lets a caller remap a
terminal status before the default flavor mapping, and use it in
`simulate` to map the simulator's 422 to a configuration error
(exit 8).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Change-Id: Ie77d8f689eef92cd71201a67dc793742ec7fe52b
@JulianMaurin JulianMaurin force-pushed the devs/JulianMaurin/feat/rust-cli-excellence/treat-queued-pr-normal-state-api-error--6f7ca3cf branch from 0dd17d0 to f2561e6 Compare June 25, 2026 08:51
@JulianMaurin JulianMaurin force-pushed the devs/JulianMaurin/feat/rust-cli-excellence/surface-invalid-simulate-config-config-error--e77d8f68 branch from 23baf94 to 75d611c Compare June 25, 2026 08:51
@mergify mergify Bot deployed to Mergify Merge Protections June 25, 2026 08:52 Active
Base automatically changed from devs/JulianMaurin/feat/rust-cli-excellence/treat-queued-pr-normal-state-api-error--6f7ca3cf to main June 25, 2026 09:12
@JulianMaurin JulianMaurin marked this pull request as ready for review June 25, 2026 09:20
Copilot AI review requested due to automatic review settings June 25, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts HTTP error classification so config simulate reports a schema-invalid local config as a configuration error (exit 8) instead of a Mergify API failure (exit 6), and also updates queue show to treat “PR not in merge queue” (404) as a normal state with stdout output and exit 0.

Changes:

  • Add HttpClient::post_classifying to allow callers to remap specific terminal HTTP statuses before ApiFlavor error mapping.
  • Use post_classifying in config simulate to map simulator HTTP 422 to CliError::Configuration (exit 8), with regression tests.
  • Change queue show 404 behavior to emit a not-queued message/document on stdout and return success, updating unit + live smoke tests accordingly.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
crates/mergify-queue/src/show.rs Treat 404 “not queued” as a normal result; emit stdout output in human/JSON modes; update tests.
crates/mergify-core/src/http.rs Introduce post_classifying and a classifier hook into the retry/execution path; add unit tests.
crates/mergify-config/src/simulate.rs Map simulator 422 responses to configuration errors using the new HTTP helper; add regression test.
crates/mergify-cli/tests/live_smoke.rs Update pinned contract for queue show not-queued case (stdout + exit 0).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/mergify-queue/src/show.rs
Comment thread crates/mergify-core/src/http.rs
@mergify mergify Bot requested a review from a team June 25, 2026 12:20
@mergify

mergify Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 8 minutes 14 seconds in the queue, including 7 minutes 44 seconds running CI.

Required conditions to merge

@mergify mergify Bot added the queued label Jun 25, 2026
@mergify mergify Bot merged commit da360b4 into main Jun 25, 2026
23 of 43 checks passed
@mergify mergify Bot deleted the devs/JulianMaurin/feat/rust-cli-excellence/surface-invalid-simulate-config-config-error--e77d8f68 branch June 25, 2026 12:45
@mergify mergify Bot removed the queued label Jun 25, 2026
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.

4 participants