Repository navigation
fix(moq-ffi): time the failing-first-dial test's dial on the test clock - #9431
Conversation
The test's second half dialed a real server with the first half's 100 ms real-time dial timeout. Under CPU load the handshake outlasted it, the first dial failed for good (by design since #8478), and the unbounded server.accept() waited until nextest killed it. Split it: the failing dial runs on moq-ffi's Manual test clock and fails when the test advances it; the accepted-session lifecycle gets its own test on an ephemeral port with no dial bound to race, and bounds every await by TIMEOUT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. It splits the flaky test so the failing-dial half runs on the FFI runtime's Manual clock and is deterministic. The accepted-session half drops the 100 ms real-time dial bound that a slow handshake could outlast, and every await in it is now bounded.
Reviewed changes: I reviewed the single commit, which touches only rs/moq-ffi/src/test.rs.
session_state_names_a_failing_first_dialon the test clock: This half starts the runtime withffi::start_test_clock(), the same patternstandalone_refresh_waits_out_the_intervaluses. It waits for the dial's first packet on a silenttokio::net::UdpSocketand then advances the clock byDIAL. The ordering holds:reconnect.rsdial()sets the deadline tonow + timeoutbefore it sends anything. On a frozen clock that deadline is T0+DIAL.- The Manual
Timer::pollfires right away even if it is armed after the advance. - The test body's
kio::clock::timeoutwatchdogs run on the#[tokio::test]runtime's host clock, because the Manual clock is installed per runtime id. They only fire if the test fails.
session_state_reports_an_accepted_sessionsplit out: This half uses a real handshake with the default dial bound and an ephemeral server port.listen,accept, andrequest.acceptare now each wrapped inTIMEOUT, so a regression fails the test instead of hanging it until nextest kills it.
claude-opus-5-5 | 𝕏
The Nightly hang it cites ran code from before #9431, which moved the test's dial onto the manual clock. Every Nightly Gate since passes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moq-dev#9497) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Problem
moq-ffi test::session_state_names_a_failing_first_dialhung until nextest killed it at 120 s in Nightly run 45035580806 (Gate,ci: test rs). It is in the PR gate too.The test's second half (the accepted session's lifecycle) reused the first half's config, so it dialed a real server with a 100 ms real-time dial timeout. Under CPU load the QUIC handshake outlasted it; a failed first dial ends the session without redialing (by design since #8478), and the test's unbounded
server.accept().awaitwaited forever.Approach
Split the test in two:
session_state_names_a_failing_first_dialstarts the FFI runtime on its Manual test clock (ffi::start_test_clock, asstandalone_refresh_waits_out_the_intervaldoes). It waits for the dial's first packet on the silent socket (the reconnect policy fixes the deadline before it sends), then advances the clock by the dial timeout. That makes it deterministic, and it no longer waits 100 ms of real time.session_state_reports_an_accepted_sessioncovers the accepted side on a real handshake. The QUIC handshake can't complete on a frozen clock, so it uses the default dial bound, binds an ephemeral port instead of reusing the silent socket's, and bounds every await byTIMEOUT.Impact
None: test-only.
Alternatives
server.accept()with the clock frozen.Validation
session_state_names_a_failing_first_dialpassed 400/400 andsession_state_reports_an_accepted_sessionpassed 400/400. Each runs in about 0.02 s.server.accept()bound, the same await the old test hung on with no bound.Gatejobs and 40 failed queue runs.just checkpassed.quest review --harness codex(gpt-6.1-sol, high) found 0 findings.Caused by
accept(found by check).Follow-ups
None.
Models
Size: S
Implementer: Claude Code, claude-opus-5-5, unknown effort
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Head: fe9310c
Base: origin/main at 1cdc73b
Risk: low,
The only file changed is the test module `rs/moq-ffi/src/test.rs`, so nothing users, customers, or other repositories rely on can break, and a revert fully undoes it; the risk file lists tests as low.Classified: low by Claude Code, claude-haiku-5-5, low effort, session
239157c3-53b7-407c-9d24-b11b499b0b1bReviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a2047e-dd8e-74b0-84a2-77b98e26513d, round 1Score: 9/10,
Source review found no actionable defects in the deterministic test-only change, with tests intentionally not run.Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none