Repository navigation
flaky tests: fix supervisor and relay manager data races, gate package on -race - #185
Merged
Merged
Conversation
… on -race Three races, all between the goroutine that runs the broker and whoever stops it: - Supervisor: the stop func read cmd.Process while cmd.Start wrote it. The process handle is now published under a lock, and a stop that lands before the process exists kills it as soon as it starts. - relayInstanceManager.supervisor was written by Start's goroutine and read/cleared by Close with no synchronisation; it is now guarded. - Start returned the shared err after its wait timed out while the goroutine could still be writing it; the goroutine now publishes through a mutex-guarded result. With those fixed the whole package passes -race, so it joins RACE_CLEAN_PKGS and the reflector-only test gating goes away. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It was a local untracked file swept up by the previous commit; with no golden file beside it, TestRenderGolden fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shawnburke
enabled auto-merge (squash)
November 9, 2026 21:27
ashiramin
approved these changes
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
go test -race ./server/snykbroker/failed onmain(7 tests, 31 race reports). CI didn't catch it becausemake test-raceonly covered the reflector tests in this package. Three races, all between the goroutine that runs the broker and whoever stops it:supervisor.go): the stop func readcmd.Processwhilecmd.Start()wrote it on another goroutine. The process handle is now published under a lock. A stop that arrives before the process exists kills it as soon as it starts, instead of waiting for it to exit on its own.relayInstanceManager.supervisor: written byStart's goroutine and read/cleared byClosewith no synchronisation. It's now guarded, with acurrentSupervisor()accessor that the tests use too.Start's return value:Startreturned the sharederrafter its wait timed out, while the goroutine could still be writing it (fromsupervisor.Startorsupervisor.Wait). The goroutine now publishes the result through a mutex-guardedstartResult, andStartreturns the same value as before.With those fixed the whole package passes
-race../server/snykbroker/...moves intoRACE_CLEAN_PKGSand the reflector-only-rungating is removed.Still not race-clean, unchanged here:
server,server/handler,server/http(the handler manager and the fx server stack).Test plan
go test -race -count=5 ./server/snykbroker/...: clean, no race reportsgo test -raceover the fullRACE_CLEAN_PKGSlist: all passgo test ./server/snykbroker/without-race: passes🤖 Generated with Claude Code