Skip to content

feat(review): scope reviews by pull request#261

Open
Vaibhaav-Tiwari wants to merge 6 commits into
mainfrom
feat/review-per-pr
Open

feat(review): scope reviews by pull request#261
Vaibhaav-Tiwari wants to merge 6 commits into
mainfrom
feat/review-per-pr

Conversation

@Vaibhaav-Tiwari

Copy link
Copy Markdown
Collaborator

Summary

  • Scope AO review rows and idempotency to (session_id, pr_url) so one workspace session can review multiple PRs independently.
  • Add optional prUrl selection on review list/trigger APIs; single-PR sessions keep the existing no-selector behavior.
  • Return PR-scoped review targets from the list API and regenerate OpenAPI/frontend schema.

Credibility check

Issue #253 is credible on current origin/main: review storage was unique by session_id, while PR storage and workspace sessions allow multiple PRs per session. Two details in the issue were stale: the migration is 0012_add_review_tables.sql on main, not 0011, and ListPRsBySession is already deterministic by updated_at DESC. The core problem remained: review trigger still silently collapsed multi-PR sessions unless PR identity became explicit.

Tests

  • go test -count=1 ./internal/review ./internal/storage/sqlite/store ./internal/httpd/...
  • go test -count=1 ./internal/service/review ./internal/daemon
  • npm --prefix frontend run typecheck

go test ./... was also attempted twice, but timed out after 3 and 5 minutes without emitting a failure in this environment.

Closes #253

@Vaibhaav-Tiwari

Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@Vaibhaav-Tiwari

Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

# Conflicts:
#	backend/internal/review/review_test.go
#	backend/internal/storage/sqlite/store/review_store.go
#	backend/internal/storage/sqlite/store/review_store_test.go

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@neversettle17-101 neversettle17-101 self-assigned this Jun 22, 2026
neversettle17-101 and others added 4 commits June 22, 2026 14:13
Resolve conflicts from review work that landed on main since this PR opened
(#337 worker-notification + github_review_id, #333-style migration renumbering,
failed-run retry idempotency).

- migrations: renumber 0014_review_per_pr.sql -> 0018 (0014-0017 now taken on
  main); fold main's 'status != failed' exclusion into the new PR-scoped
  review_run unique index so failed passes stay retryable per (session, pr, sha).
- queries/gen: keep PR-scoped GetReviewRunBySessionPRAndSHA but add main's
  github_review_id column to it and to ListReviewRunsBySessionAndPR; regenerate
  via sqlc so all review_run rows map through one reviewRunFromRow.
- review.Engine.Trigger: keep main's record-before-launch + failed-retry
  semantics, layer the PR's prURL scoping on top (workerPR/GetReviewBySessionAndPR/
  PR-scoped idempotency lookup).
- service Manager: combine Trigger(prURL) + List(prURL) with Submit(githubReviewID).
- controllers reviews_test.go: unify the two add/add files into one
  controllers_test package with a single fake satisfying the merged Manager.
- review_test.go: adapt main's failed-run/retry tests to the PR's multi-review
  fakeStore shape and prURL signature.
- frontend: regenerate schema.ts; SessionInspector reviews fallback now sets
  targets: [].
The merge resolution inadvertently committed package-lock drift from a local
npm install (platform-specific @emnapi optional deps), breaking npm ci. The
merged package.json matches main exactly, so restore main's lock.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The PR's review.ReviewTarget / reviewsvc.ReviewTarget tripped revive's
exported-stutter rule (pre-existing on the branch, surfaced by the lint CI
job). Rename to review.Target / reviewsvc.Target; the HTTP DTO
ReviewTargetResponse is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Re-apply per-PR review scoping on top of #377 (reviews refactor: Submit + nudge
delivery moved to the service/lifecycle layer, supersede semantics, delivered_at,
context aliased to stdctx in the engine).

- migrations: renumber 0018_review_per_pr.sql -> 0019 (collided with #377's new
  0018_review_run_delivered_at.sql). The per-PR migration recreates only the
  review table, so review_run.delivered_at survives.
- engine review.go: rebuilt on #377's structure; re-applied prURL scoping to
  Trigger/List/workerPR/upsertReview and the Store interface
  (GetReviewBySessionAndPR, GetReviewRunBySessionPRAndSHA, ListReviewsBySession,
  ListReviewRunsBySessionAndPR), restored the per-PR List targets, and PR-scoped
  SupersedeStaleRunningReviewRuns so triggering one PR no longer supersedes
  another PR's in-flight run.
- service review.go auto-merged cleanly: #377's Store/Reducer/delivery with the
  PR's prURL Manager signatures.
- queries/gen: keep PR-scoped run lookups, carry #377's delivered_at column on
  all run selects; add pr_url to SupersedeStaleRunningReviewRuns; sqlc-regenerated.
- engine review_test.go: reconciled main's supersede tests to the multi-PR
  fakeStore shape (reviews[] + PRURL) and prURL Trigger signature.
- frontend: regenerated openapi.yaml/schema.ts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

Reviews: support multiple PRs per worker session (review keyed by (session, PR), not session)

2 participants