Skip to content

feat(code-review): group reviews and bot comments by PR - #25

Merged
yunfanye merged 2 commits into
mainfrom
feat/code-review-pr-history
Oct 22, 2026
Merged

yunfanye merged 2 commits into
mainfrom
feat/code-review-pr-history

Conversation

@yunfanye

@yunfanye yunfanye commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Why

When a PR gets many review runs and bot conversations, they are spread across the activity feed. There is no way to read the full history of feedback for one PR.

What

A PR history view keyed by the repo + PR pair (/apps/code-review/pr/<owner>/<repo>/<number>):

  • Header: PR title, author, GitHub link, Re-review, and stats (review runs, bot conversations, latest verdict, last activity).
  • One timeline of every review run and every bot conversation on the PR. Filter by All / Reviews / Comments, sort newest or oldest first, and expand or collapse all.
  • Each review run shows its verdict (Approved / Commented / Changes requested, read from the stored review text), the reviewed commit, the duration, and links to the run details, the GitHub review, and the agent session.
  • Each conversation shows the triggering comment and the bot's reply.
  • Long entries collapse to a preview; only the latest review opens by default. Long histories render 20 entries at a time.

Entry points: a PR history button on review and PR task detail pages, and a History button next to the dashboard's manual-review PR input.

Backend: one read-only route, GET /pr-history?repo=&number=, built on two new queries filtered by repo and PR number. No schema change.

Testing

  • pnpm typecheck, pnpm vitest run, and pnpm build pass. A new repo test covers the per-PR filtering and ordering.
  • Installed v0.33.0 on a live instance and checked it with real data: PRs with 29 and 40 review runs, and a PR with 148 bot conversations. Checked the dashboard lookup, detail → history, history → run details, and browser back.

🤖 Generated with Claude Code

Add a PR history view keyed by the repo + PR pair. It shows every review
run and every bot conversation on that PR in one timeline, with the
review verdict, reviewed commit, duration, and links to GitHub and the
agent session.

- GET /pr-history?repo=owner/name&number=N returns both lists.
- Route /apps/code-review/pr/<owner>/<repo>/<number>.
- Open it from a review or PR task detail page, or look up a PR URL
  from the dashboard.
- Long entries collapse to a preview; long histories render 20 at a time.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@yunfanye yunfanye left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

Comment thread apps/code-review/src/web/App.tsx Outdated
`${apiBase}/pr-history?repo=${encodeURIComponent(pr.repo)}&number=${pr.number}`,
);
if (!response.ok) throw new Error(`Failed to load PR history (HTTP ${response.status})`);
setPrHistory((await response.json()) as PRHistoryData);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 69eb2ea. Each PR-history load now uses an AbortController. A new load, or leaving the route, aborts the previous request, and only the current request may set history, error, or loading state. A slow PR A response can no longer replace PR B's timeline or its Re-review URL.

/** Every review run for one repo + PR pair, oldest first (the PR history view). */
listPRReviewsForPR(repo: string, prNumber: number): PRReview[] {
return this.all<any>(
`SELECT ${this.prReviewSelectColumns()} FROM "${this.t("pr_reviews")}" WHERE repo = ? AND pr_number = ? ORDER BY started_at ASC`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 69eb2ea. Both per-PR queries now compare repo = ? COLLATE NOCASE, so existing rows stored as Owner/Repo match a lookup for owner/repo. I added a mixed-case test for both reviews and mention tasks.

…ensitively

- Abort the previous PR-history request when a new one starts or the
  route leaves the page, so a slow response for one PR cannot replace
  another PR's timeline or Re-review target.
- Match repository names with COLLATE NOCASE in both per-PR queries,
  since GitHub repo names are case-insensitive. Add mixed-case coverage.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Comment thread apps/code-review/src/web/App.tsx Outdated
`${apiBase}/pr-history?repo=${encodeURIComponent(pr.repo)}&number=${pr.number}`,
);
if (!response.ok) throw new Error(`Failed to load PR history (HTTP ${response.status})`);
setPrHistory((await response.json()) as PRHistoryData);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 69eb2ea. Each PR-history load now uses an AbortController. A new load, or leaving the route, aborts the previous request, and only the current request may set history, error, or loading state. A slow PR A response can no longer replace PR B's timeline or its Re-review URL.

/** Every review run for one repo + PR pair, oldest first (the PR history view). */
listPRReviewsForPR(repo: string, prNumber: number): PRReview[] {
return this.all<any>(
`SELECT ${this.prReviewSelectColumns()} FROM "${this.t("pr_reviews")}" WHERE repo = ? AND pr_number = ? ORDER BY started_at ASC`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 69eb2ea. Both per-PR queries now compare repo = ? COLLATE NOCASE, so existing rows stored as Owner/Repo match a lookup for owner/repo. I added a mixed-case test for both reviews and mention tasks.

@yunfanye yunfanye left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Code Review: ✅ APPROVE

Adds a focused, read-only PR history endpoint and a unified review/conversation timeline with navigation, filtering, and incremental rendering. Full changed files and relevant callers were reviewed. App typecheck, all 43 code-review tests, and the build passed; UI interactions were not independently browser-tested.

Verdict: APPROVE — The change fits the existing architecture, and no actionable defects were found.

No issues found. Code looks good!


Automated review by RomeOS Code Review · commit 69eb2ea

@yunfanye
yunfanye merged commit 517d98d into main Oct 22, 2026
6 checks passed
@yunfanye
yunfanye deleted the feat/code-review-pr-history branch October 22, 2026 07: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.

1 participant