Sonnet Review Bot sonnet-review-bot
  • Joined on 2026-04-24
sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 08:30:22 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[MINOR] The commit_id extraction loop iterates all comments to find the first non-empty CommitID, but the comment in the code says 'build the payload in one pass'. This is accurate, but the behavior silently drops CommitID from subsequent comments when they differ — if comments belong to different commits (which GitHub technically allows per-comment), only the first commit's ID is used. This may be acceptable for your use case but isn't documented as a constraint. Consider either asserting all CommitIDs match, or documenting that mixed-commit reviews aren't supported.

sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 08:30:22 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[NIT] doRequestWithBody sets Content-Type: application/json only when reqBody is non-nil. For DELETE requests (like DeleteReview), reqBody is nil so no Content-Type is sent, which is correct. However, the function signature accepts nil to mean 'no body', which conflates 'empty body' with 'no body'. This is fine for current uses but worth noting in the doc comment — currently the doc says 'accepts the raw body bytes' without mentioning the nil case explicitly.

sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 08:30:22 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[MINOR] newTestClient is defined in review_test.go but also used by identity_test.go. Since both are in package github (internal test package), this works fine. However, it would be marginally cleaner to extract this into a test helper file (e.g., export_test.go or helpers_test.go) to make the sharing explicit. This is a nit about code organization, not correctness.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 08:22:47 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] The switch for initializing var client vcs.Client has no default case. Since the provider is validated earlier with an explicit switch+os.Exit(1), client will always be set before use. However, the Go compiler cannot prove this, and if the validation switch ever diverges from the initialization switch (e.g., a new provider is added to validation but not initialization), client would remain nil and panic at first use. A default: panic(...) or a default: os.Exit(1) would make the code more robust.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 08:22:47 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] In supersedeOldReviews, for the Gitea path, os.Exit(1) is called inside a non-main function (supersedeOldReviews). This violates the convention of returning errors rather than panicking/exiting from library-style functions. The caller (main) should receive an error and call os.Exit. While this function is in main.go and is unexported, calling os.Exit in nested functions makes testing harder and is an anti-pattern per the repo conventions ('Return errors; never panic').

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 08:22:47 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[NIT] Similar to the formatter.go nit — a blank line artifact remains after removing TestGiteaEvent. Minor formatting issue.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 08:22:47 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[NIT] The DeleteReview method is implemented but appears to not be used anywhere in the codebase (GitHub uses DismissReview for superseding). If DeleteReview is required to satisfy the vcs.Client interface, that's fine, but it's worth confirming the interface definition requires it. If it's only for completeness, a brief doc comment noting when to use it versus DismissReview would help.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 08:22:47 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] doJSONRequest uses interface{} as the payload parameter type instead of any. While both are equivalent, any is the idiomatic alias since Go 1.18 and is used throughout the rest of the codebase (e.g., the vcs package). This is a minor style inconsistency.

sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 07:55:21 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[NIT] The dismissReviewRequest.Event field is always hardcoded to "DISMISS" and never varies. Since it's an implementation detail of the GitHub API (not exposed to callers), the struct could be simplified to a single-field struct, or the Event field removed and the JSON marshaling handled inline. This is very minor — the current approach is clear and extensible.

sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 07:55:21 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[MINOR] PostReview doc comment says 'ReviewRequest.Event values (APPROVE, REQUEST_CHANGES, COMMENT) are sent directly — they match GitHub's canonical event strings.' This is misleading: GitHub's canonical event strings are actually APPROVE, REQUEST_CHANGES, and COMMENT, but the vcs type uses ReviewEventApprove etc. which the test confirms maps to 'APPROVE'. The comment is correct about the wire format but conflates the vcs abstraction with the GitHub API. More importantly, when a review has no comments, payload.Comments will be nil (not assigned), which is fine since it's omitempty, but this is an implicit assumption worth noting.

sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 07:55:21 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[MINOR] The table-driven test for TestTranslateGitHubReviewState uses field name expected instead of the idiomatic want used by the rest of the test suite. Minor inconsistency with the project's established naming convention.

sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 07:55:21 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[NIT] identity_test.go is in package github (white-box test) while conformance_test.go is in package github_test (black-box test). The newTestClient helper is defined in review_test.go (package github), so identity_test.go can use it — this is consistent. However, the httptest import in identity_test.go is unused since it uses newTestClient. Actually looking at the full file, net/http/httptest is NOT imported in identity_test.go — it only imports net/http. This is correct.

sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 07:37:01 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[NIT] PostReview iterates over req.Comments twice: once to find the CommitID and once to build the payload.Comments slice. This could be combined into a single loop. Minor readability/efficiency issue on the common path.

sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 07:37:01 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[NIT] There are two trailing blank lines at the end of review_test.go. gofmt typically produces a single trailing newline; this is minor but inconsistent with the style pattern.

sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 07:37:01 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[NIT] The comment on translateGitHubReviewState says 'States like APPROVED, DISMISSED, and PENDING pass through unchanged as they already match the canonical vcs representation.' — but PENDING is also a GitHub state that maps to itself. Worth noting whether PENDING is expected to appear in responses from ListReviews, and if vcs.Review.State accepts it. This is a documentation clarity issue, not a bug.

sonnet-review-bot commented on pull request rodin/review-bot#105 2026-05-13 07:26:59 +00:00
feat(github): implement Reviewer and Identity interfaces (#81)

[MINOR] containsStr and containsSubstring reimplement strings.Contains from the standard library. The repository conventions do not restrict use of the standard library; strings.Contains(s, substr) should be used directly. The current implementation is also slightly incorrect: containsStr returns true when s == substr even without going through containsSubstring, but the logic mixing len checks and `