fix(github): add DismissReview Event comment; use t.Fatalf for routing assertions
PR Ready Gate / clear-labels (pull_request) Successful in 2s
CI / test (pull_request) Successful in 19s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Successful in 33s
CI / review (gpt-5, security, ., rodin/security-patterns, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Successful in 50s
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Successful in 1m48s
PR Ready Gate / clear-labels (pull_request) Successful in 2s
CI / test (pull_request) Successful in 19s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Successful in 33s
CI / review (gpt-5, security, ., rodin/security-patterns, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Successful in 50s
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Successful in 1m48s
- Add comment in DismissReview explaining why the Event field is required by the GitHub API even though DISMISS is the only valid value (#18652). - Change t.Errorf to t.Fatalf for method/path routing assertions in test handlers so failures are immediately fatal instead of silently continuing handler execution (#18653).
This commit is contained in:
+3
-1
@@ -194,7 +194,9 @@ func (c *Client) DismissReview(ctx context.Context, owner, repo string, number i
|
|||||||
|
|
||||||
payload := dismissReviewRequest{
|
payload := dismissReviewRequest{
|
||||||
Message: message,
|
Message: message,
|
||||||
Event: "DISMISS",
|
// Event is required by the GitHub API for dismissal requests, even though
|
||||||
|
// "DISMISS" is the only valid value for this endpoint.
|
||||||
|
Event: "DISMISS",
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(payload)
|
data, err := json.Marshal(payload)
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ import (
|
|||||||
func TestPostReview_HappyPath(t *testing.T) {
|
func TestPostReview_HappyPath(t *testing.T) {
|
||||||
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
|
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != "POST" {
|
if r.Method != "POST" {
|
||||||
t.Errorf("expected POST, got %s", r.Method)
|
t.Fatalf("expected POST, got %s", r.Method)
|
||||||
}
|
}
|
||||||
if r.URL.Path != "/repos/owner/repo/pulls/5/reviews" {
|
if r.URL.Path != "/repos/owner/repo/pulls/5/reviews" {
|
||||||
t.Errorf("unexpected path: %s", r.URL.Path)
|
t.Fatalf("unexpected path: %s", r.URL.Path)
|
||||||
}
|
}
|
||||||
if r.Header.Get("Content-Type") != "application/json" {
|
if r.Header.Get("Content-Type") != "application/json" {
|
||||||
t.Errorf("expected Content-Type application/json, got %q", r.Header.Get("Content-Type"))
|
t.Errorf("expected Content-Type application/json, got %q", r.Header.Get("Content-Type"))
|
||||||
@@ -150,10 +150,10 @@ func TestPostReview_MalformedResponse(t *testing.T) {
|
|||||||
func TestListReviews_HappyPath(t *testing.T) {
|
func TestListReviews_HappyPath(t *testing.T) {
|
||||||
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
|
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != "GET" {
|
if r.Method != "GET" {
|
||||||
t.Errorf("expected GET, got %s", r.Method)
|
t.Fatalf("expected GET, got %s", r.Method)
|
||||||
}
|
}
|
||||||
if r.URL.Path != "/repos/owner/repo/pulls/3/reviews" {
|
if r.URL.Path != "/repos/owner/repo/pulls/3/reviews" {
|
||||||
t.Errorf("unexpected path: %s", r.URL.Path)
|
t.Fatalf("unexpected path: %s", r.URL.Path)
|
||||||
}
|
}
|
||||||
json.NewEncoder(w).Encode([]map[string]interface{}{
|
json.NewEncoder(w).Encode([]map[string]interface{}{
|
||||||
{
|
{
|
||||||
@@ -250,10 +250,10 @@ func TestListReviews_401(t *testing.T) {
|
|||||||
func TestDeleteReview_HappyPath(t *testing.T) {
|
func TestDeleteReview_HappyPath(t *testing.T) {
|
||||||
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
|
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != "DELETE" {
|
if r.Method != "DELETE" {
|
||||||
t.Errorf("expected DELETE, got %s", r.Method)
|
t.Fatalf("expected DELETE, got %s", r.Method)
|
||||||
}
|
}
|
||||||
if r.URL.Path != "/repos/owner/repo/pulls/5/reviews/42" {
|
if r.URL.Path != "/repos/owner/repo/pulls/5/reviews/42" {
|
||||||
t.Errorf("unexpected path: %s", r.URL.Path)
|
t.Fatalf("unexpected path: %s", r.URL.Path)
|
||||||
}
|
}
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
})
|
})
|
||||||
@@ -284,10 +284,10 @@ func TestDeleteReview_422_SubmittedReview(t *testing.T) {
|
|||||||
func TestDismissReview_HappyPath(t *testing.T) {
|
func TestDismissReview_HappyPath(t *testing.T) {
|
||||||
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
|
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != "PUT" {
|
if r.Method != "PUT" {
|
||||||
t.Errorf("expected PUT, got %s", r.Method)
|
t.Fatalf("expected PUT, got %s", r.Method)
|
||||||
}
|
}
|
||||||
if r.URL.Path != "/repos/owner/repo/pulls/5/reviews/10/dismissals" {
|
if r.URL.Path != "/repos/owner/repo/pulls/5/reviews/10/dismissals" {
|
||||||
t.Errorf("unexpected path: %s", r.URL.Path)
|
t.Fatalf("unexpected path: %s", r.URL.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, _ := io.ReadAll(r.Body)
|
body, _ := io.ReadAll(r.Body)
|
||||||
|
|||||||
Reference in New Issue
Block a user