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:
@@ -21,6 +21,7 @@ func _run() -> void:
|
||||
_test_interruption_and_recovery()
|
||||
_test_determinism()
|
||||
_test_snapshot_round_trip_is_atomic()
|
||||
_test_deferred_queue_clock_contract()
|
||||
if _failures == 0:
|
||||
print("PASS: %d checks" % _checks)
|
||||
else:
|
||||
@@ -311,3 +312,19 @@ func _expect(condition: bool, label: String) -> void:
|
||||
return
|
||||
_failures += 1
|
||||
push_error(" ✗ %s" % label)
|
||||
|
||||
|
||||
func _test_deferred_queue_clock_contract() -> void:
|
||||
var service := FacilityService.new()
|
||||
var facility := FacilityInstance.new().configure(&"clock_contract", &"test_facility", {&"capacity": 1, &"queue_capacity": 8, &"staff_min": 0, &"staff_max": 2, &"base_service_minutes": 2, &"base_quality": 75, &"base_price": 100})
|
||||
_expect(service.register_instance(facility).is_success(), "standalone fixture registers")
|
||||
var request := service.create_request(&"default", facility.instance_id, [&"guest"], &"meal", 100)
|
||||
_expect(service.enqueue_request(request, 100).is_success() and service.current_minute == 100 and request.enqueued_at == 100, "existing default API advances committed minute")
|
||||
for minute: int in [-1, 99, 100, 102]:
|
||||
var before := var_to_bytes(service.create_snapshot())
|
||||
var invalid := service.create_request(StringName("invalid_%d" % minute), facility.instance_id, [&"guest"], &"meal", maxi(0, minute))
|
||||
_expect(not service.enqueue_request(invalid, minute, false).is_success() and before == var_to_bytes(service.create_snapshot()), "deferred invalid minute %d is rejected without state mutation" % minute)
|
||||
var deferred := service.create_request(&"deferred", facility.instance_id, [&"guest"], &"meal", 101)
|
||||
_expect(service.enqueue_request(deferred, 101, false).is_success() and service.current_minute == 100 and deferred.created_at == 101 and deferred.enqueued_at == 101, "deferred registration preserves effective time without advancing committed time")
|
||||
var before_duplicate := var_to_bytes(service.create_snapshot())
|
||||
_expect(not service.enqueue_request(deferred, 101, false).is_success() and before_duplicate == var_to_bytes(service.create_snapshot()), "duplicate deferred registration is rejected atomically")
|
||||
|
||||
Reference in New Issue
Block a user