Save The Tree implementation and acceptance work in progress
Preserve production code, regression fixtures, audio assets and provenance, test infrastructure, and the original-completion plan and progress ledger. Final game and Windows acceptance remain pending; excluded local artifacts and native experiments are not part of this snapshot.
This commit is contained in:
@@ -28,6 +28,7 @@ func _run() -> void:
|
||||
_test_service_need_effect_schema()
|
||||
_test_path_failure_safe_recovery()
|
||||
_test_exit_persistence_boundary()
|
||||
_test_overdue_departure_snapshot()
|
||||
_test_snapshot_round_trip_and_atomic_rejection()
|
||||
_test_v1_need_migration_and_schema_rejection()
|
||||
_test_deterministic_decision_snapshot()
|
||||
@@ -583,6 +584,32 @@ func _test_exit_persistence_boundary() -> void:
|
||||
_expect(not record.has(&"wallet_gold") and not record.has(&"needs") and not record.has(&"satisfaction_total"), "ordinary transient guest state does not survive despawn")
|
||||
|
||||
|
||||
|
||||
func _test_overdue_departure_snapshot() -> void:
|
||||
for replan: bool in [false, true]:
|
||||
var service := _service_with_definitions()
|
||||
var guest := service.spawn_guest(&"overdue_deadline", &"adventurer", 0, {
|
||||
&"state": GuestRuntimeType.State.DECIDING, &"planned_exit_at": 4,
|
||||
})
|
||||
_expect(guest != null, "overdue deadline fixture spawns through public GuestService")
|
||||
if guest == null: continue
|
||||
if replan:
|
||||
_expect(bool(service.enter_queue(guest.guest_id, &"meal_room", &"overdue_request", 4, 1).get(&"ok", false)), "public queue entry before final patience")
|
||||
_expect(bool(service.tick_queue_patience(guest.guest_id, 5, 0, func(_guest: StringName, _facility: StringName, _request: StringName): return true).get(&"ok", false)), "ordinary patience exhaustion after original deadline")
|
||||
_expect(bool(service.transition_guest(guest.guest_id, GuestRuntimeType.State.DECIDING, 5, &"REPLAN_AFTER_INTERRUPTION").get(&"ok", false)), "public overdue replan retains deadline")
|
||||
else:
|
||||
_expect(bool(service.begin_leaving(guest.guest_id, 5, &"PLANNED_EXIT").get(&"ok", false)), "public leaving can occur after original deadline")
|
||||
_expect(guest.planned_exit_at == 4 and guest.state_entered_at == 5 and guest.is_valid(), "deadline preserved independently of actual later state timestamp")
|
||||
var snapshot := service.create_snapshot()
|
||||
var restored := GuestServiceType.new()
|
||||
_expect(restored.restore_snapshot(snapshot), "overdue ordinary state accepts complete restore")
|
||||
_expect(var_to_bytes(restored.create_snapshot()) == var_to_bytes(snapshot), "overdue entire typed state roundtrip preserves original deadline")
|
||||
for field: StringName in [&"planned_exit_at", &"state_entered_at"]:
|
||||
var corrupt := snapshot.duplicate(true)
|
||||
corrupt[&"guests"][0][field] = -1
|
||||
_expect(not restored.restore_snapshot(corrupt), "negative departure/state timestamp remains rejected " + String(field))
|
||||
_expect(var_to_bytes(restored.create_snapshot()) == var_to_bytes(snapshot), "negative timestamp rejection remains atomic " + String(field))
|
||||
|
||||
func _test_snapshot_round_trip_and_atomic_rejection() -> void:
|
||||
var original := _service_with_definitions()
|
||||
var moving := _moving_guest(original, &"guest_saved_moving")
|
||||
|
||||
Reference in New Issue
Block a user