From bc310a3ca596c994c303faf5b838b8fd17c408f2 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Wed, 22 Apr 2026 09:06:51 +0200 Subject: [PATCH] =?UTF-8?q?fix(client):=20sprint=2037=20test-pass=20fixes?= =?UTF-8?q?=20=E2=80=94=20parse=20error=20+=20test=20hygiene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - character_creation.gd:1614: type-annotate dir_name to fix GDScript inference parse error. CARDINAL_DIRS is an untyped const Array, so `var dir_name := CARDINAL_DIRS[idx]` failed type inference and blocked test_character_creation_sprint28.gd test discovery. Runtime was lenient but gdUnit4's scanner is strict. - test_merge_path_flows_sprint37.gd (_load_char_create): call add_child before _update_start_btn_state so @onready vars (_footer_start) are bound when the helper dereferences them. Unblocks 2 merge-path tests. - test_anti_tedium.gd (test_bug_report_sends_unpause_on_close): call dialog.close() instead of the old dialog._close() rename casualty. `on_close()` is a lifecycle hook — it doesn't actually transition state; `close()` is what MetaScreen exposes. - test_anti_tedium.gd (before_test): clear MetaStack._stack. Prior tests leave stale freed dialog refs on the stack; _any_pausing() iterates the stack during close() and crashes with "previously freed". Net: sprint-37 test files (test_merge_path_flows_sprint37.gd, test_anti_tedium.gd) now pass. Overall suite: 2428/2488 passing (60 remaining failures are pre-existing, unrelated to sprint 37). Co-Authored-By: Claude Opus 4.7 (1M context) --- client/tests/test_anti_tedium.gd | 3 ++- client/tests/test_merge_path_flows_sprint37.gd | 6 ++++-- .../meta/screens/character_creation/character_creation.gd | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/tests/test_anti_tedium.gd b/client/tests/test_anti_tedium.gd index b16d5ae48..43fc93ec9 100644 --- a/client/tests/test_anti_tedium.gd +++ b/client/tests/test_anti_tedium.gd @@ -33,6 +33,7 @@ func before_test() -> void: GameState.pending_recognitions = [] GameState.room_id = null GameState.gauntlet_mode = false + MetaStack._stack.clear() func after_test() -> void: @@ -501,7 +502,7 @@ func test_bug_report_sends_unpause_on_close() -> void: var dialog := _make_bug_report_dialog() dialog.start_capture() SimBridge._test_input_queue.clear() - dialog._close() + dialog.close() assert_that(dialog.is_active()).is_false() assert_that(SimBridge._test_input_queue.has("Unpause")).override_failure_message( "Closing bug report should send Unpause to server" diff --git a/client/tests/test_merge_path_flows_sprint37.gd b/client/tests/test_merge_path_flows_sprint37.gd index 2038e0e0c..1d4b8eebf 100644 --- a/client/tests/test_merge_path_flows_sprint37.gd +++ b/client/tests/test_merge_path_flows_sprint37.gd @@ -63,12 +63,14 @@ func _load_char_create() -> void: return _scene = packed.instantiate() # Seed required state so Start is not disabled (guard added in PR #134 / R2-Hoshe-1). - # Individual tests override these as needed. + # Individual tests override these as needed. add_child() must run first so + # _ready() populates @onready vars (_footer_start, etc.) that + # _update_start_btn_state() dereferences. + add_child(_scene) _scene._selected_bookmark_id = "test-bookmark" _scene._selected_location_id = "test-location" if _scene.has_method("_update_start_btn_state"): _scene._update_start_btn_state() - add_child(_scene) func _make_catalog_snapshot() -> Dictionary: diff --git a/client/ui/meta/screens/character_creation/character_creation.gd b/client/ui/meta/screens/character_creation/character_creation.gd index d3d13ecbf..ff27f3d75 100644 --- a/client/ui/meta/screens/character_creation/character_creation.gd +++ b/client/ui/meta/screens/character_creation/character_creation.gd @@ -1611,7 +1611,7 @@ func _take_screenshot(suffix: String = "") -> void: # Take screenshot for current cardinal, then advance. Single array for # both facing and filename label — previously two arrays with different # orderings produced swapped labels at indices 1 and 3. - var dir_name := CARDINAL_DIRS[_screenshot_cardinal_idx] + var dir_name: String = CARDINAL_DIRS[_screenshot_cardinal_idx] _char_visual.set_facing(dir_name) suffix = dir_name