fix(@projects/@magic-civilization): 🐛 add result tracking flag for silent crash detection

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-04-16 18:36:35 -07:00
parent 9195de71a8
commit 83cf533834
2 changed files with 9 additions and 5 deletions

View file

@ -69,6 +69,11 @@ var _turn_first_city_captured: int = -1
var _event_buffer: Array[Dictionary] = []
# Guards against writing terminal outcome line twice (e.g. victory during max_turns path)
var _final_line_written: bool = false
# True once at least one turn_stats line has been appended. Used by the E2E
# gate to distinguish "game ran and wrote stats" from "game crashed silently
# before producing any output" — a silent crash would leave turn_stats.jsonl
# missing or empty, which the batch wrapper now rejects with a nonzero exit.
var _result_written: bool = false
func _ready() -> void:

View file

@ -590,16 +590,15 @@ static func _decide_production(
# and is >20 turns old, pause military top-up to slot walls in. Walls
# were being starved indefinitely by the mil-floor above; a T40-50
# wall hardens the capital before the opponent's full army arrives.
var capital_age: int = (
GameState.turn_number - int(city.turn_founded)
)
var capital_needs_walls: bool = (
# Named distinctly from the outer `capital_needs_walls` because this
# branch applies a looser mil≥1 threshold for the interject.
var mil_floor_walls_interject: bool = (
city_count == 1 and city_index == 0
and military_count >= 1 and capital_age > 20
and not city.has_building("walls")
and city.can_build("walls", player)
)
if not capital_needs_walls:
if not mil_floor_walls_interject:
var emergency_unit: String = _pick_buildable_military_unit_id(
city, player
)