feat: resolve old inline comments when superseding review #42
Reference in New Issue
Block a user
Delete Branch "feat/27-resolve-inline-comments"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #27
After superseding an old review, resolves all its inline comments via
POST /pulls/comments/{id}/resolve. This clears unresolved conversation markers from the PR timeline and diff view.Why
With the always-post-fresh model, old inline comments linger as unresolved conversations in the PR diff view. Since the new review has fresh inline comments for any remaining findings, the old ones are noise. Resolving them keeps the PR clean.
New API methods
ListReviewComments— fetches inline comments for a specific reviewResolveComment— marks a pull comment as resolvedBehavior
Original reviewSuperseded — see current review for up-to-date findings.
Previous findings (commit
3d0ca57a)Gpt Review
Summary
This PR cleanly implements the automatic resolution of outdated inline review comments when superseding a review, and provides robust testing and defensive error handling. Implementation follows all established patterns and repository conventions.
Recommendation
APPROVE — The PR expands the Gitea client with
ListReviewCommentsandResolveCommentmethods to resolve all inline comments on a superseded review, only after a successful supersede. Error handling is robust and non-fatal for failures to resolve comments, which are logged at the debug level. Unit tests for the new API methods provide thorough coverage. The diff is idiomatic Go, conforms to repository conventions (no panics, robust error handling, table-driven tests where applicable), and style is consistent. The implementation does not introduce any breaking changes or regressions; CI is green. Recommend merge.Review by gpt
Evaluated against
3d0ca57aSecurity Review
Summary
Changes add resolving of superseded review inline comments and corresponding Gitea client methods. CI passed and the implementation uses proper URL escaping, scoped IDs, and does not expose secrets; no security-relevant issues found.
Recommendation
APPROVE — Approve as submitted. The new logic resolves only comments belonging to the superseded review, uses url.PathEscape for all path parameters, and keeps tokens in headers (not logs or URLs). Error messages include only server responses and IDs, avoiding secret exposure. Consider, as future hardening, adding pagination if Gitea returns many review comments and handling rate limits, but this is not security-critical.
Review by security
Evaluated against
17027c1fOriginal reviewSuperseded — see current review for up-to-date findings.
Previous findings (commit
3d0ca57a)Sonnet Review
Summary
The changes cleanly add resolution of inline comments from superseded reviews and introduce well-structured Gitea client methods with accompanying tests. Error handling and logging follow repo conventions, and CI has passed.
Findings
gitea/client_test.gocmd/review-bot/main.goRecommendation
APPROVE — Overall the implementation is sound and idiomatic: the bot only resolves comments after successfully superseding the old review, the new Gitea client methods are well-scoped with pagination and error handling, and tests cover the new methods. CI is green. Consider tightening the ListReviewComments test by asserting the request path and parameters, and optionally surfacing a summary log if resolving comments fails for better observability. Otherwise, this is good to merge.
Review by sonnet
Evaluated against
3d0ca57a@@ -362,6 +362,27 @@ func main() {} else {[MINOR] Resolution of old inline comments is gated on locating the old timeline comment ID (existingCommentID > 0), but proceeds regardless of whether EditComment actually succeeded. This slightly diverges from the stated behavior "Only runs when an old review was successfully superseded." Consider gating resolution explicitly on a successful supersede or documenting the intended behavior.
@@ -460,3 +461,49 @@ func (c *Client) EditComment(ctx context.Context, owner, repo string, commentID}[MINOR] ListReviewComments retrieves a single page of comments. If the API paginates review comments, this may miss results beyond the first page. Consider adding pagination similar to ListReviews to avoid missing comments on large reviews.
[MINOR] New exported client methods (ListReviewComments, ResolveComment) lack tests. Repository conventions suggest testing exported functions; adding unit tests against a local httptest.Server would improve confidence and guard against API regressions.
Gpt Review
Summary
This PR cleanly implements the automatic resolution of outdated inline review comments when superseding a review, and provides robust testing and defensive error handling. Implementation follows all established patterns and repository conventions.
Recommendation
APPROVE — The PR expands the Gitea client with
ListReviewCommentsandResolveCommentmethods to resolve all inline comments on a superseded review, only after a successful supersede. Error handling is robust and non-fatal for failures to resolve comments, which are logged at the debug level. Unit tests for the new API methods provide thorough coverage. The diff is idiomatic Go, conforms to repository conventions (no panics, robust error handling, table-driven tests where applicable), and style is consistent. The implementation does not introduce any breaking changes or regressions; CI is green. Recommend merge.Review by gpt
Evaluated against
3d0ca57aSecurity Review
Summary
The changes add resolving of superseded review inline comments with appropriate API calls and error handling. URLs are safely constructed, tokens are not logged, and operations occur only after a successful supersede, minimizing risk.
Recommendation
APPROVE — CI has passed and the new methods and callsites appear secure and robust. The code correctly escapes URL path segments, avoids logging sensitive tokens, and limits comment resolution to the prior review’s comments after a successful supersede. Approve as implemented.
Review by security
Evaluated against
3d0ca57aSonnet Review
Summary
The changes cleanly add resolution of inline comments from superseded reviews and introduce well-structured Gitea client methods with accompanying tests. Error handling and logging follow repo conventions, and CI has passed.
Findings
gitea/client_test.gocmd/review-bot/main.goRecommendation
APPROVE — Overall the implementation is sound and idiomatic: the bot only resolves comments after successfully superseding the old review, the new Gitea client methods are well-scoped with pagination and error handling, and tests cover the new methods. CI is green. Consider tightening the ListReviewComments test by asserting the request path and parameters, and optionally surfacing a summary log if resolving comments fails for better observability. Otherwise, this is good to merge.
Review by sonnet
Evaluated against
3d0ca57a@@ -357,10 +357,35 @@ func main() {if existingReview != nil && existingCommentID > 0 {[NIT] Failures to resolve old inline comments are logged at debug level within the resolution loop. Given this action is meant to clean up PR noise, consider aggregating and logging a summary at warn/info level when any failures occur to aid operational visibility.
@@ -602,3 +602,60 @@ func TestIsNotFound(t *testing.T) {})[MINOR] TestListReviewComments does not assert the request path or query parameters, so regressions in URL construction for the new endpoint would go unnoticed. Consider asserting the expected path and paging params similar to other tests.
3d0ca57a5ftobc5a4a1dcdGpt Review
Summary
Code is correct, well-tested, and idiomatic. The new functionality for resolving old inline comments when superseding a review is implemented cleanly and fits the project conventions.
Recommendation
APPROVE — The PR introduces
ListReviewCommentsandResolveCommentmethods to the Gitea client, uses them in the main workflow to resolve old inline comments after superseding a review, and covers all new code with thorough unit tests. No issues found; CI passes. Approve for merge.Review by gpt
Evaluated against
bc5a4a1dSonnet Review
Summary
Change cleanly adds resolving of old inline comments after superseding a review and introduces corresponding Gitea client methods with tests. Error handling and logging are appropriate, and CI has passed.
Recommendation
APPROVE — The implementation follows idiomatic patterns: non-fatal behavior with clear logging, proper pagination, and context usage. New client methods are covered by tests, and adding the comment ID field with omitempty is correct for dual use (post vs list). Proceed with merge.
Review by sonnet
Evaluated against
bc5a4a1dSecurity Review
Summary
Security-focused review finds no exploitable vulnerabilities in the added functionality. The new APIs and logic to resolve old inline comments are implemented with proper authorization headers, error handling, and bounded error body logging.
Recommendation
APPROVE — The changes introduce non-destructive housekeeping that resolves old review inline comments only after successfully superseding the prior review. API calls are constructed with appropriate escaping and use the existing authenticated context. Error bodies are limited when logged, and failures are handled gracefully. CI passed, and no security issues were identified. Proceed with merge.
Review by security
Evaluated against
bc5a4a1d