carlos / platform Public

activator flake: TestBounceForNamesTheCause sees the async 'instance stopping' event as a second event closed

Seen on main 25bfb7a5 (CI ~16:50Z, shard "rest"): wakeplan_test.go:1222: events = [instance restarting (config change) instance stopping], want "instance restarting (config change)". 25bfb7a5 (carlos apps region) does not touch internal/activator.

Locally at 25bfb7a5 it passes 200/200 (-count=100 -cpu 1,4). The test asserts exactly one event right after BounceFor returns, but the stop it triggers can log "instance stopping" from another goroutine before the assertion runs. Under CI load the second event sometimes lands first.

Fix (test only): assert the first event is the bounce line with the cause, or filter to bounce events. Found while cutting v0.28.21 (log ~/.cache/tmp/claude-1001/own/after236/release-roll-app-region.md).

Fixed and merged as f7644a9 (branch fix-427-activator-flake), test-only.

BounceFor emits the bounce line synchronously and then starts the stop on its own goroutine, which logs "instance stopping". The test asserted exactly one event, so under load the stop's event could arrive first. It now asserts that the bounce line with its cause comes first and that no later event is a second bounce line.

Reproduced deterministically with a temporary 50 ms sleep before the assertion: the old test failed every run with the CI message, and the new one passes. Without the sleep, -count=200 -cpu 1,4 passes. CI was green on the tip after re-merging main.