refactor(rust): dedupe emit-helper boilerplate across command crates#1438
Merged
mergify[bot] merged 2 commits intoMay 26, 2026
Conversation
This was referenced May 19, 2026
Member
Author
|
This pull request is part of a Mergify stack:
|
This was referenced May 19, 2026
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 ⛓️ Depends-On RequirementsWonderful, this rule succeeded.Requirement based on the presence of
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 👀 Review RequirementsWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 ReviewsWonderful, this rule succeeded.
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
721eacd to
a6bf822
Compare
Member
Author
Revision history
|
50fcb0d to
f322a06
Compare
a6bf822 to
ac72c27
Compare
This was referenced May 19, 2026
Round-trip the three remaining freeze mutations: - `freeze create` — `POST /v1/repos/<r>/scheduled_freeze` with the Python `CreateScheduledFreezePayload` shape: `start`/`end` always present (null for open-ended emergency freezes), `matching_conditions`/`exclude_conditions` keys omitted when the user passed no `-c`/`-e` flags. When `--timezone` is left off, falls back to `iana-time-zone::get_timezone()` — same role as Python's `tzlocal.get_localzone_name()`. - `freeze update` — `PATCH /v1/repos/<r>/scheduled_freeze/<id>` with skip-if-none on every field so PATCH semantics work correctly: a flag the user didn't pass doesn't touch the stored field. - `freeze delete` — `POST /v1/repos/<r>/scheduled_freeze/<id>/delete` with `delete_reason` in the body only when supplied (the API requires it for active freezes; the CLI lets the server reject a missing reason rather than pre-validating). Adds `Client::patch` on the core HTTP client, a shared `mergify-freeze::common` module (wire-format struct, naive-DT parser, system-timezone detection, per-freeze human printer used by `create` and `update`), and `iana-time-zone` as a new dependency. The Python implementation of each command is left in place but no longer reachable via the binary, since clap now dispatches the whole freeze group natively. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Change-Id: I653dbf47080f439f8c3500a7a526e46d707fc639
A grab-bag of small DRY wins surfaced by the post-port review: - Add `Output::emit_json_value(&serde_json::Value)` to `mergify-core`. The `--json` passthrough commands (`queue status`, `queue show`, `freeze list`) all carried byte-identical `emit_json` private helpers that pretty-printed a value to either the JSON or the human sink. Centralize once. - Drop the `enabled_fg` wrapper in `queue show`: its body was exactly what `Theme::fg` already does, so call `theme.fg(...)` directly. Saves a helper + 13 call-site rewrites of the same redundant indirection. - Drop spurious `response.field.clone()` calls in `queue pause`, `config validate`, and `config simulate`. The closures handed to `Output::emit` borrow from the outer `&Response` parameter; the trait method doesn't require `'static`, so the clones were defensive noise. No behavior change. All workspace tests still pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Change-Id: Ied32eef956ebd71a03005530cc394612afd46e5d
00020fd to
02003f4
Compare
Base automatically changed from
devs/jd/worktree-rust-port/port-freeze-create-update-delete-native-rust--653dbf47
to
main
May 26, 2026 07:19
kozlek
approved these changes
May 26, 2026
This was referenced May 26, 2026
sileht
approved these changes
May 26, 2026
Contributor
Merge Queue Status
This pull request spent 3 hours 18 minutes 5 seconds in the queue, including 3 hours 17 minutes 47 seconds running CI. Waiting for
All conditions
ReasonNew commits have been added to the draft pull request that were not made by Mergify HintIf you want to requeue this pull request, you can post a |
38 tasks
Member
Author
|
@Mergifyio queue |
Member
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
This pull request spent 15 minutes 51 seconds in the queue, including 15 minutes 5 seconds running CI. Required conditions to merge
|
38 tasks
Contributor
☑️ Command
|
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.
A grab-bag of small DRY wins surfaced by the post-port review:
Output::emit_json_value(&serde_json::Value)tomergify-core. The--jsonpassthrough commands (queue status,queue show,freeze list) all carried byte-identicalemit_jsonprivate helpers that pretty-printed a value to eitherthe JSON or the human sink. Centralize once.
enabled_fgwrapper inqueue show: its body wasexactly what
Theme::fgalready does, so calltheme.fg(...)directly. Saves a helper + 13 call-site rewrites of the same
redundant indirection.
response.field.clone()calls inqueue pause,config validate, andconfig simulate. The closures handed toOutput::emitborrow from the outer&Responseparameter; thetrait method doesn't require
'static, so the clones weredefensive noise.
No behavior change. All workspace tests still pass.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Depends-On: #1437