Skip to content

refactor(tui): share StyledGlyph across queue show/status renderers#1444

Merged
mergify[bot] merged 3 commits into
mainfrom
devs/jd/worktree-rust-port/share-styledglyph-across-queue-show-status--8ed9bb5f
May 28, 2026
Merged

refactor(tui): share StyledGlyph across queue show/status renderers#1444
mergify[bot] merged 3 commits into
mainfrom
devs/jd/worktree-rust-port/share-styledglyph-across-queue-show-status--8ed9bb5f

Conversation

@jd
Copy link
Copy Markdown
Member

@jd jd commented May 19, 2026

queue show and queue status both map an enum-ish state code to
an "(icon, ANSI style)" pair, but spelled the pairing two different
ways: show.rs::check_state_glyph returned (&'static str, Style),
while status.rs split it into separate status_icon /
batch_status_style functions. Same shape, different names, drifting
naturally as new states land.

Add a small StyledGlyph struct to mergify-tui and route both
callers through it. status.rs::status_icon + batch_status_style
collapse into a single batch_glyph(theme, code) -> StyledGlyph;
the early-return for the disabled-theme case is preserved (the
merged → green.dimmed() composition would otherwise emit a dim
escape when colors are off).

The third candidate — freeze/list.rs's active/scheduled coloring
— stays inline: it has no icon, just a two-arm color pick, and
forcing a StyledGlyph::new("", color) would add more noise than
it removes.

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

Depends-On: #1443

@jd
Copy link
Copy Markdown
Member Author

jd commented May 19, 2026

This pull request is part of a Mergify stack:

# Pull Request Link
1 refactor(ci): consolidate the CI-env scrubber into a shared testing module #1442
2 refactor: drop stale Phase X.Y doc markers and one inline color branch #1443
3 refactor(tui): share StyledGlyph across queue show/status renderers #1444 👈
4 refactor(queue): drop indexmap, group_by_scope returns a Vec<(K, V)> #1445
5 refactor(ci): swap uuid for getrandom in the GHA heredoc delimiter #1446
6 refactor(config): standardize the workspace on serde_yaml_ng for YAML parsing #1447
7 test(ci): add live smoke test for ci scopes select-all path #1460
8 feat(rust): port ci scopes to native Rust #1461
9 feat(ci): parse JUnit XML reports in native Rust #1465
10 feat(ci): encode JUnit cases as OTLP and upload to Mergify CI Insights #1466
11 feat(ci): promote ci junit-process from shim to native Rust #1467
12 feat(ci): promote ci junit-upload from shim to native as a deprecated alias #1468

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 19, 2026

Merge Protections

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

🟢 ⛓️ Depends-On Requirements

Wonderful, this rule succeeded.

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

🟢 🤖 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,})

sileht
sileht previously approved these changes May 20, 2026
@mergify mergify Bot requested a review from a team May 20, 2026 07:43
@jd jd force-pushed the devs/jd/worktree-rust-port/share-styledglyph-across-queue-show-status--8ed9bb5f branch from d729c8f to 66bd10c Compare May 20, 2026 08:42
@jd jd force-pushed the devs/jd/worktree-rust-port/drop-stale-phase-x-y-doc-markers-one-inline-color--477e0985 branch from e195107 to 1a26a25 Compare May 20, 2026 08:42
@jd jd temporarily deployed to func-tests-live May 20, 2026 08:42 — with GitHub Actions Inactive
@jd jd temporarily deployed to func-tests-live May 20, 2026 08:42 — with GitHub Actions Inactive
@jd
Copy link
Copy Markdown
Member Author

jd commented May 20, 2026

Revision history

# Type Changes Reason Date
1 initial d729c8f 2026-05-20 08:42 UTC
2 rebase d729c8f → 66bd10c (rebase only) 2026-05-20 08:42 UTC
3 rebase 66bd10c → c6ab109 (rebase only) 2026-05-20 09:05 UTC
4 rebase c6ab109 → 62b1222 (rebase only) 2026-05-21 07:25 UTC
5 rebase 62b1222 → 52176dc (rebase only) 2026-05-21 07:56 UTC
6 rebase 52176dc → 502583e (rebase only) 2026-05-21 12:39 UTC
7 rebase 502583e → ad033b8 (rebase only) 2026-05-22 07:10 UTC
8 rebase ad033b8 → 4d54d8c (rebase only) 2026-05-22 14:40 UTC
9 rebase 4d54d8c → 0028ed5 (rebase only) 2026-05-27 07:53 UTC
10 rebase 0028ed5 → de0a5de (rebase only) 2026-05-27 08:27 UTC
11 rebase de0a5de → bf480c8 (rebase only) 2026-05-27 10:04 UTC

@mergify mergify Bot dismissed sileht’s stale review May 20, 2026 08:43

Pull request has been modified.

