tests: await scheduler passes instead of sleeping past the tick #20
Loading…
Reference in a new issue
No description provided.
Delete branch "faster-test-waits"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Negative assertions ("nothing was dispatched" or "nothing was cancelled") waited out a fixed 2.5–5 s so that a 2 s scheduler tick had surely run. That was ~90 s of the kb-control-plane suite's 138 s serial time.
AppState::passes(awatchchannel) after every pass.common::settle(&server): wakes the scheduler and waits for a whole pass that started after the call. It waits for two passes, because one already in flight may have read the world before the change. The assertion then allows onlyQUIET(300 ms) for an already-sent message to arrive over loopback.succeed(build), replaysucceed(retry), expand_needs' expansion, pr_events' eval), the test first waits for it to land withcommon::wait_task_state(moved up from inflight_dedup). Without that, the settled pass might not have seen the event and the negative would pass vacuously.wait_task_statetocommon.itRUST_TEST_THREADS=1, what CI gets today)Checks:
cargo clippy --workspace --all-targets -D warningsis clean,cargo test --workspacepasses, and the control-plane suite passed 8/8 looped runs.🤖 Generated with Claude Code
Negative assertions ("nothing was dispatched / cancelled") waited out a fixed 2.5-5 s window so that a 2 s scheduler tick had surely run. The scheduler now counts completed passes (`AppState::passes`, a watch channel), and `common::settle` wakes it and waits for a whole pass that started after the call; the assertion then only allows `QUIET` (300 ms) for an already-sent message to arrive. Where the preceding step is an agent event over the WebSocket, the test first waits for it to land (`common::wait_task_state`, moved up from inflight_dedup), so the pass is one that saw it. kb-control-plane suite: 138 s serial / 12.4 s on 16 threads before, 55 s / ~7 s after. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>@krisbuild r+ p=7
Merged as
1066fa92da.