fix(api): re-land review-summaries API on main (recover stranded #3011)#3046
Conversation
Surface each reviewer's latest decisive review (verdict + submitted body) through the session PR summary so the reviews UI can show a verdict with its summary text. - PRReviewSummary gains Reviews []PRReviewEntry; summarizeReview populates it from the latest approved/changes_requested review per reviewer, sorted by reviewer for determinism - controller DTO gains SessionPRReviewEntry and a reviews field (omitempty, so it stays optional for existing clients) - openapi.yaml + schema.ts regenerated Inline review comment bodies stay private, folded into UnresolvedBy counts and links as before; only the top-level review summary body is exposed. Part of the reviews-tab revamp (#2433); the frontend two-section layout that consumes this is the next PR.
summarizeReview built the Reviews list from latestChangesRequestedReviews, which drops every reviewer whose latest decisive verdict is approved, so an approved review's summary body was never exposed despite the field advertising the approved verdict. Split out latestDecisiveReviews (latest approved-or-changes_requested per reviewer) and build Reviews from it, while the unresolved-comment grouping keeps using the changes-requested subset. Add a service test asserting an approved review's body is surfaced and a controller test covering the domain-to-DTO field mapping (Reviewer -> reviewerId, URL -> reviewUrl, etc.).
The reflected DTO surfaced as ControllersSessionPRReviewEntry, leaking the internal package prefix into the public OpenAPI spec and generated TypeScript. Register it in schemaNames so it emits as SessionPRReviewEntry, matching the other session PR contract types, and regenerate the spec + client.
Pulkit7070
left a comment
There was a problem hiding this comment.
Approving. This correctly re-lands the stranded #3011 API layer onto main and fixes the issue I flagged there: latestDecisiveReviews now surfaces each reviewer's latest approved-or-changes_requested review (not just the changes-requested subset), so approved summaries appear with verdict and body. New dto_test asserts an approved review maps end-to-end. CI is green across all checks.
|
[P1] The recovery is incomplete: re-land #3010’s review-body fetch/mapping path
Concretely:
Therefore real GitHub refreshes persist Since #3046 is now merged, please re-land #3010’s five-file fetch/mapping commit (including its provider test) in a follow-up PR against |
|
you are right, good catch. confirmed #3010 (3da9fff) is not an ancestor of main either, and re-landed #3010 onto main in #3049 (cherry-picked 3da9fff, the five-file fetch/mapping commit incl. the provider test that actually asserts the query requests+maps body). with #3009 + #3046 + #3049 the body now flows end to end. thanks for catching this. |
Summary
Re-lands the session PR review-summaries API on
main. #3011 was merged into its stale stacked base (feat/scm-fetch-pr-review-body) instead ofmain, so its changes never reachedmaineven though it shows as merged —mainhas the persist (#3009) and fetch (#3010) layers but nothing exposes the review summaries through the session PR API.This branch cherry-picks the three #3011 commits onto current
main:feat(api): expose provider PR review summaries on the session PR API—summarizeReviewpopulatesReviews(latest decisive review per reviewer, with body), plus theSessionPRReviewEntryDTO and optionalreviewsfield.fix(api): surface approved review summaries, not just changes-requested— Pulkit7070's finding: buildReviewsfromlatestDecisiveReviewsso an approved review's body is surfaced too.fix(api): register SessionPRReviewEntry schema name— illegalcall's finding: register the type inschemaNamesso it emits asSessionPRReviewEntry, notControllersSessionPRReviewEntry.Supersedes #3011 (which is unrecoverable as-is since it merged into a dead branch).
Verification
cd backend && go build ./...clean; gofmt cleango test ./internal/service/session/ ./internal/httpd/controllers/ ./internal/httpd/apispec/...pass