Skip to content

feat(review): Add Approve & Next for stacked PR reviews#1025

Open
leoreisdias wants to merge 2 commits into
backnotprop:mainfrom
leoreisdias:feat/approve-and-next-stacked-pr-reviews
Open

feat(review): Add Approve & Next for stacked PR reviews#1025
leoreisdias wants to merge 2 commits into
backnotprop:mainfrom
leoreisdias:feat/approve-and-next-stacked-pr-reviews

Conversation

@leoreisdias

@leoreisdias leoreisdias commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Context

Stacked PR review already had good navigation and scope support: users could inspect the stack, switch PRs, and choose layer vs full-stack diffs. The missing workflow was the fast review path: after approving one open PR in a stack, the reviewer had to reopen or manually navigate to the next one.

This PR adds a platform-only Approve & Next split action for GitHub/GitLab PR review mode. It approves the current PR through the existing platform review flow, keeps the Plannotator session alive, and switches to the next open PR in the stack.

Screenshots

Slot 1: one-time toast announcing the stacked PR shortcut.

image

Slot 2: Approve & Next switching to the next PR after approval.

image

Slot 3: split approve button with the arrow affordance.

image

What Changed

  • Added an icon-only split action beside Approve when a next open stacked PR is available.
  • Reused the existing approval modal, with the confirm label changed to Approve & Next for the split action.
  • After successful platform approval, the UI keeps the session open and calls the existing /api/pr-switch path for the next PR.
  • Normal Approve is unchanged: it still approves the current PR and finishes the review session.
  • Post Comments keeps the existing multi-PR batching behavior.
  • Added approved-PR cleanup so Approve & Next behaves like normal approve for the PR being approved: it clears the approved PR review notes, selected note IDs, external annotations for that PR, and the persisted draft before switching.
  • Added a one-time toast so reviewers discover the arrow affordance without adding a settings flow.
  • Gated Approve & Next out of the VS Code webview because editor annotations are not PR-scoped yet.

Decisions Captured

  • No setting or CLI flag for v1. The feature is an inline affordance because it is a workflow shortcut, not a global mode.
  • Split button over changing approve semantics. Normal Approve stays terminal. The arrow action is explicit and reversible in the UI model.
  • Approve one PR at a time. This preserves the existing contract: comments can batch across PRs, approvals remain current-PR only.
  • Only open stacked PRs are eligible. Merged/default-branch nodes are skipped for the next target.
  • Keep the same session instead of ending and starting a new one. This preserves warmed PR context, local checkout/cache, the active browser tab, and existing PR switch machinery.
  • Use /api/draft for draft cleanup rather than bending /api/feedback. /api/feedback still means resolving the whole review session; approve-next only needs to discard the approved PR draft and continue.
  • VS Code webview waits for a future precise model. Since editor annotations do not carry prUrl, this PR hides Approve & Next there rather than deleting editor annotations bluntly or pretending they are scoped.

Review Focus

  • packages/review-editor/App.tsx: the approve-next success path, especially the ordering of platform approval, approved-PR cleanup, and handlePRSwitch.
  • packages/review-editor/hooks/useApproveAndNextAffordance.ts: visibility rules for the split action, next-open-PR selection, one-time toast behavior, and VS Code gating.
  • packages/review-editor/components/ReviewSubmissionDialog.tsx: confirm-label override without changing normal approve/comment behavior.
  • packages/review-editor/hooks/usePRStack.ts: returning switch success/failure while preserving existing callers that ignore the return value.

Verification

  • PATH="$PWD/apps/review/node_modules/.bin:$PATH" bun run typecheck
  • bun test packages/review-editor/utils/exportFeedback.test.ts packages/review-editor/utils/exportFeedback.workspace.test.ts
  • bun run build:review
  • bun run build:hook
  • Manual Plannotator review passed with no changes requested.

@leoreisdias leoreisdias changed the title Add Approve & Next for stacked PR reviews feat(review): Add Approve & Next for stacked PR reviews Jul 9, 2026
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.

1 participant