From 45df36db9ef790f940d1d87d40eda47a33a48e32 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 18:38:41 +0000 Subject: [PATCH 1/3] Initial plan From ca714bd8fff731a074a1c9d1b9f05274052f3c44 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 18:42:35 +0000 Subject: [PATCH 2/3] fix: resolve race condition in TestBroadcastEvent_Delivery Co-authored-by: darkliquid <31256+darkliquid@users.noreply.github.com> --- internal/ipc/extra_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/internal/ipc/extra_test.go b/internal/ipc/extra_test.go index 2d82cbb..3cbdd48 100644 --- a/internal/ipc/extra_test.go +++ b/internal/ipc/extra_test.go @@ -262,6 +262,22 @@ func TestBroadcastEvent_Delivery(t *testing.T) { } defer rawConn.Close() + // Wait until the server has tracked the connection before broadcasting, + // otherwise the event is sent to an empty set of connections. + for { + srv.mu.Lock() + tracked := len(srv.conns) + srv.mu.Unlock() + if tracked > 0 { + break + } + select { + case <-ctx.Done(): + t.Fatal("timed out waiting for server to track connection") + case <-time.After(5 * time.Millisecond): + } + } + // Broadcast an event. srv.BroadcastEvent(&ipcv1.Event{ Kind: &ipcv1.Event_IndexUpdated{IndexUpdated: &ipcv1.IndexUpdatedEvent{}}, From 41ac3df987e9c0495d55eb2f6fb276a0e0c0752c Mon Sep 17 00:00:00 2001 From: Andrew Montgomery Date: Sun, 15 Mar 2026 18:49:36 +0000 Subject: [PATCH 3/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- internal/ipc/extra_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/ipc/extra_test.go b/internal/ipc/extra_test.go index 3cbdd48..b758b1e 100644 --- a/internal/ipc/extra_test.go +++ b/internal/ipc/extra_test.go @@ -264,6 +264,8 @@ func TestBroadcastEvent_Delivery(t *testing.T) { // Wait until the server has tracked the connection before broadcasting, // otherwise the event is sent to an empty set of connections. + ticker := time.NewTicker(5 * time.Millisecond) + defer ticker.Stop() for { srv.mu.Lock() tracked := len(srv.conns) @@ -274,7 +276,7 @@ func TestBroadcastEvent_Delivery(t *testing.T) { select { case <-ctx.Done(): t.Fatal("timed out waiting for server to track connection") - case <-time.After(5 * time.Millisecond): + case <-ticker.C: } }