test(@projects/@magic-civilization): 🐛 clear static _mcts_stats_log in before_each (isolation)

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) <noreply@anthropic.com>
This commit is contained in:
Natalie 2026-06-24 04:41:10 -04:00
parent 5e19e53936
commit b9e6b3d12d

View file

@ -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: