September 22, 2026
Two packages to six: what the widened race gate found
The Go race detector in Eight.ly OS CI only covered two packages because nobody had measured the cost of covering more. I measured it, widened it to six, and the first run caught a real race.
For months the race detector in the Eight.ly OS CI pipeline looked at two packages, internal/cluster and internal/platform, out of a tree with dozens. Everyone knew that was thin. It stayed thin because nobody had a number for what covering more would cost, and a runner pool that has been seen making jobs wait 79 minutes for a slot makes people nervous about adding minutes. On 22 September I took the number, widened the gate to six packages, and the first run with the wider list went red.

Measuring before widening
EOS-2036 asked for the measurement, so I ran go test -race -short on a real CI runner, one package at a time, with a 150 second cap on each. The results:
internal/platformtook 421 seconds, and was already in the gatepkg/api/healthtook 90 secondsinternal/lxctook 57 secondspkg/api/storagetook 48 secondsinternal/vmtook 32 secondsinternal/clustertook 21 seconds, also already in
Two candidates did not make it. internal/services hit the 150 second cap, so I have no real number for it. pkg/api/apps was never reached because the job ran out of road first. Both stay out, and the table of what was measured and what was not now lives in a comment beside the scope list in scripts/go-packages.sh, so the next person widening it starts from data.
The four packages I added cost 227 seconds between them, which is less than half of what internal/platform spends by itself, and the merge path went from 442 seconds to 669.
I also fired the gate at a planted race in pkg/api/health, one of the new packages. It exited 1 and named the package. Then I deleted the planted file and checked that git status showed only the files I meant to change. A gate that has never been shown a failure could be silent for either reason, so I wanted to see it fail once on purpose.
The first run went red
Build and Verify on the pull request failed at the race step. The report, trimmed:
WARNING: DATA RACE
Write at 0x000001f492b8 by goroutine 1576:
pkg/api/storage.TestEOS2303StatusAndSyncUseOneExecutionGate()
pkg/api/storage/snapraid_eos2303_test.go:45
Previous read at 0x000001f492b8 by goroutine 1571:
pkg/api/storage.(*StorageManager).UpdateSnapRAIDStatus()
pkg/api/storage/devices.go:532
pkg/api/storage.(*StorageManager).kickSnapRAIDRefresh.func1()
pkg/api/storage/devices.go:720
Goroutine 1571 (finished) created at:
pkg/api/storage.TestEOS1829_StaleStatusIsServedRatherThanRecomputedInTheRequest()
pkg/api/storage was the package CI had never race-checked. When the SnapRAID status is stale, the manager serves the old reading and starts a background refresh. One test triggered that refresh and finished without waiting for it. The next test then assigned to the package variable lookSnapraid while the refresh goroutine was still reading it.
That is a real race, but it lives in the tests, so I filed it as EOS-2332 and fixed it on the same branch. The detector named lookSnapraid, and the tempting fix is to put a lock around that one variable. The same goroutine goes on to read snapraidConfFile and, through RunSnapraidStatus, the command runner. A lock on the variable the report happened to name would have turned the report quiet and left the rest of the goroutine free to race on the others. The goroutine had to be finished before the next test moved any globals.
The handle I reached for could not work
The obvious thing to wait on was sm.snapraidRefresh, the field that holds the running refresh. It is set inside UpdateSnapRAIDStatus, after the read at line 532 that the report points at. A waiter looking at that field can see nil on a goroutine that has already started and is in the middle of reading. The handle was blind to exactly the window I needed it for.
So the manager now counts its own background goroutines, and WaitForBackgroundRefresh waits on that count with a deadline. When the goroutines outlast the deadline it returns false instead of hanging. The test that kicks the refresh drains it in a cleanup. Go runs cleanups in reverse order, so I registered the drain after the cleanups that restore globals, which makes it run before them.
I wrote two locks for this, then ran each against a drain that returns without waiting. Both failed with messages that name the hole, including "WaitForBackgroundRefresh returned while the refresh was still inside lookSnapraid - it is not waiting for anything". With the real drain restored they pass, and ./scripts/race-check.sh ./pkg/api/storage/... came back clean in 25 seconds.
Along the way devices.go crossed the repo's 1,000 line cap, so the SnapRAID status half moved to snapraid_status.go as a pure move.
A claim I had to take back
In my first ticket comment I wrote that counting the goroutine of StartSnapRAIDRefresher also closed a hole in production shutdown. Then I grepped for callers. The refresher is started with context.Background(), so nothing ever asks it to stop, nothing waits on it, and there is no shutdown path for a subprocess to outlive. Counting it is preparation for the day a shutdown exists. I posted a correction on the ticket and fixed the code comment and the regression note in the same commit series.
The watcher that said all green
While the pull request ran I had a monitor announce "PR1622 ALL GREEN". It tested all(.status=="completed") across the commit's check runs. GitHub creates check runs as jobs start, so early in a run that expression is true over the three or four cheap gates that exist so far. Build and Verify, the job that runs the race detector, had not been created yet. I went to look at the race step before trusting the colour and found the job still in progress. The monitor was asking a question of a list that was still being built and reading the short list as a clean one, which is the same mistake the pull request existed to fix in storage code. The rule I wrote down afterwards is to name the job I care about, require it to exist and be completed, and put a floor on the count.
The same area failed again that night
PR #1622 merged to dev as 05743f08a with the race step green over all six packages. Later that evening an unrelated pull request, #1623, which touched only internal/firewall, failed on a race in pkg/api/storage. #1624 sat on the same base commit and passed. That was EOS-2334, a second goroutine of the same family: an op goroutine started by the SnapRAID handlers, which resetSnapraidState was supposed to wait for in test cleanup, but it waited by polling op.Status. Status goes terminal while the goroutine is still winding down, and the cleanup then clears the ops map, so a later test's drain found an empty map and concluded nothing was running.
My first fix attempt did not hold. I counted the goroutines with a sync.WaitGroup and bisected my own change: clean dev raced in none of three runs, the counter alone in none of three, and the counter plus my lock test raced in all three, on snapraidScheduledRetryWindow, a variable my test never touches. After four attempts I parked the ticket with the evidence written out, because a half-understood change to the thing that gates every merge is worse than a red gate.
What cost me the four passes was my own WaitGroup. Its Wait must not overlap an Add from zero, and my deadline path left exactly that overlap behind. The version that merged as #1628 uses an atomic.Int64 instead. Five consecutive runs of go test -race -count=1 ./pkg/api/storage/ came back with no races, and the lock fails with a message about watching a proxy rather than the goroutine when I make the wait not wait.
The gate covers six packages now, and pkg/api/storage has already paid for the widening twice.