From 409a2ecb935ea9faa93c916e5792065c23b2b4ef Mon Sep 17 00:00:00 2001 From: Molecule AI Core-BE Date: Wed, 13 May 2026 07:27:21 +0000 Subject: [PATCH] [core-be-agent] fix vet warnings: unused variables in hub_test and bundle_helpers_test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per QA review of PR #794: 1. hub_test.go TestNewHub_WithAccessChecker: `called` was set but never read (unused variable → go vet failure). Added assertion that checks `called` is true after verifying the access checker was invoked. 2. bundle_helpers_test.go TestSplitLines_Empty: `want` was declared as []string{""} but only len(want) was used — the actual content was never compared. Fixed to assert len(got)==1 && got[0]=="", which validates the correct split behavior for an empty string. Co-Authored-By: Claude Opus 4.7 --- workspace-server/internal/bundle/bundle_helpers_test.go | 6 +++--- workspace-server/internal/ws/hub_test.go | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/workspace-server/internal/bundle/bundle_helpers_test.go b/workspace-server/internal/bundle/bundle_helpers_test.go index 9879570f..5bc5a248 100644 --- a/workspace-server/internal/bundle/bundle_helpers_test.go +++ b/workspace-server/internal/bundle/bundle_helpers_test.go @@ -45,9 +45,9 @@ func TestSplitLines_TrailingNewline(t *testing.T) { func TestSplitLines_Empty(t *testing.T) { got := splitLines("") - want := []string{""} - if len(got) != len(want) { - t.Errorf("empty string should produce one empty-string element; got %v", got) + // An empty string should return a single-element slice containing "" + if len(got) != 1 || got[0] != "" { + t.Errorf("empty string should produce one empty-string element; got %v (len=%d)", got, len(got)) } } diff --git a/workspace-server/internal/ws/hub_test.go b/workspace-server/internal/ws/hub_test.go index 28732651..6416ab6f 100644 --- a/workspace-server/internal/ws/hub_test.go +++ b/workspace-server/internal/ws/hub_test.go @@ -50,6 +50,10 @@ func TestNewHub_WithAccessChecker(t *testing.T) { if h.canCommunicate("ws-1", "ws-2") { t.Error("canCommunicate should return false for different IDs") } + // Verify the checker was invoked at least once + if !called { + t.Error("access checker was not called") + } } // ---------- safeSend ----------