From 2bb6ac6faa2ab24db501212e4ccf2c3c9db446ed Mon Sep 17 00:00:00 2001 From: Luis Pater Date: Sun, 25 Oct 2026 02:10:05 +0800 Subject: [PATCH] fix(lint): resolve go vet lostcancel and static analysis warnings from v8.0.42 - Defer context cancellation in TestCancelableConnClosesUnderlyingTransportWhenCloseRacesCancel to satisfy go vet lostcancel across all control flow paths. - Remove the unused streamBridgeStream.close wrapper left behind after the closeWithError refactor in internal/pluginhost. - Annotate shared "gin" string context keys in TestIssue6825SDKCallerReplayIsolation with nolint:staticcheck directives. Closes: #6953 --- internal/home/cluster_balance_regression_test.go | 1 + internal/pluginhost/stream_bridge.go | 4 ---- internal/runtime/executor/antigravity_issue6825_test.go | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/home/cluster_balance_regression_test.go b/internal/home/cluster_balance_regression_test.go index 2bec31bfa..8640da477 100644 --- a/internal/home/cluster_balance_regression_test.go +++ b/internal/home/cluster_balance_regression_test.go @@ -291,6 +291,7 @@ func TestCancelableConnClosesUnderlyingTransportWhenCloseRacesCancel(t *testing. } ctx, cancel := context.WithCancel(context.Background()) + defer cancel() if mode == "pre-canceled" { cancel() } diff --git a/internal/pluginhost/stream_bridge.go b/internal/pluginhost/stream_bridge.go index 8466823f6..6cd5b1639 100644 --- a/internal/pluginhost/stream_bridge.go +++ b/internal/pluginhost/stream_bridge.go @@ -194,10 +194,6 @@ func (s *streamBridgeStream) emit(ctx context.Context, chunk pluginapi.ExecutorS return <-request.done } -func (s *streamBridgeStream) close(errorMessage string) { - s.closeWithError(rpcStreamError(errorMessage, nil)) -} - func (s *streamBridgeStream) closeWithError(err error) { if s == nil { return diff --git a/internal/runtime/executor/antigravity_issue6825_test.go b/internal/runtime/executor/antigravity_issue6825_test.go index f6cb186e3..d86474d74 100644 --- a/internal/runtime/executor/antigravity_issue6825_test.go +++ b/internal/runtime/executor/antigravity_issue6825_test.go @@ -396,10 +396,10 @@ func TestIssue6825SDKCallerReplayIsolation(t *testing.T) { gin.SetMode(gin.TestMode) ginCtxA, _ := gin.CreateTestContext(httptest.NewRecorder()) ginCtxA.Set("userApiKey", "downstream-api-key-A") - ctxA = context.WithValue(context.Background(), "gin", ginCtxA) + ctxA = context.WithValue(context.Background(), "gin", ginCtxA) //nolint:staticcheck -- "gin" is the shared Gin context key contract. ginCtxB, _ := gin.CreateTestContext(httptest.NewRecorder()) ginCtxB.Set("userApiKey", "downstream-api-key-B") - ctxB = context.WithValue(context.Background(), "gin", ginCtxB) + ctxB = context.WithValue(context.Background(), "gin", ginCtxB) //nolint:staticcheck -- "gin" is the shared Gin context key contract. } assistantA, _ := conversation.callWithContext(ctxA, []byte(issue6825FirstRequest), optsA, scenario.enrich, metadataA) assistantB, _ := conversation.callWithContext(ctxB, []byte(issue6825FirstRequest), optsB, scenario.enrich, metadataB)