symlinkguard: Watch alert-queue tests flake under -race and CPU load #193

Closed
opened 2026-10-05 21:01:06 +00:00 by mathias · 0 comments
Owner

Source: found during the pr-gatekeeper review of PR #190 (round 3), 2026-10-05.

On origin/main I compiled the symlinkguard tests with -race (go test -race -c ./internal/symlinkguard/). Running 8 copies of the binary in parallel, each with -test.count=10, 3 of the 8 failed:

  • TestWatchAccountsForEveryRemovalDuringAnOutage (2)
  • TestWatchQueueIsBoundedDuringAnOutage (1)

The PR #190 head fails the same way under the same load: TestWatchAccountsForEveryRemovalDuringAnOutage and TestWatchDeliversEveryQueuedAlertAfterAShortOutage, 1 each. It also failed once in a plain sequential go test -race -count=5 run. The new #179 tests never failed.

These are timing-dependent Watch/deliver tests: 10ms intervals with wall-clock waits. Under CPU contention they flake. The danger is a red gate that people learn to re-run. It can also go the other way: a test loosened to stop flaking stops proving what it is named for.

Done when

  • The Watch alert-queue tests pass 8 parallel x -test.count=10 under -race with zero failures. This must come from a deterministic clock or synchronisation, not longer timeouts.
  • A flip of each test's mechanism still turns it red.
**Source:** found during the pr-gatekeeper review of PR #190 (round 3), 2026-10-05. On origin/main I compiled the symlinkguard tests with `-race` (`go test -race -c ./internal/symlinkguard/`). Running 8 copies of the binary in parallel, each with `-test.count=10`, 3 of the 8 failed: - `TestWatchAccountsForEveryRemovalDuringAnOutage` (2) - `TestWatchQueueIsBoundedDuringAnOutage` (1) The PR #190 head fails the same way under the same load: `TestWatchAccountsForEveryRemovalDuringAnOutage` and `TestWatchDeliversEveryQueuedAlertAfterAShortOutage`, 1 each. It also failed once in a plain sequential `go test -race -count=5` run. The new #179 tests never failed. These are timing-dependent Watch/deliver tests: 10ms intervals with wall-clock waits. Under CPU contention they flake. The danger is a red gate that people learn to re-run. It can also go the other way: a test loosened to stop flaking stops proving what it is named for. ## Done when - The Watch alert-queue tests pass 8 parallel x `-test.count=10` under `-race` with zero failures. This must come from a deterministic clock or synchronisation, not longer timeouts. - A flip of each test's mechanism still turns it red.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/hyperguild#193