Skip to content

feat(rust): add mergify-core foundation types (Phase 1.2a)#1280

Merged
mergify[bot] merged 1 commit intomainfrom
devs/jd/worktree-rust-port/add-mergify-core-foundation-types-phase-1-2a--f50b81bb
Apr 27, 2026
Merged

feat(rust): add mergify-core foundation types (Phase 1.2a)#1280
mergify[bot] merged 1 commit intomainfrom
devs/jd/worktree-rust-port/add-mergify-core-foundation-types-phase-1-2a--f50b81bb

Conversation

@jd
Copy link
Copy Markdown
Member

@jd jd commented Apr 21, 2026

Populates mergify-core with the three type-system pieces every
ported command will depend on:

  • exit_code::ExitCode — typed mirror of Python's ExitCode
    enum with the locked numeric values from docs/exit-codes.md. Code
    2 is reserved for clap argument errors, matching Python's Click
    reservation.
  • error::CliError — top-level error enum with deterministic
    exit_code() mapping. Today it covers Configuration,
    InvalidState, StackNotFound, Conflict, Generic, and Io variants;
    HTTP and Git variants land alongside their implementations in
    1.2b / 1.2d.
  • output::Output trait + StdioOutput impl — commands emit
    through a trait object so the --json vs human rendering
    decision is a single place (stdout purity invariant from Phase
    0.3 enforced by construction). Tests capture output via
    Arc<Mutex<Vec<u8>>> sinks.

Deferred to separate PRs so each is reviewable in isolation:

  • 1.2b mergify-core::http — reqwest wrapper, retry, typed errors
  • 1.2c colored/spinner affordances on top of StdioOutput
  • 1.2d GitOps trait (only needed for stack commands)
  • Config loading, interactive prompts — added as ported commands
    demand them

7 unit tests cover the locked exit-code values, the CliError -> ExitCode mapping, and the JSON/human split.

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

@jd
Copy link
Copy Markdown
Member Author

jd commented Apr 21, 2026

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(rust): add mergify-core foundation types (Phase 1.2a) #1280 👈
2 feat(rust): add mergify-core::http with retry + typed errors (Phase 1.2b) #1281
3 feat(rust): port config validate to native Rust (Phase 1.3) #1282
4 test: add port-inventory guard to catch un-ported Python commands #1296
5 ci: add Rust release workflow targeting GitHub Release assets #1297
6 feat(rust): port config simulate to native Rust (Phase 1.3b) #1298
7 feat(rust): port ci scopes-send to native Rust (Phase 1.4) #1300
8 feat(rust): port queue pause and unpause to native Rust (Phase 1.5) #1301
9 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 21, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 🤖 Continuous Integration

Wonderful, this rule succeeded.
  • all of:
    • check-success=ci-gate

🟢 👀 Review Requirements

Wonderful, this rule succeeded.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

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

🟢 🔎 Reviews

Wonderful, this rule succeeded.
  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

Wonderful, this rule succeeded.
  • body ~= (?ms:.{48,})

@mergify mergify Bot requested a review from a team April 21, 2026 11:18
@jd jd force-pushed the devs/jd/worktree-rust-port/add-mergify-py-shim-embedded-python-fallback--0c73b039 branch from 8f404aa to 27194e6 Compare April 21, 2026 13:13
@jd jd force-pushed the devs/jd/worktree-rust-port/add-mergify-core-foundation-types-phase-1-2a--f50b81bb branch from 8f2f3d5 to f1c0421 Compare April 21, 2026 13:13
@jd
Copy link
Copy Markdown
Member Author

jd commented Apr 21, 2026

Revision history

# Type Changes Date
1 initial 8f2f3d5 2026-04-21 13:13 UTC
2 rebase 8f2f3d5 → f1c0421 2026-04-21 13:13 UTC
3 content f1c0421 → 56ba494
4 rebase 56ba494 → 1b5b259
5 content 1b5b259 → ddfcde3
6 rebase ddfcde3 → 56033c1
7 rebase 56033c1 → 9d30ade 2026-04-23 19:02 UTC
8 rebase 9d30ade → 6eae5c0 2026-04-24 13:41 UTC

@mergify mergify Bot had a problem deploying to Mergify Merge Protections April 21, 2026 13:14 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/add-mergify-core-foundation-types-phase-1-2a--f50b81bb branch from f1c0421 to 56ba494 Compare April 22, 2026 13:36
@mergify mergify Bot had a problem deploying to Mergify Merge Protections April 22, 2026 13:36 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/add-mergify-core-foundation-types-phase-1-2a--f50b81bb branch from 56ba494 to 1b5b259 Compare April 22, 2026 18:25
@mergify mergify Bot had a problem deploying to Mergify Merge Protections April 22, 2026 18:25 Failure
@jd jd marked this pull request as ready for review April 22, 2026 20:19
@jd jd requested a review from Copilot April 22, 2026 20:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds the initial “foundation types” to mergify-core needed by ported Rust commands, covering structured exit codes, a top-level CLI error type, and a JSON/human output abstraction.

Changes:

  • Introduce exit_code::ExitCode with fixed numeric values matching the documented contract (with code 2 reserved for clap usage errors).
  • Add error::CliError with a deterministic CliError -> ExitCode mapping.
  • Add output::Output trait and StdioOutput implementation (plus unit tests) to centralize JSON vs human rendering and stdout/stderr discipline.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/mergify-core/src/output.rs Introduces output abstraction + stdio implementation + tests for JSON/human behavior
crates/mergify-core/src/lib.rs Exposes the new core modules and re-exports key types
crates/mergify-core/src/exit_code.rs Defines structured exit codes and tests for locked numeric values
crates/mergify-core/src/error.rs Defines CliError and its stable mapping to ExitCode with tests
crates/mergify-core/Cargo.toml Adds serde/serde_json/thiserror dependencies for the new modules
Cargo.lock Records the new Rust dependencies in the lockfile

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

Comment thread crates/mergify-core/src/output.rs Outdated
Comment thread crates/mergify-core/src/output.rs Outdated
Comment thread crates/mergify-core/src/output.rs Outdated
@jd jd force-pushed the devs/jd/worktree-rust-port/add-mergify-py-shim-embedded-python-fallback--0c73b039 branch from 7617830 to 6c4294a Compare April 23, 2026 07:32
@jd jd force-pushed the devs/jd/worktree-rust-port/add-mergify-core-foundation-types-phase-1-2a--f50b81bb branch from 1b5b259 to ddfcde3 Compare April 23, 2026 07:32
@mergify mergify Bot had a problem deploying to Mergify Merge Protections April 23, 2026 07:32 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/add-mergify-core-foundation-types-phase-1-2a--f50b81bb branch from ddfcde3 to 56033c1 Compare April 23, 2026 13:14
@mergify mergify Bot had a problem deploying to Mergify Merge Protections April 23, 2026 13:14 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/add-mergify-core-foundation-types-phase-1-2a--f50b81bb branch from 56033c1 to 9d30ade Compare April 23, 2026 19:02
@jd jd force-pushed the devs/jd/worktree-rust-port/add-mergify-py-shim-embedded-python-fallback--0c73b039 branch from 91c97d0 to b10a54b Compare April 23, 2026 19:02
@mergify mergify Bot had a problem deploying to Mergify Merge Protections April 23, 2026 19:03 Failure
sileht
sileht previously approved these changes Apr 24, 2026
@mergify mergify Bot requested a review from a team April 24, 2026 09:05
Base automatically changed from devs/jd/worktree-rust-port/add-mergify-py-shim-embedded-python-fallback--0c73b039 to main April 24, 2026 09:28
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 24, 2026

@jd this pull request is now in conflict 😩

@mergify mergify Bot added the conflict label Apr 24, 2026
Populates ``mergify-core`` with the three type-system pieces every
ported command will depend on:

- ``exit_code::ExitCode`` — typed mirror of Python's ``ExitCode``
  enum with the locked numeric values from docs/exit-codes.md. Code
  2 is reserved for clap argument errors, matching Python's Click
  reservation.
- ``error::CliError`` — top-level error enum with deterministic
  ``exit_code()`` mapping. Today it covers Configuration,
  InvalidState, StackNotFound, Conflict, Generic, and Io variants;
  HTTP and Git variants land alongside their implementations in
  1.2b / 1.2d.
- ``output::Output`` trait + ``StdioOutput`` impl — commands emit
  through a trait object so the ``--json`` vs human rendering
  decision is a single place (stdout purity invariant from Phase
  0.3 enforced by construction). Tests capture output via
  ``Arc<Mutex<Vec<u8>>>`` sinks.

Deferred to separate PRs so each is reviewable in isolation:

- 1.2b ``mergify-core::http`` — reqwest wrapper, retry, typed errors
- 1.2c colored/spinner affordances on top of ``StdioOutput``
- 1.2d ``GitOps`` trait (only needed for stack commands)
- Config loading, interactive prompts — added as ported commands
  demand them

7 unit tests cover the locked exit-code values, the ``CliError ->
ExitCode`` mapping, and the JSON/human split.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Change-Id: If50b81bb5d0accf1d80c25dc14ed259b30135895
@jd jd force-pushed the devs/jd/worktree-rust-port/add-mergify-core-foundation-types-phase-1-2a--f50b81bb branch from 9d30ade to 6eae5c0 Compare April 24, 2026 13:41
@mergify mergify Bot dismissed sileht’s stale review April 24, 2026 13:41

Pull request has been modified.

@mergify mergify Bot deployed to Mergify Merge Protections April 24, 2026 13:41 Active
@mergify mergify Bot removed the conflict label Apr 24, 2026
@mergify mergify Bot requested a review from a team April 24, 2026 15:59
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 27, 2026

Merge Queue Status

This pull request spent 7 minutes 23 seconds in the queue, including 7 minutes 5 seconds running CI.

Required conditions to merge

mergify Bot added a commit that referenced this pull request Apr 27, 2026
@mergify mergify Bot added the queued label Apr 27, 2026
@mergify mergify Bot merged commit 56cf5f5 into main Apr 27, 2026
23 checks passed
@mergify mergify Bot deleted the devs/jd/worktree-rust-port/add-mergify-core-foundation-types-phase-1-2a--f50b81bb branch April 27, 2026 05:30
@mergify mergify Bot removed the queued label Apr 27, 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.

5 participants