test(http): prove the drain re-arms off its own signal, not a stopwatch
`test-coverage-zig` failed on this branch: the straggler test raced a flat
180ms hold against a 60ms drain round and assumed the hold outlasted round
one. Under kcov it does not. A round is two 50ms polls PLUS a
mutex-guarded count() per iteration, so the instrumented round inflates
faster than a flat sleep does: round one already found the registry empty,
awaitEmptyRounds returned 0, and `expect(rounds >= 1)` tripped.
Not a product fault — awaitEmptyRounds behaved correctly both times. Only
the test's premise ("one round is shorter than the hold") broke, and
instrumentation is exactly what inverts it.
The premise is now gone. The drain runs on its own thread and the
straggler leaves only AFTER the drain emits its own `drain_incomplete`
warn — the authoritative signal that a round completed with the registry
still non-empty — observed by a small atomic-counting log sink. This works
because test builds route every emit to the sink registry and never to
std.log, so registering the sink both delivers the warn and keeps it off
stderr, which is why the old test had to silence logs at all.
No relative-speed assumption survives: instrumentation makes this slower,
never wrong. The wait is bounded, so a drain that genuinely never re-arms
fails as DrainNeverReArmed instead of hanging the suite.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> K
Kishore Kumar committed
751d29058d90c695924df31274816fac61f190a6
Parent: b90391f