Skip to content

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

Merged
mergify[bot] merged 1 commit into
mainfrom
devs/jd/jd/mrgfy-8533-mergify-cli-mergify-events-has-no-default-limit-so-the/make-default-page-fast-readable--901a6978
Aug 11, 2026
Merged

feat(events): cap the default page at one API page#1766
mergify[bot] merged 1 commit 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.

@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

🟢 All 6 merge protections satisfied — ready to merge.

Show 6 satisfied protections

🟢 🤖 Continuous Integration

  • all of:
    • check-success=ci-gate

🟢 👀 Review Requirements

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

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

🟢 🔎 Reviews

  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 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
@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
3 content bf667db → 0b3ce00 2026-08-11 12:36 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
@jd
jd marked this pull request as ready for review August 11, 2026 09:41
Copilot AI lite review requested due to automatic review settings August 11, 2026 09:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the usability and performance of mergify events by bounding the default fetch to a single API page (100 events), while making the output more informative (PR subject per line, clearer summaries, and outcome-based coloring) and explicitly signaling truncation in both human and JSON output.

Changes:

  • Default --limit to 100 (one API page) and reject --limit 0 as a usage error.
  • Add explicit truncation reporting (truncated) from the fetch layer and surface it in both human header text and --json.
  • Improve human timeline readability: add PR column (repo-wide), better per-type summaries, and outcome-based coloring via the theme.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/mergify-tui/src/theme.rs Changes color enablement policy to depend on a recorded CLI color choice (via set_color_choice) rather than cfg!(test).
crates/mergify-events/src/queue_leave.rs Adapts to the new fetch return type (Log) by reading log.events.
crates/mergify-events/src/list.rs Implements default limit behavior, truncation-aware header/JSON, PR column, improved summaries, and outcome coloring; expands tests accordingly.
crates/mergify-events/src/client.rs Changes fetch to return { events, truncated } and observes truncation based on pagination/overshoot rather than inferring from len == limit.
crates/mergify-events/Cargo.toml Adds direct anstyle dependency for style handling in the events renderer/tests.
crates/mergify-cli/src/snapshots/mergify__tests__cli_schema_golden.snap Updates CLI schema snapshot for events --limit default and help text changes.
crates/mergify-cli/src/main.rs Makes --limit non-optional with a default, adds validation rejecting zero, and updates related tests/docs.
Cargo.lock Records the added anstyle dependency for mergify-events.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/mergify-events/src/list.rs Outdated
`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 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 bf667db to 0b3ce00 Compare August 11, 2026 12:36
@jd
jd deployed to func-tests-live August 11, 2026 12:36 — with GitHub Actions Active
@mergify
mergify Bot deployed to Mergify Merge Protections August 11, 2026 12:36 Active
@jd

jd commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

Force-pushed (bf667db0b3ce00) — mergify stack push amends, so the diff above changed under the same PR.

Two things:

cargo test -p mergify-events -p mergify-cli green locally.

@mergify
mergify Bot requested a review from a team August 11, 2026 12:46
@mergify

mergify Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-11 16:34 UTC · Rule: default · triggered by merge protections
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-11 16:34 UTC · at 0b3ce009cb17113d9ebe2a10f7404a32eb15cc6c · squash

This pull request spent 24 seconds in the queue, including 5 seconds running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 7daf2ea into main Aug 11, 2026
22 checks passed
@mergify
mergify Bot deleted the devs/jd/jd/mrgfy-8533-mergify-cli-mergify-events-has-no-default-limit-so-the/make-default-page-fast-readable--901a6978 branch August 11, 2026 16:34
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.

4 participants