Skip to content

feat(events): cap the default page at one API page - #1766

Draft
jd wants to merge 2 commits into
mainfrom
devs/jd/jd/mrgfy-8533-mergify-cli-mergify-events-has-no-default-limit-so-the/make-default-page-fast-readable--901a6978
Draft

feat(events): cap the default page at one API page#1766
jd wants to merge 2 commits into
mainfrom
devs/jd/jd/mrgfy-8533-mergify-cli-mergify-events-has-no-default-limit-so-the/make-default-page-fast-readable--901a6978

Conversation

@jd

@jd jd commented Aug 7, 2026

Copy link
Copy Markdown
Member

mergify events with no flags took minutes on a busy repository:
--since defaulted to 24h but --limit defaulted to None, so the
command walked every page of the window — 100 events at a time —
before printing a line.

--limit now defaults to 100, which is exactly one page, so the
no-flag invocation makes one request and stops. The header says when
that cap bit and names the flag that reaches further back:

Mergifyio/monorepo · newest 100 events · 2026-08-09 12:24 → 2026-08-10 12:24 UTC
Older events in this window were not fetched — raise --limit.

That announcement is what makes a default cap acceptable rather than
a way of hiding events, and --json carries the same fact as
truncated, so a script reading size is never quietly reading a
default. --limit 0 is now a usage error: it would fetch a page and
print none of it, which is indistinguishable from an empty window.

This command is a low-level query over the activity log API. Deciding
which events are worth showing is the caller's job, and --pr and
--type already do it — so the only thing the default owes is a
bound.

Two things the same page was missing, and they are the reason
capping it is not enough:

A subject on every line. Event::pull_request() was decoded and
never read, so the repo-wide view — the default — never said which
pull request an event was about. It is now a column, cyan #N to
match queue status, suppressed under --pr where the header
already said it. The summary column also learned the types the page
is actually made of, measured over 500 consecutive events on
Mergifyio/monorepo rather than guessed: the queue state pair reports
the queue and its depth, action.label prints +conflict instead of
"Rule: label on unresolved" for the twentieth time, action.comment
prints its first line, action.request_reviews the reviewers.

Color. mergify_tui::Theme already had the palette and the
policy; list.rs used dim on every column, so success and
failure were the same grey. The outcome now carries its verdict —
green merged/success, red dequeued/failure, yellow aborted/pending —
and nothing else is colored, because coloring everything reproduces
the wall in a brighter palette.

2026-08-10
10:58  #38425  action.label        -review threads unresolved
11:57  #38237  action.queue.leave  merged
12:16  #38414  action.queue.leave  merged

truncated is observed by the fetch rather than inferred from
events.len() == limit, which called a window holding exactly limit
events truncated.

Before: minutes, indistinguishable lines. After: ~2s on the monorepo.

Refs MRGFY-8533.

Depends-On: #1765

