# test\(server\): ban real-clock waits in tests · PR \#22564 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/22564)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: merged

Source repository: pingdotgg/t3code

Source branch: tests/no-real-time-wait

Target branch: tests/no-wall-clock

Head commit: a9550e8cf64dfa10a839f19573a6384017669bbe

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/22564)

[Commits](https://git.cafe/pingdotgg/t3code/pull/22564/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/22564/diffs?format=markdown)

## Description

---

## Problem
`it.effect` runs on a TestClock, so `Effect.sleep` there only advances via `TestClock.adjust`; under `it.live` or plain `it` it is a real wait. Tests mixed the two, polled projections with 5 ms sleeps, and asserted "nothing happened" by sleeping 200 ms. These are the `tunnel`, `AcpAdapterV2`, `OrchestratorMcpToolkit` and `PullRequestReviewGuideService` flakes.

## Fix
- New rule `t3code/no-real-time-wait-in-tests` (non-browser test files): flags `Effect.sleep`/`delay`/`Schedule.spaced` under a real-clock tester, `Effect.sleep` under `it.effect` in a file that never adjusts the TestClock, and timer-in-Promise waits. `Effect.timeout*` safety nets are not flagged.
- 31 files rewritten to await the event that marks the milestone (Deferred, latest projection sequence, a tracer span end, TestClock adjust). 7 suppressions outside live tests, each on a real-OS wait with no awaitable signal (pid files, process exit, a macrotask boundary); 7 in env-gated live probes.

Part of the anti-flake stack (#22563). Context: main was red in ~600 of ~2,900 runs since September; the genuinely flaky tests all waited on real time, scheduler budgets, or renderer frames. These rules make those tests fail lint instead of CI.

Made with Claude Opus 5.5 and Claude Fable 5.1 in Claude Code (T3 Code).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
