TestIdleCleanupKeepsActiveUser in internal/ircserver/server_test.go fails on some runs, which turns script/cibuild red on next. It failed on ddfbdc1 with cleanup removes [{1 active} {2 idle}], want only idle and passed when the same build reran the suite with -v.
The test registers active and idle, sleeps idleTimeout (500 ms), has active send PING and wait for the PONG, then asks GetStaleOrphanSessions for sessions last seen before now minus 500 ms, and expects only idle. Sometimes active is in the result too. Find out why before changing anything; two readings fit: the session's last-seen time is stored at whole-second precision, so a touch at 12:00:00.9 reads back as 12:00:00 and is older than a cutoff of 12:00:00.4; or the touch is written after the PONG goes out, so the query can run first. If the code is wrong (the touch can land after the reply, or a precision loss could expire a user who is active), fix the code; if only the test's timing is wrong, fix the test so its outcome does not depend on timing.
Definition of done
The cause is stated in one line in the PR body.
TestIdleCleanupKeepsActiveUser passes on every run: the author runs script/cibuild at least three times in a row on the branch, under the gate lock, and all pass.
If the cause is in the code, a test that fails on the old code.
One reviewed PR against next.
Model: opus-5-5
`TestIdleCleanupKeepsActiveUser` in `internal/ircserver/server_test.go` fails on some runs, which turns `script/cibuild` red on `next`. It failed on `ddfbdc1` with `cleanup removes [{1 active} {2 idle}], want only idle` and passed when the same build reran the suite with `-v`.
The test registers `active` and `idle`, sleeps `idleTimeout` (500 ms), has `active` send `PING` and wait for the `PONG`, then asks `GetStaleOrphanSessions` for sessions last seen before now minus 500 ms, and expects only `idle`. Sometimes `active` is in the result too. Find out why before changing anything; two readings fit: the session's last-seen time is stored at whole-second precision, so a touch at 12:00:00.9 reads back as 12:00:00 and is older than a cutoff of 12:00:00.4; or the touch is written after the `PONG` goes out, so the query can run first. If the code is wrong (the touch can land after the reply, or a precision loss could expire a user who is active), fix the code; if only the test's timing is wrong, fix the test so its outcome does not depend on timing.
## Definition of done
1. The cause is stated in one line in the PR body.
2. `TestIdleCleanupKeepsActiveUser` passes on every run: the author runs `script/cibuild` at least three times in a row on the branch, under the gate lock, and all pass.
3. If the cause is in the code, a test that fails on the old code.
4. One reviewed PR against `next`.
Model: opus-5-5
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.
TestIdleCleanupKeepsActiveUserininternal/ircserver/server_test.gofails on some runs, which turnsscript/cibuildred onnext. It failed onddfbdc1withcleanup removes [{1 active} {2 idle}], want only idleand passed when the same build reran the suite with-v.The test registers
activeandidle, sleepsidleTimeout(500 ms), hasactivesendPINGand wait for thePONG, then asksGetStaleOrphanSessionsfor sessions last seen before now minus 500 ms, and expects onlyidle. Sometimesactiveis in the result too. Find out why before changing anything; two readings fit: the session's last-seen time is stored at whole-second precision, so a touch at 12:00:00.9 reads back as 12:00:00 and is older than a cutoff of 12:00:00.4; or the touch is written after thePONGgoes out, so the query can run first. If the code is wrong (the touch can land after the reply, or a precision loss could expire a user who is active), fix the code; if only the test's timing is wrong, fix the test so its outcome does not depend on timing.Definition of done
TestIdleCleanupKeepsActiveUserpasses on every run: the author runsscript/cibuildat least three times in a row on the branch, under the gate lock, and all pass.next.Model: opus-5-5