Problem
urlRewriteTransport.RoundTrip in internal/github/client_test.go:33 delegates to the process-global http.DefaultTransport. Every mock client built by setupMockClient therefore shares one connection pool, so all t.Parallel() tests in the package are coupled to each other's httptest server teardown.
This produces intermittent race-detector CI failures that look like real regressions on unrelated PRs.
Evidence
Observed in run 30752139053 on PR #395:
--- FAIL: TestClient_DeleteBranch_Success/long_branch_name
delete branch "very-long-branch-name-with-many-parts":
Delete "https://api.github.com/repos/owner/repo/git/refs/heads/very-long-branch-name-with-many-parts":
net/http: HTTP/1.x transport connection broken: http: CloseIdleConnections called
It passed on macOS in the same run and passed on re-run with no code change. PR #395 touched only cmd/clean.go, cmd/clean_test.go, and a docs page, so it could not have caused a failure in internal/github.
Fix
Give each mock client its own http.Transport instead of http.DefaultTransport, and close it in t.Cleanup alongside the server.
Acceptance criteria
urlRewriteTransport uses a per-instance http.Transport, not the global default.
setupMockClient closes idle connections for its own transport on cleanup.
go test ./internal/github/ -race -count=20 passes consistently.
Problem
urlRewriteTransport.RoundTripininternal/github/client_test.go:33delegates to the process-globalhttp.DefaultTransport. Every mock client built bysetupMockClienttherefore shares one connection pool, so allt.Parallel()tests in the package are coupled to each other'shttptestserver teardown.This produces intermittent race-detector CI failures that look like real regressions on unrelated PRs.
Evidence
Observed in run 30752139053 on PR #395:
It passed on macOS in the same run and passed on re-run with no code change. PR #395 touched only
cmd/clean.go,cmd/clean_test.go, and a docs page, so it could not have caused a failure ininternal/github.Fix
Give each mock client its own
http.Transportinstead ofhttp.DefaultTransport, and close it int.Cleanupalongside the server.Acceptance criteria
urlRewriteTransportuses a per-instancehttp.Transport, not the global default.setupMockClientcloses idle connections for its own transport on cleanup.go test ./internal/github/ -race -count=20passes consistently.