## Summary
Changes the order of operations when posting reviews:
1. **POST new review first** — gets non-stale badge on HEAD immediately
2. **PATCH old review** — marks as superseded with a clickable link to the new review
## Why
Previously the bot superseded the old review *before* posting the new one. This meant:
- The superseded message had no link ("see current review" pointed nowhere)
- If the POST failed, the old review was already destroyed
New order ensures the link is always valid and the old review is only touched after the new one succeeds.
## Changes
- `buildSupersededBody` now accepts `newReviewURL` parameter
- Supersede message: `**Superseded** — [see current review](url) for up-to-date findings.`
- URL format: `{giteaURL}/{owner}/{repo}/pulls/{number}#pullrequestreview-{id}`
- Tests updated for new signature
Changes the order of operations:
1. POST new review (gets non-stale badge immediately)
2. PATCH old review with superseded message linking to the new one
This gives the superseded comment a clickable link to the current
review, making navigation between review iterations easy.
buildSupersededBody now accepts a newReviewURL parameter.
gpt-review-bot
approved these changes 2026-05-02 18:44:40 +00:00
This PR makes the order of review posting more robust, ensuring links to superseded reviews are always valid, and updates both implementation and tests accordingly. All changes are correct and idiomatic, with no issues found.
Recommendation
APPROVE — The changes improve the atomicity and reliability of the review-posting flow by posting the new review first and only marking the old one as superseded using the new review's URL. The updates to both production and test code are correct, maintain compatibility, and follow repository conventions and Go idioms. No issues were found; merge as is.
# Gpt Review
## Summary
This PR makes the order of review posting more robust, ensuring links to superseded reviews are always valid, and updates both implementation and tests accordingly. All changes are correct and idiomatic, with no issues found.
## Recommendation
**APPROVE** — The changes improve the atomicity and reliability of the review-posting flow by posting the new review first and only marking the old one as superseded using the new review's URL. The updates to both production and test code are correct, maintain compatibility, and follow repository conventions and Go idioms. No issues were found; merge as is.
---
*Review by gpt*
<!-- review-bot:gpt -->
---
*Evaluated against ed69d26e*
The changes reorder review posting and superseding to ensure links are valid and reduce failure risk. No new security-relevant issues are introduced by this diff, and CI has passed.
Recommendation
APPROVE — The update to first post the new review and then supersede the old one with a concrete link is sound. Given that the URL is constructed from operator-controlled inputs and the original review body is authored by the bot, this change does not introduce meaningful security risk. Proceed with merge.
# Security Review
## Summary
The changes reorder review posting and superseding to ensure links are valid and reduce failure risk. No new security-relevant issues are introduced by this diff, and CI has passed.
## Recommendation
**APPROVE** — The update to first post the new review and then supersede the old one with a concrete link is sound. Given that the URL is constructed from operator-controlled inputs and the original review body is authored by the bot, this change does not introduce meaningful security risk. Proceed with merge.
---
*Review by security*
<!-- review-bot:security -->
---
*Evaluated against ed69d26e*
Solid change that reverses the order: posting the new review before superseding the old ensures a valid link and avoids destroying the old review if POST fails. Tests are updated accordingly and CI passed.
Findings
#
Severity
File
Line
Finding
1
[NIT]
cmd/review-bot/main.go
356
When constructing newReviewURL via string formatting, consider using net/url.JoinPath (and adding the fragment separately) or trimming a trailing slash to avoid possible double slashes if giteaURL ends with '/'. This is minor, as browsers typically handle double slashes, but it improves robustness.
2
[NIT]
cmd/review-bot/main.go
522
The doc comment for buildSupersededBody mentions only collapsing and commit info; consider updating it to also note that it includes a link to the new review via newReviewURL for clarity.
Recommendation
APPROVE — The change correctly posts the new review first and only then supersedes the old one with a link to the new review, preventing dangling references and preserving history. Tests have been updated to validate the new signature and behavior, and CI has passed. Consider the minor improvements noted (more robust URL construction and a clarified comment), but overall this is ready to merge.
# Sonnet Review
## Summary
Solid change that reverses the order: posting the new review before superseding the old ensures a valid link and avoids destroying the old review if POST fails. Tests are updated accordingly and CI passed.
## Findings
| # | Severity | File | Line | Finding |
|---|----------|------|------|--------|
| 1 | [NIT] | `cmd/review-bot/main.go` | 356 | When constructing newReviewURL via string formatting, consider using net/url.JoinPath (and adding the fragment separately) or trimming a trailing slash to avoid possible double slashes if giteaURL ends with '/'. This is minor, as browsers typically handle double slashes, but it improves robustness. |
| 2 | [NIT] | `cmd/review-bot/main.go` | 522 | The doc comment for buildSupersededBody mentions only collapsing and commit info; consider updating it to also note that it includes a link to the new review via newReviewURL for clarity. |
## Recommendation
**APPROVE** — The change correctly posts the new review first and only then supersedes the old one with a link to the new review, preventing dangling references and preserving history. Tests have been updated to validate the new signature and behavior, and CI has passed. Consider the minor improvements noted (more robust URL construction and a clarified comment), but overall this is ready to merge.
---
*Review by sonnet*
<!-- review-bot:sonnet -->
---
*Evaluated against ed69d26e*
[NIT] When constructing newReviewURL via string formatting, consider using net/url.JoinPath (and adding the fragment separately) or trimming a trailing slash to avoid possible double slashes if giteaURL ends with '/'. This is minor, as browsers typically handle double slashes, but it improves robustness.
**[NIT]** When constructing newReviewURL via string formatting, consider using net/url.JoinPath (and adding the fragment separately) or trimming a trailing slash to avoid possible double slashes if giteaURL ends with '/'. This is minor, as browsers typically handle double slashes, but it improves robustness.
[NIT] The doc comment for buildSupersededBody mentions only collapsing and commit info; consider updating it to also note that it includes a link to the new review via newReviewURL for clarity.
**[NIT]** The doc comment for buildSupersededBody mentions only collapsing and commit info; consider updating it to also note that it includes a link to the new review via newReviewURL for clarity.
rodin
merged commit ed06cdd942 into main2026-05-02 18:46:51 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Changes the order of operations when posting reviews:
Why
Previously the bot superseded the old review before posting the new one. This meant:
New order ensures the link is always valid and the old review is only touched after the new one succeeds.
Changes
buildSupersededBodynow acceptsnewReviewURLparameter**Superseded** — [see current review](url) for up-to-date findings.{giteaURL}/{owner}/{repo}/pulls/{number}#pullrequestreview-{id}Gpt Review
Summary
This PR makes the order of review posting more robust, ensuring links to superseded reviews are always valid, and updates both implementation and tests accordingly. All changes are correct and idiomatic, with no issues found.
Recommendation
APPROVE — The changes improve the atomicity and reliability of the review-posting flow by posting the new review first and only marking the old one as superseded using the new review's URL. The updates to both production and test code are correct, maintain compatibility, and follow repository conventions and Go idioms. No issues were found; merge as is.
Review by gpt
Evaluated against
ed69d26eSecurity Review
Summary
The changes reorder review posting and superseding to ensure links are valid and reduce failure risk. No new security-relevant issues are introduced by this diff, and CI has passed.
Recommendation
APPROVE — The update to first post the new review and then supersede the old one with a concrete link is sound. Given that the URL is constructed from operator-controlled inputs and the original review body is authored by the bot, this change does not introduce meaningful security risk. Proceed with merge.
Review by security
Evaluated against
ed69d26eSonnet Review
Summary
Solid change that reverses the order: posting the new review before superseding the old ensures a valid link and avoids destroying the old review if POST fails. Tests are updated accordingly and CI passed.
Findings
cmd/review-bot/main.gocmd/review-bot/main.goRecommendation
APPROVE — The change correctly posts the new review first and only then supersedes the old one with a link to the new review, preventing dangling references and preserving history. Tests have been updated to validate the new signature and behavior, and CI has passed. Consider the minor improvements noted (more robust URL construction and a clarified comment), but overall this is ready to merge.
Review by sonnet
Evaluated against
ed69d26e@@ -356,6 +353,17 @@ func main() {}slog.Info("review posted", "review_id", posted.ID, "user", posted.User.Login, "pr", prNumber)// Supersede old review with link to the new one[NIT] When constructing newReviewURL via string formatting, consider using net/url.JoinPath (and adding the fragment separately) or trimming a trailing slash to avoid possible double slashes if giteaURL ends with '/'. This is minor, as browsers typically handle double slashes, but it improves robustness.
@@ -514,14 +522,16 @@ func validateReviewerName(name string) error {[NIT] The doc comment for buildSupersededBody mentions only collapsing and commit info; consider updating it to also note that it includes a link to the new review via newReviewURL for clarity.