Skip to content

test: run EVAL timeout tests under testing/synctest#128

Merged
jig merged 1 commit into
developfrom
test/synctest-timeouts
Jul 23, 2026
Merged

test: run EVAL timeout tests under testing/synctest#128
jig merged 1 commit into
developfrom
test/synctest-timeouts

Conversation

@jig

@jig jig commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Wraps the EVAL context-deadline tests in synctest.Test (Go 1.25+): inside the bubble the time package uses a fake clock that only advances when every goroutine is durably blocked, so deadlines fire deterministically (no wall-clock jitter) and instantly (no real wait).

Converted: TestContextTimeoutFiresOnTime, TestContextNoTimeout, TestFutureContextTimeoutFiresOnTime, TestFutureContextNoTimeout, TestTimeoutOnTryCatch.

The headline win: TestTimeoutOnTryCatch goes back to a tight 500ms deadline — the value that was flaky under the real clock, which an earlier commit had widened to 2s to mask the jitter. Under the fake clock the catch handler runs at zero fake time, so the timeout is caught deterministically. Also drops the redundant concurrent.Load setup in the future tests (newEnv already loads it), which was building an env the test then didn't use.

Test plan

  • All five tests pass 30× under full CPU load in ~2.3s (vs tens of seconds of real waiting before).
  • Full suite green with and without -tags debugger (the debugger build activates the EVAL hook path; synctest still works).

🤖 Generated with Claude Code

Wrap the context-deadline tests (TestContextTimeoutFiresOnTime,
TestContextNoTimeout, the two future variants, TestTimeoutOnTryCatch) in
synctest.Test so the time package uses a fake clock: deadlines fire
deterministically (no wall-clock jitter) and instantly (no real wait).

This lets TestTimeoutOnTryCatch drop back to a tight 500ms deadline — the
value that was flaky under the real clock and which an earlier commit had
widened to 2s to paper over the jitter. Verified 30x under full CPU load,
all green, with and without -tags debugger. Also drops the redundant
concurrent.Load setup in the future tests (newEnv already loads it).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jig
jig merged commit cab7fa4 into develop Jul 23, 2026
14 checks passed
@jig
jig deleted the test/synctest-timeouts branch July 23, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant