Skip to content

Group the ticket card's pull requests and Trac patches so long lists stay short - #713

Merged
ryanwelcher merged 3 commits into
trunkfrom
ryanwelcher/add-toggle-to-show-hide-linked-prs-and-patches
Oct 26, 2026
Merged

ryanwelcher merged 3 commits into
trunkfrom
ryanwelcher/add-toggle-to-show-hide-linked-prs-and-patches

Conversation

@ryanwelcher

@ryanwelcher ryanwelcher commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Why

A ticket with many linked pull requests or Trac patches pushed the rest of the ticket card down, often by several screens. #65252 has 48 pull requests and #17817 has 44 patch files. Closes #709.

What changes

The two lists in the ticket card, Linked pull requests and Trac attachments, are now shown the same way:

  • Nothing applied: each list shows its newest item at the top. That is the one marked Latest when the ticket's latest patch is in that list.
  • A pull request or a patch applied (from Trac or a local file): the applied one is the only item shown outside the groups, in a green box in its own list. Neither list pins a newest item.
  • Everything else goes into groups that always start folded. Each heading is the button and says what it holds: Other open PRs (N) and Closed PRs (N) (or Open PRs and Other closed PRs when the one shown is closed; merged counts as closed), and Other attachments (N), or Attachments (N) when nothing is shown above.
  • Attachments are listed newest first, like pull requests. Trac lists them oldest first.
  • An applied Trac attachment now has an Applied badge and the green box, like a checked-out pull request.

Deliberately not in this PR: remembering which groups you opened across restarts, and any change to how the Latest patch is picked.

How to test this

Platforms: any. The change is renderer-only, with no paths, spawning or signing involved.

The journeys cover the folding, the labels and the PR-checked-out state: npm run test:e2e:hidden -- tests/e2e/journeys/ticket-card.spec.js tests/e2e/journeys/pr-checkout.spec.js tests/e2e/journeys/i18n.spec.js. What they cannot reach is a real ticket on Trac and GitHub, and applying a Trac patch, so here are the steps for that.

Starting state: a Core site with nothing applied, on the current head of this branch (the Buildkite build for 82f3703, or a local build).

  1. Link ticket 43502. The card reads it from GitHub and Trac by itself.
    • Linked pull requests shows one pull request, the newest, then a folded Other open PRs (3).
    • Trac attachments shows 43502.7.diff, then a folded Other attachments (6).
    • Whichever of the two is the ticket's most recent patch has the Latest badge.
  2. Click Other attachments (6). Six files appear, newest first. Click it again and they fold away.
  3. Click Apply… on 43502.7.diff and apply it. It applies cleanly to today's trunk.
    • 43502.7.diff is now in a green box with an Applied badge, followed only by Other attachments (6), folded.
    • Linked pull requests still shows only Open PRs (4), folded.
  4. Revert the patch, then link ticket 65252 instead.
    • Linked pull requests shows #11872 with an Apply… button, then Other open PRs (40) and Closed PRs (7), both folded.
  5. Apply #11872. It is now in the green box with Applied, followed only by Other open PRs (40) and Closed PRs (7), folded. No other pull request is shown outside the groups.

What must not have happened:

  • No pull request or patch is missing from the groups. The counts in the headings add up, together with the one shown above, to the whole list.
  • With something applied, no second row (the newest) appears under the green box in either list.
  • Unlinking and relinking does not lose the applied patch or pull request.

Risks and limitations

  • An applied Trac attachment is matched by its filename, the only thing the app stores about the applied patch. A local file with the same name as a Trac attachment marks that row as applied. The real fix is to store the attachment's address on the applied record. That changes what electron-store holds and needs a migration, so it is left for a follow-up.
  • Groups start folded when the card is first drawn. A group you have opened stays open when you then apply something.
  • The docs screenshot linked-pull-requests.png was not regenerated. The screenshot script now opens every group first, so the caption stays true when it is.
  • Review: 2 [fix here] and 1 [follow-up] on the last pass. Both [fix here] items are fixed; see the review outcome below.

Related

Fixes #709


Design decisions and alternatives considered
  • Rejected: show the first few rows plus "Show all". It works for pull requests, but Trac lists attachments oldest first, and pull requests have an open or closed state that attachments lack. Grouping by state reads better for pull requests, and one rule for both lists was worth more than a per-list tweak.
  • Rejected: fold groups only when they are long (more than three items). Tried first. It made the two lists behave differently depending on their size, which is the inconsistency this PR set out to remove. Every group now starts folded.
  • The newest is pinned per list, not only the ticket's overall latest. Each list then has something visible at the top. When the overall latest is in a list, it is that list's pinned item, so the Latest badge is never folded away while nothing is applied.
  • Once something is applied, nothing else is pinned. The work has been chosen, so the newest no longer needs a spot in view.
  • Headings say "Other" only when an item is shown above them, and they go through _n so each language gets the right form for its count.
Review outcome (required, see AGENTS.md)

Two passes against .github/instructions/code-review.instructions.md, each by a separate agent with fresh context, before the PR was opened.

First pass, on the PR grouping only: 3 [fix here] · 0 [follow-up]. All 3 fixed:

  • the Latest badge could sit inside a folded group;
  • the group and the badge read the state separately;
  • three journeys located the group toggle three different ways (now ui.listGroupToggle).

