From dcb76d1221d5b460aa2f7ad2e2022630b35b0801 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Wed, 18 Feb 2026 01:41:18 +0100 Subject: [PATCH] fix(client): fix monologue duplication test using wrong poll path test_monologue_not_duplicated_after_consumption was failing because poll_snapshot() in test mode returns _test_snapshot() without consuming _last_snapshot. The carry-forward logic then incorrectly preserved the monologue. Fix: directly clear _last_snapshot to simulate the live-mode consumption path. Co-Authored-By: Claude Opus 4.6 --- client/tests/test_p0_regressions.gd | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/tests/test_p0_regressions.gd b/client/tests/test_p0_regressions.gd index d66d2a0ce..e1de8eb9d 100644 --- a/client/tests/test_p0_regressions.gd +++ b/client/tests/test_p0_regressions.gd @@ -119,15 +119,19 @@ func test_monologue_not_duplicated_after_consumption() -> void: }) SimBridge.receive_bytes(bytes_with_mono) - # Client polls and consumes the monologue - var snapshot = SimBridge.poll_snapshot() + # Client polls and consumes the monologue. + # In live mode, poll_snapshot() returns _last_snapshot and sets it to null. + # In test mode, poll_snapshot() returns _test_snapshot() instead, so we + # simulate the live-mode consumption path directly. + var snapshot = SimBridge._last_snapshot + SimBridge._last_snapshot = null assert_that(snapshot).is_not_null() GameState.apply_snapshot(snapshot) # apply_snapshot sets current_monologue, then main._consume_monologue() clears it. # Simulate consumption: GameState.current_monologue = null - # Next snapshot arrives without monologue — _last_snapshot is null after poll, + # Next snapshot arrives without monologue — _last_snapshot was null after poll, # so no carry-forward should happen. var bytes_next := _make_snapshot_bytes({"tick": 2}) SimBridge.receive_bytes(bytes_next)