fix(client): sprint 37 test-pass fixes — parse error + test hygiene

- 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) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 09:06:51 +02:00
co-authored by Claude Opus 4.7
parent d72fcc7847
commit bc310a3ca5
3 changed files with 7 additions and 4 deletions
+2 -1
View File
@@ -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"
@@ -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:
@@ -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