From 3ebf7bf42fdc9b99abfb22de0cd61425d06d1ea9 Mon Sep 17 00:00:00 2001 From: Natalie Date: Wed, 24 Jun 2026 03:58:30 -0400 Subject: [PATCH] =?UTF-8?q?test(@projects/@magic-civilization):=20?= =?UTF-8?q?=F0=9F=90=9B=20load=20runtime=20units=20catalog=20before=20add?= =?UTF-8?q?=5Fplayer=5Fmilitarist=20(turn=5Fprocessor)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add_player_militarist has a p2-71c guard that returns -1 (refuses to spawn) unless set_units_runtime_catalog_json() is called first — otherwise MapUnit base_moves=0 and the sim freezes at turn 0. The test never loaded the catalog, so 0 players spawned → all downstream assertions (cities/units/wealth/fauna) read 0. _make_state now harvests the same catalog the real bridge does (AiTurnBridge._harvest_runtime_units_json). GUT: test_gd_turn_processor 14 → 2 failing; suite 33 → 32. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/game/engine/tests/integration/test_gd_turn_processor.gd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/game/engine/tests/integration/test_gd_turn_processor.gd b/src/game/engine/tests/integration/test_gd_turn_processor.gd index 691138bc..de05d6b5 100644 --- a/src/game/engine/tests/integration/test_gd_turn_processor.gd +++ b/src/game/engine/tests/integration/test_gd_turn_processor.gd @@ -175,6 +175,12 @@ func _make_state() -> RefCounted: var state: RefCounted = ClassDB.instantiate("GdGameState") as RefCounted assert_not_null(state, "GdGameState must be registered") state.call("create_grid", MAP_SIZE, MAP_SIZE) + # p2-71c — add_player_militarist refuses to spawn (returns -1) unless the + # runtime units catalog is loaded first (otherwise MapUnit base_moves=0 and + # the AI freezes past turn 0). Harvest the same catalog the real bridge does. + var units_json: String = AiTurnBridge._harvest_runtime_units_json() + assert_false(units_json.is_empty(), "runtime units catalog must harvest from resources/units") + state.call("set_units_runtime_catalog_json", units_json) return state