Skip to content

merge queue: embarking main (7cbb190) and #1359 together#1433

Closed
mergify[bot] wants to merge 2 commits into
mainfrom
mergify/merge-queue/6ab66b691e
Closed

merge queue: embarking main (7cbb190) and #1359 together#1433
mergify[bot] wants to merge 2 commits into
mainfrom
mergify/merge-queue/6ab66b691e

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented May 19, 2026

🎉 This pull request has been checked successfully and will be merged soon. 🎉

Branch main (7cbb190) and #1359 are embarked together for merge.

This pull request has been created by Mergify to speculatively check the mergeability of #1359.
You don't need to do anything. Mergify will close this pull request automatically when it is complete.

Required conditions of queue rule default for merge:

Required conditions to stay in the queue:

---
checking_base_sha: 7cbb190ed3464bad3086c5df7bce1a5c102a105b
previous_failed_batches: []
pull_requests:
  - number: 1359
    scopes: []
scopes: []
...

jd and others added 2 commits May 18, 2026 10:20
The Rust binary now serves ``mergify queue status`` natively. The
Python implementation (``mergify_cli/queue/cli.py:status`` plus the
batch/scope/topology helpers it depended on) is removed in the
same PR — the port-and-delete rule we adopted in #1322 keeps a
single live copy of every command.

This change also introduces the ``mergify-tui`` crate. The
colored-tree rendering primitives are written there from the
start (``Theme`` + relative-time formatter + box-drawing
characters) rather than inlined in ``status.rs`` and extracted
later — they're general-purpose and will be needed by every
command with structured human output (``queue show``,
``freeze list``, future ports).

``mergify queue status [-r REPO] [-t TOKEN] [-u URL] [-b BRANCH]
[--json]``:

1. Resolves repository / token / API URL via the shared
   ``mergify_queue::auth`` resolver introduced in #1352.
2. Fetches ``GET /v1/repos/<repo>/merge-queue/status``, optionally
   with ``?branch=<branch>`` (URL-encoded via
   ``url::form_urlencoded::byte_serialize``).
3. With ``--json``: pretty-prints the raw response. The schema is
   Mergify's API contract, not this CLI's, so we deserialize into
   ``serde_json::Value`` and emit verbatim — unknown fields and
   future schema additions survive the round trip.
4. Without ``--json``: deserializes into a typed ``StatusView``
   that uses ``#[serde(default)] Option<…>`` for every field the
   Mergify API has historically treated as optional/nullable
   (matches the port checklist from #1357), then renders a
   header, an optional pause indicator, the batch tree (grouped
   by scope when there is more than one), and the waiting-PR
   list. Status icons (``● ◑ ◌ ✓ ✗ ◎ ⏳ ↻ ⏰ ❄``), tree
   characters (``├── └── │   ``), and relative times
   (``5m ago`` / ``~1h``) match the Python implementation.

The ``mergify-tui`` crate has three modules:

- ``theme``: ``Theme`` struct with TTY/``NO_COLOR``-aware
  enable/disable. Pre-built named styles (``bold``, ``dim``,
  ``cyan``/``green``/``red``/``yellow``/``magenta``, ``warn``)
  plus a ``fg(AnsiColor)`` helper for domain-specific palettes.
  ``Theme::detect`` is the production constructor;
  ``Theme::new(enabled)`` is for tests.
- ``time``: ``relative_time(iso, now, future)`` — coarse
  ``Ns``/``Nm``/``Nh``/``Nd`` formatter mirroring the Python
  CLI's ``_relative_time``. Empty string on parse failure so a
  malformed timestamp doesn't abort the surrounding render.
- ``tree``: Unicode box-drawing constants (``BRANCH``,
  ``LAST_BRANCH``, ``CONTINUATION``, ``LAST_CONTINUATION``) plus
  ``branch_chars(is_last)`` to pick both prefixes for a row in
  one call.

Tests:

- ``mergify-tui``: 11 tests (theme on/off, relative-time units +
  parse failure + future prefix, tree-character pairing).
- ``build_path`` covers no-branch, branch, and URL-encoding of a
  branch name with slashes + spaces.
- ``topological_sort`` covers parents-before-children ordering
  and tolerance of ``parent_ids`` that reference missing batches.
- ``group_by_scope`` covers the ``[]`` → ``"default"`` fallback
  and multi-scope batches appearing under each scope they claim.
- ``status_icon`` covers known + unknown codes.
- End-to-end wiremock tests: empty queue, paused queue, batches +
  waiting PRs, multi-scope grouping, ``?branch=…`` query
  threading, JSON-passthrough preserving an ``extra_field``,
  and tolerance of a response that omits all optional fields.

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

Change-Id: I8cebcd325f05173dfa41083da2ec6516a6ec3a3f
@mergify mergify Bot deployed to Mergify Merge Protections May 19, 2026 07:41 Active
@mergify mergify Bot temporarily deployed to func-tests-live May 19, 2026 07:41 Inactive
@mergify mergify Bot closed this May 19, 2026
@mergify mergify Bot deleted the mergify/merge-queue/6ab66b691e branch May 19, 2026 07:56
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.

1 participant