Repository navigation
Description
Filing this so it isn't lost: CI caught a data race once, and a re-run of the identical commit passed. It is intermittent, not deterministic — but the Go race detector does not emit false positives, so a real race exists on this path and currently has no owner.
Evidence
| run | commit | result |
|---|---|---|
| CI (run 35154427430) | 336bc9e |
FAIL — TC06-OverrideFalse: race detected during execution of test |
| CI re-run | 336bc9e (same) |
pass |
| Local, CI's exact flags | 336bc9e (same) |
pass, 0 race reports, 240s |
--- FAIL: TestController (177.08s)
--- FAIL: TestController/RepoControllerFeatures (177.08s)
--- FAIL: TestController/RepoControllerFeatures/TC06-OverrideFalse (4.67s)
testing.go:1865: race detected during execution of test
Reproduction attempt (did not trigger it):
go test ./internal/controllers/repo/ -race -tags=unit,integration -p 1 -timeout 900s -run TestController
Why it surfaced now, and why that is probably not the cause
It appeared on #14's second CI run. That commit changes only go.mod/go.sum (provider-runtime v1.3.0 → v1.3.1); the same PR passed test on the preceding commit. A dependency bump that alters scheduling is a classic way to expose a pre-existing latent race rather than introduce one — but that is a hypothesis, not a finding, and it should not be assumed.
Why it is worth chasing despite being flaky
- A race detector hit means a genuine unsynchronised access exists; flakiness only reflects how often the scheduler interleaves the two goroutines.
- It will keep randomly reddening unrelated PRs, which trains people to re-run CI until green — the habit that lets a real failure through.
What would actually settle it
The failing run's race stack (the WARNING: DATA RACE block with both conflicting accesses). The captured log was truncated before it — worth checking the raw job artifact, or running the suite in a loop under -race with -count=N on a machine with more cores than a local dev box.
Likely places to look, in rough order: the integration harness's shared Gitea/server fixtures across RepoControllerFeatures subtests, then anything the controller mutates concurrently with the test goroutine's assertions.
Noticed while migrating this repo to the krateo-platformops fork (#14); that PR was merged after the re-run went green, deliberately rather than silently.
🤖 Generated with Claude Code
Activity
braghettos commentedon Sep 18, 2026
Fourth data point, and the first one run with CI's exact command locally.
Running tally on the suspected race:
336bc9eTC06-OverrideFalse: race detected-raceSo: 1 in 4, and not reproducible on demand. That does not make it unreal — the Go race detector has no false positives, so a genuine unsynchronised access exists. It only tells us the interleaving is rare on the hardware we have.
What this rules out is a cheap fix: there is no repro to iterate against, so any change would be speculative and unverifiable. What would actually move it:
WARNING: DATA RACEblock. The captured log was truncated before it. If the raw job artifact for run35154427430is still retrievable, that single stack names both conflicting accesses and likely ends the investigation in minutes.-count=Nunder load on a machine with more cores than a dev box — the interleaving is scheduler-dependent, and more parallelism is the lever.Leaving open and unassigned rather than closing it as flaky. A race that reddens ~1 PR in 4 trains people to re-run CI until green, which is the habit that lets a real failure through — so it is worth someone's time even though nothing is visibly broken.
braghettos commentedon Sep 18, 2026
Resolved — and it turns out this was already fixed by #13 before the tally above was even finished.
The stack, finally
My previous comment said the original
WARNING: DATA RACEblock would end this in minutes if it were still retrievable. It was, and it did.It was retrievable the whole time; I was looking at the wrong thing. Run
35154427430hasrun_attempt: 2, andgh run view --logserves the latest attempt — the green re-run. The failing log is attempt 1, reachable only through the API:(That log is served as binary, so plain
grepsilently matches nothing and reports a clean file. It needsgrep -a. Worth knowing — it reads exactly like "no race here.")What raced
Two blocks, same signature, and exactly the failing subtest —
TC06-OverrideFalse.GetLatestCommitRemote's deferred restore calledInstallProtocolto put the default client back, writing go-git's process-globaltransport/client.Protocolsmap while another goroutine was inside a remote operation reading it.Why it's fixed
b8be3fe— "fix(git): stop mutating go-git's process-global transport registry" (#13) — put async.RWMutexaround that registry: operations needing no custom client take the read lock and share go-git's default, and only the cookie-jar and capability paths write, under the exclusive lock, restoring the defaults before releasing.setDefaultHTTPSClientis gone; the survivingInstallProtocolcalls are both inside the write lock.Timeline lines up exactly:
336bc9eb8be3femergedSo data points 1–3 in the tally were all pre-fix, and only #4 was on fixed code. "1 in 4" was really "it failed while it was broken."
Pinned by
TestTransportRegistryIsRaceFreeininternal/clients/git/transport_test.go, which reintroduces the failure mode if anyone adds an unsynchronisedInstallProtocolcall back.Worth recording
The hypothesis in the issue body was that the provider-runtime
v1.3.0 → v1.3.1bump exposed a pre-existing latent race rather than introducing one. That was right — the racing code predated the bump; different scheduling just made the interleaving reachable.And the consequence was worse than a red CI run: a "concurrent map read and map write" is fatal and unrecoverable, so if it landed between provider-runtime writing
krateo.io/external-create-pendingand writing the create result, the managed resource wedged permanently on "cannot determine creation result". That is the same wedge tracked in core-provider#110.Closing as fixed by #13.