Skip to content

feat(gastown): redesign Merge Queue with needs-attention and activity log#1378

Merged
jrf0110 merged 6 commits intomainfrom
gt/maple/c28823d8
Mar 23, 2026
Merged

feat(gastown): redesign Merge Queue with needs-attention and activity log#1378
jrf0110 merged 6 commits intomainfrom
gt/maple/c28823d8

Conversation

@jrf0110
Copy link
Contributor

@jrf0110 jrf0110 commented Mar 22, 2026

Summary

Redesigns the Merge Queue page with two new sections: Needs Your Attention (open PRs, failed reviews, stale PRs) and a Refinery Activity Log with convoy grouping and timeline visualization.

  • Adds getMergeQueueData tRPC procedure backed by rich SQL queries that join MR beads with review metadata, convoy info, agent info, and rig names in a single round-trip
  • Introduces per-rig filtering via a Select dropdown in the page header
  • Fixes pagination ordering in the activity log: convoy groups and standalone entries are now interleaved by most-recent timestamp using a DisplayItem discriminated union, rather than showing all convoy groups before standalone entries regardless of recency

Verification

  • pnpm typecheck — all packages pass
  • No as casts or ! non-null assertions (only as const for literal types)
  • SQL queries use parameterized values — no injection risk
  • No secrets, build artifacts, or node_modules in diff

Visual Changes

image image

Reviewer Notes

  • The router.d.ts type declaration file is manually maintained and was updated to include the new getMergeQueueData procedure types
  • The activity log pagination uses a budget-based approach where each convoy group costs its entry count and each standalone entry costs 1, ensuring the "Show more" button reflects actual entry counts
  • NeedsAttention.tsx includes retry and fail actions with confirmation dialogs wired to existing updateBead and adminForceFailBead mutations

jrf0110 added 5 commits March 21, 2026 03:53
Add a dedicated tRPC query that returns structured merge queue data:
- needsAttention section with openPRs, failedReviews, and stalePRs
- activityLog with enriched review-related bead events
- Full JOINs to review_metadata, source beads, convoy_metadata, agents, rigs
- Input params: townId (required), rigId, limit, since for filtering/polling
- Zod schemas with rpcSafe wrappers and type declarations for frontend
…age (#1365)

* feat(gastown): configurable terminal orientation with drag-to-resize (#1299)

* feat(gastown): configurable terminal orientation and drag-to-resize (#1237)

Terminal bar can be positioned at bottom/top/left/right with drag-to-resize.
Position and size persisted to localStorage. Collapsed state only reserves
the tab bar strip. Dynamic page padding replaces static pb-[340px].
DrawerStack offsets when terminal is on the right.

* fix(gastown): clamp size on orientation switch, add vertical close button

Re-clamp persisted size when switching position so horizontal minimum
(100px) doesn't persist as a too-small vertical width (min 200px).
Show close button on agent tabs in vertical mode via absolute positioning
on hover.

* fix(gastown): fix terminal resize handle and position picker for left/right orientations

- Make resize handle a flex child instead of absolute positioned to avoid
  z-index conflicts with framer-motion stacking contexts
- Add visible hover indicator pill on resize handle for discoverability
- Remove width/height from CSS transition so drag resize is immediate
- Use fixed positioning with viewport clamping for position picker popup
  to prevent overflow on left/right orientations

* chore: cherry-pick getMergeQueueData types from bead 0

* feat(gastown): build 'Needs Your Attention' section for Merge Queue page

Add NeedsAttention component with:
- Three attention categories: open PRs, failed reviews, stale PRs
- Convoy grouping with header cards showing progress, branch, merge mode
- Action buttons: Open PR, Retry Review, Fail Bead, View Bead
- DrawerStack integration for bead and convoy drawer opening
- Confirmation dialogs for destructive actions
- Empty state when no items need attention

Rewrite MergesPageClient to use getMergeQueueData tRPC procedure
with 5s polling interval.
…ue page (#1366)

* feat(gastown): add convoy grouping and per-rig filtering to Merge Queue page

- Add RefineryActivityLog with convoy grouping: entries grouped by convoy
  with header cards showing title, branch, progress, clickable to open
  convoy drawer
- Add per-rig filter dropdown using listRigs query and shadcn Select,
  passes rigId to getMergeQueueData for server-side filtering
- Include status_changed ActionType with type guard (no unsafe 'as' cast)
- Polish layout: page title, rig filter, Needs Attention, Activity Log
  sections with consistent headers and empty states

* fix(gastown): move hooks above early returns and paginate by convoy groups

- Move all useMemo hooks above isLoading/empty early returns to prevent
  React crash when entries transition from 0 to non-zero (hooks must be
  called in the same order on every render)
- Replace flat-entry pagination with group-based pagination: convoy
  groups (sorted by most recent activity) are kept whole, and standalone
  entries fill remaining page budget. This ensures recently active
  convoys appear on page 1 regardless of other convoys' sizes.
…eue-needs-attention-ref/e0d20455/head' into gt/maple/c28823d8
…ncy in pagination

The previous pagination showed all convoy groups before any standalone
entries regardless of timestamps. A standalone entry more recent than all
convoy groups would still appear below them on page 1.

Merge convoy groups and standalone entries into a unified DisplayItem list
sorted by most-recent timestamp, then paginate over that list. Convoy
groups use their latestTimestamp as sort key; standalone entries use their
event.created_at. This ensures the most recently active items appear first
on page 1 regardless of whether they are convoy-grouped or standalone.

Hooks were already correctly placed before early returns (no conditional
hooks issue in the current code).
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 22, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • src/app/(app)/gastown/[townId]/merges/NeedsAttention.tsx
  • src/app/(app)/gastown/[townId]/merges/RefineryActivityLog.tsx

Reviewed by gpt-5.4-20260305 · 303,357 tokens

…remaining count

Hide the admin-only 'Fail Bead' button for non-admin users by checking
isAdmin from the session. Fix the activity log pagination to compute
hasMore and remaining count based on actual visible entries rather than
the budget, preventing incorrect 'Show more' state when a convoy group
exceeds the page budget.
@jrf0110 jrf0110 merged commit 5a81b00 into main Mar 23, 2026
18 checks passed
@jrf0110 jrf0110 deleted the gt/maple/c28823d8 branch March 23, 2026 17:23
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.

2 participants