Observed during the Docker gate on #194 (the finding is unrelated to that PR, which touches no webhook code).
TestExtractBranch/extracts_develop_branch in internal/service/webhook flaked once with a t.TempDir cleanup failure: RemoveAll: directory not empty. Cause is an async deployment goroutine still writing into the subtest's temp directory after the subtest has returned, so Go's automatic t.TempDir cleanup races the late write. A re-run passed (host re-runs were 0/8), so it is intermittent.
Why it matters: make check runs go test -race, and a flaky cleanup failure can turn the gate red on an otherwise-good commit. Because the CI gate is what protects next and main, an intermittently-red gate is a real problem even though the production code is fine.
Definition of done
Identify the goroutine (deployment/async path) that writes under the test's t.TempDir after the relevant subtest returns.
Make the test deterministically wait for that async work to finish before it returns (e.g. synchronize on completion, inject a controllable clock/hook, or scope the temp dir so the late writer cannot touch a dir being cleaned up) — do not merely retry or sleep.
Demonstrate stability: the affected test passes repeatedly under -race (e.g. -count=20) with no RemoveAll: directory not empty.
make check green via the Docker gate. Lands via PR from a feature branch off next.
Model: opus-4-8
Observed during the Docker gate on https://git.eeqj.de/sneak/upaas/pulls/194 (the finding is unrelated to that PR, which touches no webhook code).
`TestExtractBranch/extracts_develop_branch` in `internal/service/webhook` flaked once with a `t.TempDir` cleanup failure: `RemoveAll: directory not empty`. Cause is an async deployment goroutine still writing into the subtest`'`s temp directory after the subtest has returned, so Go`'`s automatic `t.TempDir` cleanup races the late write. A re-run passed (host re-runs were 0/8), so it is intermittent.
Why it matters: `make check` runs `go test -race`, and a flaky cleanup failure can turn the gate red on an otherwise-good commit. Because the CI gate is what protects `next` and `main`, an intermittently-red gate is a real problem even though the production code is fine.
## Definition of done
- Identify the goroutine (deployment/async path) that writes under the test`'`s `t.TempDir` after the relevant subtest returns.
- Make the test deterministically wait for that async work to finish before it returns (e.g. synchronize on completion, inject a controllable clock/hook, or scope the temp dir so the late writer cannot touch a dir being cleaned up) — do not merely retry or sleep.
- Demonstrate stability: the affected test passes repeatedly under `-race` (e.g. `-count=20`) with no `RemoveAll: directory not empty`.
- `make check` green via the Docker gate. Lands via PR from a feature branch off `next`.
Model: opus-4-8
The webhook Service now tracks its deployment goroutines in a sync.WaitGroup and exposes WaitForDeployments; the webhook tests wait on it instead of sleeping 100ms, so the async writer can no longer race t.TempDir cleanup. go test -race -run TestExtractBranch -count=20 ./internal/service/webhook is green with no RemoveAll errors, and make check is green via the Docker gate.
Model: opus-4-8
Fixed in https://git.eeqj.de/sneak/upaas/pulls/201.
The webhook `Service` now tracks its deployment goroutines in a `sync.WaitGroup` and exposes `WaitForDeployments`; the webhook tests wait on it instead of sleeping 100ms, so the async writer can no longer race `t.TempDir` cleanup. `go test -race -run TestExtractBranch -count=20 ./internal/service/webhook` is green with no `RemoveAll` errors, and `make check` is green via the Docker gate.
Model: opus-4-8
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Observed during the Docker gate on #194 (the finding is unrelated to that PR, which touches no webhook code).
TestExtractBranch/extracts_develop_branchininternal/service/webhookflaked once with at.TempDircleanup failure:RemoveAll: directory not empty. Cause is an async deployment goroutine still writing into the subtest's temp directory after the subtest has returned, so Go's automatict.TempDircleanup races the late write. A re-run passed (host re-runs were 0/8), so it is intermittent.Why it matters:
make checkrunsgo test -race, and a flaky cleanup failure can turn the gate red on an otherwise-good commit. Because the CI gate is what protectsnextandmain, an intermittently-red gate is a real problem even though the production code is fine.Definition of done
'st.TempDirafter the relevant subtest returns.-race(e.g.-count=20) with noRemoveAll: directory not empty.make checkgreen via the Docker gate. Lands via PR from a feature branch offnext.Model: opus-4-8
Fixed in #201.
The webhook
Servicenow tracks its deployment goroutines in async.WaitGroupand exposesWaitForDeployments; the webhook tests wait on it instead of sleeping 100ms, so the async writer can no longer racet.TempDircleanup.go test -race -run TestExtractBranch -count=20 ./internal/service/webhookis green with noRemoveAllerrors, andmake checkis green via the Docker gate.Model: opus-4-8