@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 20, 2026 08:43 Failure
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 07:53 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/share-styledglyph-across-queue-show-status--8ed9bb5f branch from 0028ed5 to de0a5de Compare May 27, 2026 08:27
@jd jd temporarily deployed to func-tests-live May 27, 2026 08:27 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 08:28 Failure
@jd jd force-pushed the devs/jd/worktree-rust-port/share-styledglyph-across-queue-show-status--8ed9bb5f branch from de0a5de to bf480c8 Compare May 27, 2026 10:04
@jd jd temporarily deployed to func-tests-live May 27, 2026 10:04 — with GitHub Actions Inactive
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 10:06 Failure
jd and others added 3 commits May 28, 2026 09:42
…odule

`with_ci_env` (clear every CI-provider env var before applying
test overrides) lived in two copies — one inside the `tests`
sub-module of `detector.rs`, one inside `scopes_send.rs` (which
also had a `with_ci_env_async` counterpart). Both spelled the same
10-var list inline; both were drifting candidates.

Extract to a new `crate::testing` (`#[cfg(test)] mod testing`) with
the env-var list named as a const, sync + async variants behind one
helper that builds the override list. Each test module now does a
plain `use crate::testing::with_ci_env;`.

Net `-71 / +51`. No behavior change; the existing 49 `mergify-ci`
tests still pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Change-Id: Icd8c84417ad51b242cc8d9664d1cd40fff744497
Two unrelated polish items grouped because each is too small for
its own commit:

1. Module docs across `mergify-core`, `mergify-config`,
   `mergify-queue`, `mergify-cli`, and `mergify-py-shim` were
   pinned to the phase numbering the port plan used during
   bootstrapping ("Phase 1.2 populates…", "Phase 1.7 ports…",
   "Phase 6 deletes…"). Those references no longer aid the reader
   and contradict the project rule about not embedding phase
   numbers in long-lived artifacts — rewrite each docstring to
   describe the module's *current* shape and let `git log`
   reconstruct the trajectory if anyone needs it.

2. `freeze/list.rs::write_row` still had an `if theme.enabled { …
   theme.fg(c) } else { Style::new() }` branch around the Status
   cell — the same redundant indirection the earlier dedup pass
   removed elsewhere. `Theme::fg` already collapses to
   `Style::new()` when colors are disabled, so the outer branch
   is pure noise. Drop it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Change-Id: I477e098578452de9e955119241ce7b92c0641b22
`queue show` and `queue status` both map an enum-ish state code to
an "(icon, ANSI style)" pair, but spelled the pairing two different
ways: `show.rs::check_state_glyph` returned `(&'static str, Style)`,
while `status.rs` split it into separate `status_icon` /
`batch_status_style` functions. Same shape, different names, drifting
naturally as new states land.

Add a small `StyledGlyph` struct to `mergify-tui` and route both
callers through it. `status.rs::status_icon` + `batch_status_style`
collapse into a single `batch_glyph(theme, code) -> StyledGlyph`;
the early-return for the disabled-theme case is preserved (the
`merged → green.dimmed()` composition would otherwise emit a dim
escape when colors are off).

The third candidate — `freeze/list.rs`'s active/scheduled coloring
— stays inline: it has no icon, just a two-arm color pick, and
forcing a `StyledGlyph::new("", color)` would add more noise than
it removes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Change-Id: I8ed9bb5fffd46ecf75ff833df85b2ddf9812a4d8
@jd jd force-pushed the devs/jd/worktree-rust-port/share-styledglyph-across-queue-show-status--8ed9bb5f branch from bf480c8 to c05040f Compare May 28, 2026 07:44
@jd jd temporarily deployed to func-tests-live May 28, 2026 07:44 — with GitHub Actions Inactive
@mergify mergify Bot deployed to Mergify Merge Protections May 28, 2026 07:45 Active
@mergify mergify Bot requested a review from a team May 28, 2026 08:27
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 28, 2026

Merge Queue Status

This pull request spent 16 minutes 51 seconds in the queue, including 16 minutes 15 seconds running CI.

Required conditions to merge

mergify Bot added a commit that referenced this pull request May 28, 2026
@mergify mergify Bot added the queued label May 28, 2026
mergify Bot added a commit that referenced this pull request May 28, 2026
mergify Bot added a commit that referenced this pull request May 28, 2026
Base automatically changed from devs/jd/worktree-rust-port/drop-stale-phase-x-y-doc-markers-one-inline-color--477e0985 to main May 28, 2026 08:52
@mergify mergify Bot merged commit f494735 into main May 28, 2026
19 checks passed
@mergify mergify Bot deleted the devs/jd/worktree-rust-port/share-styledglyph-across-queue-show-status--8ed9bb5f branch May 28, 2026 08:56
@mergify mergify Bot removed the queued label May 28, 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.

3 participants