`colors_enabled()` opened with `if cfg!(test) { return false }`, whose
comment claims tests "never depend on the dev's TTY". It cannot do
that: `cfg!(test)` is false whenever mergify-tui is compiled as a
dependency, so the guard only ever covered mergify-tui's own tests.
Every *consumer* crate's tests fell through to the real policy and read
the developer's environment — `FORCE_COLOR=1 cargo test -p
mergify-events` fails on main today, on escape sequences injected into
asserted output.

Gate on the recorded `--color` choice instead. `set_color_choice()` is
called from exactly one place, `detect_dispatch()` in main, so an unset
choice means the process did not come through the CLI: a test harness,
a doctest, an embedder. Colors stay off there, in any environment,
across every crate.

`resolve_enabled()` takes the `Option<ColorChoice>` so the new case is
covered by the existing precedence unit test rather than by global
state.

Refs MRGFY-8533.

Change-Id: Id7eb12b906409122000a14722e5ce172ab93cb4c
@jd

jd commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 fix(tui): gate color on the CLI entry point, not cfg!(test) #1765
2 feat(events): make the default page fast and readable #1766 👈

@mergify
mergify Bot had a problem deploying to Mergify Merge Protections August 7, 2026 16:06 Failure
@jd
jd temporarily deployed to func-tests-live August 7, 2026 16:06 — with GitHub Actions Inactive
@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 2 of 7 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 👀 Review Requirements 👀 reviews
🔴 🔎 Reviews 👀 reviews
🟢 ⛓️ Depends-On Requirements
🟢 🤖 Continuous Integration
🟢 Enforce conventional commit
🟢 📕 PR description
🟢 🚦 Auto-queue

🔴 👀 Review Requirements

Waiting for

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

🔴 🔎 Reviews

Waiting for

  • #review-requested = 0
This rule is failing.
  • #review-requested = 0
  • #changes-requested-reviews-by = 0
  • #review-threads-unresolved = 0

Show 5 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

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|internal|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?!?:

🟢 📕 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 August 7, 2026 16:13
`mergify events` with no flags took minutes on a busy repository:
`--since` defaulted to 24h but `--limit` defaulted to `None`, so the
command walked every page of the window — 100 events at a time —
before printing a line.

`--limit` now defaults to 100, which is exactly one page, so the
no-flag invocation makes one request and stops. The header says when
that cap bit and names the flag that reaches further back:

    Mergifyio/monorepo · newest 100 events · 2026-08-09 12:24 → 2026-08-10 12:24 UTC
    Older events in this window were not fetched — raise --limit.

That announcement is what makes a default cap acceptable rather than
a way of hiding events, and `--json` carries the same fact as
`truncated`, so a script reading `size` is never quietly reading a
default. `--limit 0` is now a usage error: it would fetch a page and
print none of it, which is indistinguishable from an empty window.

This command is a low-level query over the activity log API. Deciding
*which* events are worth showing is the caller's job, and `--pr` and
`--type` already do it — so the only thing the default owes is a
bound.

Two things the same page was missing, and they are the reason
capping it is not enough:

**A subject on every line.** `Event::pull_request()` was decoded and
never read, so the repo-wide view — the default — never said which
pull request an event was about. It is now a column, cyan `#N` to
match `queue status`, suppressed under `--pr` where the header
already said it. The summary column also learned the types the page
is actually made of, measured over 500 consecutive events on
Mergifyio/monorepo rather than guessed: the queue state pair reports
the queue and its depth, `action.label` prints `+conflict` instead of
"Rule: label on unresolved" for the twentieth time, `action.comment`
prints its first line, `action.request_reviews` the reviewers.

**Color.** `mergify_tui::Theme` already had the palette and the
policy; `list.rs` used `dim` on every column, so `success` and
`failure` were the same grey. The outcome now carries its verdict —
green merged/success, red dequeued/failure, yellow aborted/pending —
and nothing else is colored, because coloring everything reproduces
the wall in a brighter palette.

    2026-08-10
    10:58  #38425  action.label        -review threads unresolved
    11:57  #38237  action.queue.leave  merged
    12:16  #38414  action.queue.leave  merged

`truncated` is observed by the fetch rather than inferred from
`events.len() == limit`, which called a window holding exactly `limit`
events truncated.

Before: minutes, indistinguishable lines. After: ~2s on the monorepo.

Refs MRGFY-8533.

Change-Id: I901a6978c85e9c4bf442ac4c3303b6de1da3be87
@jd jd changed the title feat(events): make the default page fast and readable feat(events): cap the default page at one API page Aug 10, 2026
@jd
jd force-pushed the devs/jd/jd/mrgfy-8533-mergify-cli-mergify-events-has-no-default-limit-so-the/make-default-page-fast-readable--901a6978 branch from a34e21d to bf667db Compare August 10, 2026 12:25
@jd

jd commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

Revision history

# Type Changes Reason Date
1 initial a34e21d 2026-08-10 12:25 UTC
2 content a34e21d → bf667db 2026-08-10 12:25 UTC

@jd
jd deployed to func-tests-live August 10, 2026 12:25 — with GitHub Actions Active
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections August 10, 2026 12:26 Failure
@jd

jd commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

Reworked and force-pushed (mergify stack push amends, so the diff above changed under the same PR): a34e21dbf667db.

The type-exclusion design is out. mergify events is a low-level query over the activity log API — noise is not a defect in it, and filtering is what --pr and --type are for. Removed:

  • --all — more events is --limit N.
  • the default bookkeeping-type filter, and everything it dragged in: the ≤5-page fetch budget, hidden in --json, and the "hid N merge queue state events" line. The exclusion was client-side (the API filters by inclusion only), which is what forced the page budget in the first place.

What's left is the actual bug and its fix: --limit had no default, so the command walked every page of the window. It now defaults to 100 — exactly one page, one request, ~2s on the monorepo — and the header says when the cap bit and names --limit as the way further back. --limit 0 is now a usage error rather than an empty-looking page.

Kept, since they were asked for directly: the cyan #N pull-request column, the coloured outcome, and the truncation notice.

Net −342 lines against the previous revision.

Base automatically changed from devs/jd/jd/mrgfy-8533-mergify-cli-mergify-events-has-no-default-limit-so-the/gate-color-cli-entry-point-cfg-test--d7eb12b9 to main August 10, 2026 12:30
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