From b9e6b3d12d39cb34ee168e3cc336b76a353f8d64 Mon Sep 17 00:00:00 2001 From: Natalie Date: Wed, 24 Jun 2026 04:41:10 -0400 Subject: [PATCH] =?UTF-8?q?test(@projects/@magic-civilization):=20?= =?UTF-8?q?=F0=9F=90=9B=20clear=20static=20=5Fmcts=5Fstats=5Flog=20in=20be?= =?UTF-8?q?fore=5Feach=20(isolation)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AiTurnBridge._mcts_stats_log is a static dict that persists across tests, and get_last_mcts_stats does a most-recent-at-or-before-turn lookup — so a prior test's player-0 entry ("rust_run_ai_turn") masked the expected heuristic sentinel for the empty-cities player. Clear the static store in before_each for deterministic isolation. Clears test_ai_turn_bridge_stats. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/game/engine/tests/unit/ai/test_ai_turn_bridge_stats.gd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/game/engine/tests/unit/ai/test_ai_turn_bridge_stats.gd b/src/game/engine/tests/unit/ai/test_ai_turn_bridge_stats.gd index be4e88ee..4d5fa95c 100644 --- a/src/game/engine/tests/unit/ai/test_ai_turn_bridge_stats.gd +++ b/src/game/engine/tests/unit/ai/test_ai_turn_bridge_stats.gd @@ -26,6 +26,10 @@ func before_each() -> void: GameState.players = [] GameState.layers = [{"units": []}] GameState.turn_number = 50 + # _mcts_stats_log is static and leaks across tests; get_last_mcts_stats does a + # most-recent-at-or-before-turn lookup, so a prior test's player-0 entry would + # mask the heuristic sentinel. Clear it for deterministic isolation. + BridgeScript._mcts_stats_log.clear() func after_each() -> void: