Skip to content

Commit feea20d

Browse files
Copilotlpcox
andcommitted
Fix lint errors: remove unused import and duplicate assert binding
- Removed unused 'strings' import from jsonl_logger_test.go - Fixed duplicate assert.New(t) call in TestLogRPCMessageJSONLDirectionTypes The parent function already creates the assert binding, so the subtest was attempting to call .New() on *assert.Assertions instead of the package - Applied gofmt formatting fixes Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent 5786b3c commit feea20d

3 files changed

Lines changed: 13 additions & 15 deletions

File tree

internal/logger/jsonl_logger_test.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"os"
88
"path/filepath"
9-
"strings"
109
"testing"
1110

1211
"github.com/githubnext/gh-aw-mcpg/internal/logger/sanitize"
@@ -150,7 +149,7 @@ func TestSanitizePayload(t *testing.T) {
150149
t.Run(tt.name, func(t *testing.T) {
151150
require := require.New(t)
152151
assert := assert.New(t)
153-
152+
154153
result := sanitize.SanitizeJSON([]byte(tt.input))
155154
require.NotNil(result, "sanitize.SanitizeJSON returned nil")
156155

@@ -342,7 +341,7 @@ func TestMultipleMessagesInJSONL(t *testing.T) {
342341
func TestSanitizePayloadCompactsJSON(t *testing.T) {
343342
require := require.New(t)
344343
assert := assert.New(t)
345-
344+
346345
// Test that multi-line JSON is compacted to a single line
347346
multilineJSON := `{
348347
"jsonrpc": "2.0",
@@ -372,7 +371,7 @@ func TestSanitizePayloadCompactsJSON(t *testing.T) {
372371

373372
func TestInitJSONLLoggerWithInvalidPath(t *testing.T) {
374373
assert := assert.New(t)
375-
374+
376375
// Test initialization with an invalid directory path (permission denied scenario)
377376
// Using /proc/self as it's read-only and will fail to create subdirectories
378377
err := InitJSONLLogger("/proc/self/invalid", "test.jsonl")
@@ -423,30 +422,29 @@ func TestLogRPCMessageJSONLDirectionTypes(t *testing.T) {
423422

424423
for _, tt := range tests {
425424
t.Run(tt.name, func(t *testing.T) {
426-
assert := assert.New(t)
427425
testPayload := []byte(`{"jsonrpc":"2.0","id":1}`)
428-
426+
429427
// Clear previous log file
430428
logPath := filepath.Join(logDir, "test.jsonl")
431429
os.Remove(logPath)
432-
430+
433431
LogRPCMessageJSONL(tt.direction, tt.msgType, "test-server", "test-method", testPayload, nil)
434432
CloseJSONLLogger()
435-
433+
436434
// Re-init for next iteration
437435
if t.Name() != tests[len(tests)-1].name {
438436
InitJSONLLogger(logDir, "test.jsonl")
439437
}
440-
438+
441439
// Read and verify
442440
content, err := os.ReadFile(logPath)
443441
if err != nil {
444442
return // File might not exist yet
445443
}
446-
444+
447445
var entry JSONLRPCMessage
448446
json.Unmarshal(content, &entry)
449-
447+
450448
assert.Equal(tt.expected["direction"], entry.Direction, "Direction should match")
451449
assert.Equal(tt.expected["type"], entry.Type, "Type should match")
452450
})

internal/server/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func authMiddleware(apiKey string, next http.HandlerFunc) http.HandlerFunc {
2020
logAuth.Printf("Initialized auth middleware")
2121
return func(w http.ResponseWriter, r *http.Request) {
2222
logAuth.Printf("Authenticating request: method=%s, path=%s, remote=%s", r.Method, r.URL.Path, r.RemoteAddr)
23-
23+
2424
// Extract Authorization header
2525
authHeader := r.Header.Get("Authorization")
2626

@@ -52,7 +52,7 @@ func authMiddleware(apiKey string, next http.HandlerFunc) http.HandlerFunc {
5252
// logRuntimeError logs runtime errors to stdout per spec section 9.2
5353
func logRuntimeError(errorType, detail string, r *http.Request, serverName *string) {
5454
logAuth.Printf("Logging runtime error: type=%s, detail=%s", errorType, detail)
55-
55+
5656
timestamp := time.Now().UTC().Format(time.RFC3339)
5757
requestID := r.Header.Get("X-Request-ID")
5858
if requestID == "" {

internal/server/transport.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ func CreateHTTPServerForMCP(addr string, unifiedServer *UnifiedServer, apiKey st
9898

9999
return unifiedServer.server
100100
}, &sdk.StreamableHTTPOptions{
101-
Stateless: false, // Support stateful sessions
101+
Stateless: false, // Support stateful sessions
102102
Logger: logger.NewSlogLoggerWithHandler(logTransport), // Integrate SDK logging with project logger
103-
SessionTimeout: 30 * time.Minute, // Prevent resource leaks from idle connections
103+
SessionTimeout: 30 * time.Minute, // Prevent resource leaks from idle connections
104104
})
105105

106106
// Wrap SDK handler with detailed logging for JSON-RPC translation debugging

0 commit comments

Comments
 (0)