fix(cmd,github): address review feedback on PR #106

- Replace panic() with fmt.Fprintf+os.Exit(1) in provider switch default
  (repo convention: never panic)
- Remove spurious 'event' field from DismissReview payload (GitHub dismiss
  endpoint only documents 'message')
- Change translateReviewEvent default to return 'COMMENT' as canonical
  fallback instead of passing unknown events through to GitHub API
- Refactor supersedeOldReviews to use explicit switch/case with default
  error for exhaustiveness
This commit is contained in:
claw
2026-05-13 02:23:24 -07:00
parent b7acd8a2ea
commit 5d1abaa0e7
2 changed files with 9 additions and 6 deletions
+1 -3
View File
@@ -42,7 +42,6 @@ type reviewCommentCreate struct {
// dismissReviewRequest is the GitHub API request body for dismissing a review.
type dismissReviewRequest struct {
Message string `json:"message"`
Event string `json:"event"`
}
// userResponse is the GitHub API response for the authenticated user.
@@ -60,7 +59,7 @@ func translateReviewEvent(event vcs.ReviewEvent) string {
case vcs.ReviewEventComment:
return "COMMENT"
default:
return string(event)
return "COMMENT"
}
}
@@ -161,7 +160,6 @@ func (c *Client) DismissReview(ctx context.Context, owner, repo string, number i
payload := dismissReviewRequest{
Message: message,
Event: "DISMISS",
}
_, err := c.doJSONRequest(ctx, http.MethodPut, reqURL, payload)