feat(vcs): add CommitID to ReviewRequest (#115) #118

Merged
aweiker merged 5 commits from review-bot-issue-115 into feature/github-support 2026-05-14 01:49:33 +00:00
Showing only changes of commit be68e51898 - Show all commits
+1 -1
View File
@@ -103,7 +103,7 @@ func (c *Client) PostReview(ctx context.Context, owner, repo string, number int,
// the resolved commit_id.
for _, comment := range req.Comments {
if comment.CommitID != "" {
Outdated
Review

[NIT] The conflict detection logic between req.CommitID and per-comment CommitIDs works correctly but uses a subtle implicit assumption: the initial payload.CommitID = req.CommitID means the loop's payload.CommitID == "" check is only true when req.CommitID was also empty. This is correct but slightly hard to follow at a glance — a brief inline comment like // req.CommitID already applied above on the empty-check branch would improve readability.

**[NIT]** The conflict detection logic between `req.CommitID` and per-comment CommitIDs works correctly but uses a subtle implicit assumption: the initial `payload.CommitID = req.CommitID` means the loop's `payload.CommitID == ""` check is only true when `req.CommitID` was also empty. This is correct but slightly hard to follow at a glance — a brief inline comment like `// req.CommitID already applied above` on the empty-check branch would improve readability.
if payload.CommitID == "" {
if payload.CommitID == "" { // only reachable when req.CommitID is empty
payload.CommitID = comment.CommitID
} else if payload.CommitID != comment.CommitID {
return nil, ErrConflictingCommitIDs