Second pass, on the whole branch: 2 [fix here] · 1 [follow-up]. All 3 earlier findings confirmed resolved.

  • [fix here], fixed in 82f3703: the counted headings now use _n.

  • [fix here], fixed in 82f3703: a pr-checkout.spec.js check that could not fail now asserts that exactly one group heading exists.

  • [follow-up], deferred: applied attachments are matched by filename (see Risks). This needs a store migration.

  • Review: completed. Reviewer: separate agent context. Reviewed head b4d9925 against base d6347eb (merge base with trunk; no PR existed yet). Scope: git diff d6347eb...b4d9925, working tree clean. Lint and unit suite green before the review.

  • Since review: b4d9925 → 82f3703, the commit fixing the two [fix here] findings plus the review's style notes (stale comments, screenshot preparation, an order check written against the markup). Not re-reviewed by an agent. Lint, the unit suite (2223 pass) and the touched journeys were run on 82f3703.

The journey i18n.spec.js › "the Logs are fully translatable" fails on this branch and also on trunk's code (a strict-mode clash on .log-pane-note). It is unrelated to this change.

Implementation notes
  • What is shown, how it is grouped and the headings all live in src/renderer/ticket-card.cjs (pinNewest, pullRequestGroups, attachmentGroups), with unit tests in tests/unit/ticket-card.test.cjs. pullRequestStateKey feeds both the badge and the group, so they cannot disagree.
  • The component draws both lists through one GroupedRows, using Collapsible from @wordpress/ui. Each group heading is an h4 wrapping the trigger button.
  • index.jsx passes workApplied={Boolean(pullRequest || appliedPatch)} and, for attachments, appliedLabel (the applied patch's label).
  • New shared locator: ui.listGroupToggle(card, label) in tests/e2e/helpers/ui.cjs.

Screenshots or recording

Ticket with many patch files, nothing applied (#17817)

linked_ticket_with_large_number_of_patches_intial_state

Ticket with many pull requests, nothing applied (#65252)

linked_ticket_with_large_number_of_PRS_initial_sttate

Trac patch applied (#43502)
linked_ticket_patch_applied

Pull request applied (#65252)
linked_ticket_pr_applied

🤖 Generated with Claude Code

A ticket with many pull requests pushed the rest of the card down (#709).
The list is now two groups, Open and Closed, each heading a button that
folds it and says how many it holds. Open starts unfolded, Closed folded.

The applied pull request sits above both groups in a tinted box, and the
latest one above them too, so folding never hides either.
Both lists now follow one rule (#709). With nothing applied, each shows
its newest, the ticket's latest patch whenever that is in the list. With
a pull request or a patch applied, only the applied one is shown, in its
own list. Everything else is in groups that begin folded, under headings
that say what they hold: "Other open PRs", "Closed PRs", "Other
attachments". Attachments are listed newest first, as the pull requests
are, and an applied attachment is marked and boxed like a checked-out
pull request.
The group headings are counted, so they go through _n: a language with
more than one plural form needs a form per count, not one form for all.
The checkout journey now proves the pull requests' list has no group at
all, rather than that one heading it could not have is absent. The
newest-first check reads the rows' order instead of the markup's, the
docs screenshot opens every group before it is taken, and comments that
named only pull requests name both lists.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 9d4771e and 82f3703.

Files selected for processing: 11
  • docs/guide/trac-tickets.md
  • scripts/screenshots/shots.cjs
  • src/renderer/components/ticket-card.jsx
  • src/renderer/index.jsx
  • src/renderer/shell.css
  • src/renderer/ticket-card.cjs
  • tests/e2e/helpers/ui.cjs
  • tests/e2e/journeys/i18n.spec.js
  • tests/e2e/journeys/pr-checkout.spec.js
  • tests/e2e/journeys/ticket-card.spec.js
  • tests/unit/ticket-card.test.cjs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The ticket card now shows an applied item separately, or the newest item when no work is applied. Remaining pull requests appear in collapsible groups by state, and remaining attachments appear in a counted collapsible group. The changes add applied-item styling, update the Trac ticket guide, and add unit and end-to-end coverage for the grouped lists.

Assessment against linked issues

Objective Addressed Explanation
Add a way to show or hide linked pull requests and patches on tickets [#709] ✅

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 82f37

The grouped ticket lists are ready to merge after normal checks. No issue introduced by this change remains identified.

Pre-merge checks: Passed 1
Check name Status Explanation
Description check Passed The description follows the required template. It explains why and what changes, provides automated and manual testing steps, risks and limitations, related issue, design decisions, review outcome, im…
Full details: Description check

Explanation

The description follows the required template. It explains why and what changes, provides automated and manual testing steps, risks and limitations, related issue, design decisions, review outcome, implementation notes, and screenshots. It also identifies the known unrelated test failure and deferred filename-matching limitation.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ryanwelcher

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ryanwelcher ryanwelcher self-assigned this Oct 26, 2026
@justintadlock

Copy link
Copy Markdown

Looks solid from my end.

@ryanwelcher
ryanwelcher merged commit 1b11040 into trunk Oct 26, 2026
19 checks passed
@ryanwelcher
ryanwelcher deleted the ryanwelcher/add-toggle-to-show-hide-linked-prs-and-patches branch October 26, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add toggle to show/hide linked PRs and patches

2 participants