Connect paid food purchasing, kitchen production, and porter deliveries

This commit is contained in:
Takeshi
2026-09-09 09:46:33 +09:00
parent 29a660aed0
commit 627b200f00
42 changed files with 3787 additions and 84 deletions
+23 -22
View File
@@ -1,7 +1,7 @@
extends SceneTree
const FOURTEEN_DAYS_MINUTES := 14 * SimulationKernel.MINUTES_PER_DAY
const RUNTIME_SNAPSHOT_VERSION := 6
const RUNTIME_SNAPSHOT_VERSION := 7
var _checks := 0
var _failures := 0
@@ -15,7 +15,7 @@ func _run() -> void:
print("MVP: production Operations acceptance")
_test_waiting_choice_and_command_exactly_once()
_test_twenty_four_hour_actual_tick_smoke()
_test_full_partial_payroll_bankruptcy_and_v6_tamper()
_test_full_partial_payroll_bankruptcy_and_v7_tamper()
_test_fourteen_day_boundary_snapshot_determinism()
await process_frame
if _failures == 0:
@@ -39,7 +39,7 @@ func _new_fixture(seed: int, enable_operations := true) -> Dictionary:
int(initial_snapshot[&"systems"][&"runtime"].get(
&"runtime_schema_version", -1
)) == RUNTIME_SNAPSHOT_VERSION,
"fixture emits Runtime snapshot schema v6"
"fixture emits Runtime snapshot schema v7"
)
if enable_operations:
var enabled: Dictionary = runtime.enable_production_operations()
@@ -100,6 +100,7 @@ func _advance_operations_boundary_slice(fixture: Dictionary, amount: int) -> int
func _align_operations_fixture_clocks(runtime: Variant, minute: int) -> void:
runtime.inventory_service.current_minute = minute
runtime.facility_service.current_minute = minute
runtime.kitchen_production.current_minute = minute
runtime.guest_service.current_minute = minute
runtime.staff_service.current_minute = minute
runtime.authority_service.current_minute = minute
@@ -207,7 +208,7 @@ func _test_waiting_choice_and_command_exactly_once() -> void:
var command_snapshot: Dictionary = runtime.create_snapshot()
_expect(
runtime.restore_snapshot(command_snapshot),
"command history survives an exact v6 snapshot round trip"
"command history survives an exact v7 snapshot round trip"
)
var restored_retry: CommandResult = runtime.submit_command(
&"change_resources",
@@ -247,12 +248,12 @@ func _test_twenty_four_hour_actual_tick_smoke() -> void:
_expect(
runtime.restore_snapshot(snapshot)
and runtime.latest_digest == SimulationDigest.compute(snapshot),
"24-hour actual-tick v6 snapshot round trip is exact"
"24-hour actual-tick v7 snapshot round trip is exact"
)
_free_fixture(fixture)
func _test_full_partial_payroll_bankruptcy_and_v6_tamper() -> void:
func _test_full_partial_payroll_bankruptcy_and_v7_tamper() -> void:
var fixture := _new_fixture(73_002, false)
var runtime: Variant = fixture[&"runtime"]
var clock: Variant = fixture[&"clock"]
@@ -339,7 +340,7 @@ func _test_full_partial_payroll_bankruptcy_and_v6_tamper() -> void:
var terminal_digest := SimulationDigest.compute(terminal_snapshot)
_expect(
runtime.restore_snapshot(terminal_snapshot),
"BANKRUPT terminal v6 snapshot restores without clearing terminal state"
"BANKRUPT terminal v7 snapshot restores without clearing terminal state"
)
clock.advance_minutes(180)
_expect(
@@ -352,32 +353,32 @@ func _test_full_partial_payroll_bankruptcy_and_v6_tamper() -> void:
"BANKRUPT cannot be acknowledged away"
)
_assert_v6_tamper_rejected(
_assert_v7_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
tampered[&"systems"][&"runtime"][&"operations"][&"personal_action_points"] = 99,
"v6 rejects an out-of-range Operations action-point total"
"v7 rejects an out-of-range Operations action-point total"
)
_assert_v6_tamper_rejected(
_assert_v7_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
tampered[&"systems"][&"runtime"][&"next_command_id"] = int(
tampered[&"systems"][&"runtime"][&"next_command_id"]
) + 1,
"v6 rejects command high-water gaps"
"v7 rejects command high-water gaps"
)
_assert_v6_tamper_rejected(
_assert_v7_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
var accepted: Array = tampered[&"systems"][&"runtime"][&"command_queue"][&"accepted"]
if not accepted.is_empty():
accepted[0][&"idempotency_key"] = &"tampered.accepted.key",
"v6 rejects accepted-command/idempotency cross-link tampering"
"v7 rejects accepted-command/idempotency cross-link tampering"
)
_assert_v6_tamper_rejected(
_assert_v7_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
@@ -385,26 +386,26 @@ func _test_full_partial_payroll_bankruptcy_and_v6_tamper() -> void:
summaries[0][&"category_totals"][&"wages"] = int(
summaries[0][&"category_totals"][&"wages"]
) + 1,
"v6 rejects DaySummary/payroll wage reconciliation tampering"
"v7 rejects DaySummary/payroll wage reconciliation tampering"
)
_assert_v6_tamper_rejected(
_assert_v7_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
tampered[&"systems"][&"runtime"][&"unexpected_v6_field"] = true,
"v6 rejects unknown Runtime fields"
tampered[&"systems"][&"runtime"][&"unexpected_v7_field"] = true,
"v7 rejects unknown Runtime fields"
)
_assert_v6_tamper_rejected(
_assert_v7_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
tampered[&"systems"][&"runtime"][&"operations"][&"coordinator"][&"unexpected_field"] = true,
"v6 rejects unknown Coordinator fields"
"v7 rejects unknown Coordinator fields"
)
_free_fixture(fixture)
func _assert_v6_tamper_rejected(
func _assert_v7_tamper_rejected(
runtime: Variant,
canonical: Dictionary,
mutator: Callable,
@@ -453,7 +454,7 @@ func _test_fourteen_day_boundary_snapshot_determinism() -> void:
var resumed_clock: Variant = resumed[&"clock"]
var resumed_runtime: Variant = resumed[&"runtime"]
var restored: bool = resumed_runtime.restore_snapshot(midpoint)
_expect(restored, "fresh Runtime restores the enabled v6 midpoint snapshot")
_expect(restored, "fresh Runtime restores the enabled v7 midpoint snapshot")
var resumed_advanced := 0
if restored:
resumed_advanced = _advance_operations_boundary_slice(