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
@@ -379,6 +379,7 @@ func _test_v3_migration_and_v4_tamper_guards() -> void:
var v3: Dictionary = _runtime.create_snapshot()
var v3_runtime: Dictionary = v3[&"systems"][&"runtime"]
v3_runtime[&"runtime_schema_version"] = 3
v3_runtime.erase(&"kitchen_production")
v3_runtime.erase(&"operations")
v3_runtime.erase(&"catalog_manifest")
v3_runtime.erase(&"progression")
@@ -395,10 +396,10 @@ func _test_v3_migration_and_v4_tamper_guards() -> void:
_expect(int(_runtime.progression_service.metrics[&"guest_lifetime"]) == 2, "v3 migration derives lifetime Guests from active plus persistent records")
_expect(_runtime.get_mvp_guest_definition_ids().size() == 32, "v3 migration registers the current 32 catalog definitions")
var migrated: Dictionary = _runtime.create_snapshot()
_expect(int(migrated[&"systems"][&"runtime"][&"runtime_schema_version"]) == 6, "v3 migration emits canonical Runtime schema v6")
_expect(int(migrated[&"systems"][&"runtime"][&"runtime_schema_version"]) == 7, "v3 migration emits canonical Runtime schema v7")
var digest := SimulationDigest.compute(migrated)
_expect(_runtime.restore_snapshot(migrated), "canonical v5 snapshot restores")
_expect(SimulationDigest.compute(_runtime.create_snapshot()) == digest, "canonical v5 restore is exact")
_expect(_runtime.restore_snapshot(migrated), "canonical v7 snapshot restores")
_expect(SimulationDigest.compute(_runtime.create_snapshot()) == digest, "canonical v7 restore is exact")
var progressed_legacy: Dictionary = v3.duplicate(true)
progressed_legacy[&"game_state"][&"world_tree_rank"] = 2
+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(
@@ -57,7 +57,7 @@ func _test_disabled_compatibility_and_enable() -> void:
_expect(not disabled[&"enabled"], "Operations remain disabled for existing Runtime tests")
var disabled_snapshot: Dictionary = _runtime.create_snapshot()
var disabled_runtime: Dictionary = disabled_snapshot[&"systems"][&"runtime"]
_expect(int(disabled_runtime[&"runtime_schema_version"]) == 6, "Runtime snapshot advances to schema v6")
_expect(int(disabled_runtime[&"runtime_schema_version"]) == 7, "Runtime snapshot advances to schema v7")
_expect(
disabled_runtime[&"operations"] == {
&"wrapper_version": 1,
@@ -360,6 +360,7 @@ func _test_daily_payroll_financials_and_crosslink_tamper() -> void:
)
var downgraded: Dictionary = canonical.duplicate(true)
downgraded[&"systems"][&"runtime"][&"runtime_schema_version"] = 4
downgraded[&"systems"][&"runtime"].erase(&"kitchen_production")
_expect(
_rejects_atomically(downgraded),
"relabelled enabled v5 cannot discard Operations history through v4 migration"