From 687441bc64e57e346c77b3d21f4a0746a90f6cd0 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 25 May 2026 14:15:12 +0000
Subject: [PATCH 1/2] Initial plan


From 890d4c6b789126f0860b90e37dc0e2b864ab314c Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 25 May 2026 14:20:29 +0000
Subject: [PATCH 2/2] testify: fix anti-patterns, promote require.NoError,
 expand JSONEq usage

---
 internal/logger/sanitize/sanitize_test.go          | 2 +-
 internal/oidc/jwt_expiry_test.go                   | 2 +-
 internal/proxy/handler_test.go                     | 2 +-
 internal/proxy/rate_limit_test.go                  | 3 ++-
 internal/proxy/response_transform_coverage_test.go | 2 +-
 internal/server/http_helpers_test.go               | 2 +-
 6 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/internal/logger/sanitize/sanitize_test.go b/internal/logger/sanitize/sanitize_test.go
index 01d97d766..183eb79c6 100644
--- a/internal/logger/sanitize/sanitize_test.go
+++ b/internal/logger/sanitize/sanitize_test.go
@@ -697,7 +697,7 @@ func TestMarshalAndSanitize(t *testing.T) {
 
 	t.Run("empty map marshals to empty JSON object", func(t *testing.T) {
 		result := MarshalAndSanitize(map[string]interface{}{})
-		assert.Equal(t, "{}", result)
+		assert.JSONEq(t, "{}", result)
 	})
 
 	t.Run("slice of strings with no secrets", func(t *testing.T) {
diff --git a/internal/oidc/jwt_expiry_test.go b/internal/oidc/jwt_expiry_test.go
index 104ab85e8..b60c3e90d 100644
--- a/internal/oidc/jwt_expiry_test.go
+++ b/internal/oidc/jwt_expiry_test.go
@@ -30,7 +30,7 @@ func TestExtractJWTExpiry_ValidToken_NoPaddingNeeded(t *testing.T) {
 	// payload raw length = 12, mod4 = 0 → no padding added
 	rawPayload := encodePayloadRaw(`{"exp":1}`)
 	assert.Len(t, rawPayload, 12)
-	assert.Equal(t, 0, len(rawPayload)%4)
+	assert.Zero(t, len(rawPayload)%4)
 
 	token := makeRawJWT(rawPayload)
 	got, err := extractJWTExpiry(token)
diff --git a/internal/proxy/handler_test.go b/internal/proxy/handler_test.go
index 959e27a2e..0487bf6a5 100644
--- a/internal/proxy/handler_test.go
+++ b/internal/proxy/handler_test.go
@@ -437,7 +437,7 @@ func TestPassthrough_Success(t *testing.T) {
 	assert.Equal(t, http.StatusCreated, w.Code)
 	assert.Contains(t, w.Body.String(), `"id":42`)
 	assert.Equal(t, http.MethodPost, receivedMethod)
-	assert.Equal(t, `{"title":"new issue"}`, receivedBody)
+	assert.JSONEq(t, `{"title":"new issue"}`, receivedBody)
 }
 
 func TestPassthrough_NilBody(t *testing.T) {
diff --git a/internal/proxy/rate_limit_test.go b/internal/proxy/rate_limit_test.go
index 73020137b..1c5229ad4 100644
--- a/internal/proxy/rate_limit_test.go
+++ b/internal/proxy/rate_limit_test.go
@@ -8,6 +8,7 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 )
 
 // TestInjectRetryAfterIfRateLimited verifies Retry-After injection and logging for
@@ -29,7 +30,7 @@ func TestInjectRetryAfterIfRateLimited(t *testing.T) {
 		retryAfter := w.Header().Get("Retry-After")
 		assert.NotEmpty(t, retryAfter, "Retry-After should be set on 429")
 		secs, err := strconv.Atoi(retryAfter)
-		assert.NoError(t, err)
+		require.NoError(t, err)
 		assert.Greater(t, secs, 0, "Retry-After should be positive")
 	})
 
diff --git a/internal/proxy/response_transform_coverage_test.go b/internal/proxy/response_transform_coverage_test.go
index 47f4c4097..16eb8eecf 100644
--- a/internal/proxy/response_transform_coverage_test.go
+++ b/internal/proxy/response_transform_coverage_test.go
@@ -67,7 +67,7 @@ func TestRewrapSearchResponse_ItemsKey(t *testing.T) {
 	m, ok := result.(map[string]interface{})
 	require.True(t, ok)
 	assert.Equal(t, float64(1), m["total_count"])
-	assert.Equal(t, false, m["incomplete_results"])
+	assert.False(t, m["incomplete_results"].(bool))
 	assert.Equal(t, filtered, m["items"])
 }
 
diff --git a/internal/server/http_helpers_test.go b/internal/server/http_helpers_test.go
index 69eb85ca9..12296fe1c 100644
--- a/internal/server/http_helpers_test.go
+++ b/internal/server/http_helpers_test.go
@@ -240,7 +240,7 @@ func TestWithResponseLogging_PreservesHeaders(t *testing.T) {
 	assert.Equal(t, "application/json", w.Header().Get("Content-Type"), "Content-Type header should be preserved")
 	assert.Equal(t, "test-value", w.Header().Get("X-Custom-Header"), "custom header should be preserved")
 	assert.Equal(t, http.StatusOK, w.Code, "status code should be preserved")
-	assert.Equal(t, `{"ok":true}`, w.Body.String(), "response body should be preserved")
+	assert.JSONEq(t, `{"ok":true}`, w.Body.String(), "response body should be preserved")
 }
 
 // TestWithResponseLogging_ReturnsHTTPHandler verifies the return type.
