From 8d1121d13a8435c8519b3d3a6652fdd3ae182cd9 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Thu, 16 Jul 2026 20:47:12 +0200 Subject: [PATCH] test(client): wall-clock deadline + 10s ceiling for input-roundtrip response waits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second distinct flake in this suite today (gate run: MoveEast observed mid-move at the 5s window). The old accounting accrued elapsed only on empty polls — load-dependent effective window. Wall-clock deadline via Time.get_ticks_msec; ceiling 5s->10s (exit-on-arrival, costs nothing when healthy). Targeted suite 6/6. Co-Authored-By: Claude Fable 5 --- client/tests/test_input_roundtrip.gd | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/client/tests/test_input_roundtrip.gd b/client/tests/test_input_roundtrip.gd index 3354a910d..03330097f 100644 --- a/client/tests/test_input_roundtrip.gd +++ b/client/tests/test_input_roundtrip.gd @@ -8,7 +8,10 @@ class_name TestInputRoundtrip extends GdUnitTestSuite const CONNECT_TIMEOUT: float = 3.0 -const RESPONSE_TIMEOUT: float = 5.0 +# Ceiling, not a sleep — the wait loop exits the moment the expected state +# arrives. 5.0s flaked under load (gate run 2026-07-16: MoveEast observed +# mid-move at timeout); 10.0s costs nothing when healthy. +const RESPONSE_TIMEOUT: float = 10.0 const MAX_PORT_ATTEMPTS: int = 5 var _server_pid: int = -1 @@ -162,11 +165,14 @@ func _send_and_receive( var send_err := _bridge.send_message(encoded) assert_that(send_err).is_equal(OK) - # Wait for a snapshot that reflects the processed input. + # Wait for a snapshot that reflects the processed input. Wall-clock + # deadline: the old sleep-count accounting only accrued on EMPTY polls, + # so a streaming server made the effective window unbounded in theory and + # load-dependent in practice — measure real time instead. var min_tick: int = last_tick + 2 var snapshot: Variant = null - var elapsed := 0.0 - while elapsed < RESPONSE_TIMEOUT: + var deadline_ms: int = Time.get_ticks_msec() + int(RESPONSE_TIMEOUT * 1000.0) + while Time.get_ticks_msec() < deadline_ms: _bridge.poll() var msg := _bridge.poll_message() if msg.size() > 0: @@ -187,7 +193,6 @@ func _send_and_receive( break continue await get_tree().create_timer(0.05).timeout - elapsed += 0.05 assert_that(snapshot).override_failure_message( "no snapshot received within %.1fs after '%s'" % [RESPONSE_TIMEOUT, action_name]