Connect physical elevators and staff commutes to construction, saves, and cutaway UI

This commit is contained in:
Takeshi
2026-09-09 12:58:40 +09:00
parent 4d72de8973
commit 0f12c748e9
46 changed files with 3267 additions and 165 deletions
+31 -22
View File
@@ -1,7 +1,7 @@
extends SceneTree
const FOURTEEN_DAYS_MINUTES := 14 * SimulationKernel.MINUTES_PER_DAY
const RUNTIME_SNAPSHOT_VERSION := 7
const RUNTIME_SNAPSHOT_VERSION := 8
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_v7_tamper()
_test_full_partial_payroll_bankruptcy_and_v8_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 v7"
"fixture emits Runtime snapshot schema v8"
)
if enable_operations:
var enabled: Dictionary = runtime.enable_production_operations()
@@ -107,6 +107,15 @@ func _align_operations_fixture_clocks(runtime: Variant, minute: int) -> void:
runtime.defense_service.current_minute = minute
runtime.construction_service.current_minute = minute
runtime.excavation_service.current_minute = minute
# This accelerated oracle owns no cars or rides; update its empty transport
# aggregate through the public snapshot validator instead of a private clock.
var transport_snapshot: Dictionary = runtime.elevators.create_snapshot()
if not (transport_snapshot[&"shafts"] as Array).is_empty() or not (transport_snapshot[&"trips"] as Array).is_empty():
_expect(false, "accelerated Operations oracle cannot skip live elevator movement")
return
transport_snapshot[&"current_minute"] = minute
if not runtime.elevators.restore_snapshot(transport_snapshot):
_expect(false, "empty transport clock aligns through validated snapshot restore")
func _operations_slice_is_healthy(fixture: Dictionary) -> bool:
@@ -208,7 +217,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 v7 snapshot round trip"
"command history survives an exact v8 snapshot round trip"
)
var restored_retry: CommandResult = runtime.submit_command(
&"change_resources",
@@ -248,12 +257,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 v7 snapshot round trip is exact"
"24-hour actual-tick v8 snapshot round trip is exact"
)
_free_fixture(fixture)
func _test_full_partial_payroll_bankruptcy_and_v7_tamper() -> void:
func _test_full_partial_payroll_bankruptcy_and_v8_tamper() -> void:
var fixture := _new_fixture(73_002, false)
var runtime: Variant = fixture[&"runtime"]
var clock: Variant = fixture[&"clock"]
@@ -340,7 +349,7 @@ func _test_full_partial_payroll_bankruptcy_and_v7_tamper() -> void:
var terminal_digest := SimulationDigest.compute(terminal_snapshot)
_expect(
runtime.restore_snapshot(terminal_snapshot),
"BANKRUPT terminal v7 snapshot restores without clearing terminal state"
"BANKRUPT terminal v8 snapshot restores without clearing terminal state"
)
clock.advance_minutes(180)
_expect(
@@ -353,32 +362,32 @@ func _test_full_partial_payroll_bankruptcy_and_v7_tamper() -> void:
"BANKRUPT cannot be acknowledged away"
)
_assert_v7_tamper_rejected(
_assert_v8_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
tampered[&"systems"][&"runtime"][&"operations"][&"personal_action_points"] = 99,
"v7 rejects an out-of-range Operations action-point total"
"v8 rejects an out-of-range Operations action-point total"
)
_assert_v7_tamper_rejected(
_assert_v8_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
tampered[&"systems"][&"runtime"][&"next_command_id"] = int(
tampered[&"systems"][&"runtime"][&"next_command_id"]
) + 1,
"v7 rejects command high-water gaps"
"v8 rejects command high-water gaps"
)
_assert_v7_tamper_rejected(
_assert_v8_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",
"v7 rejects accepted-command/idempotency cross-link tampering"
"v8 rejects accepted-command/idempotency cross-link tampering"
)
_assert_v7_tamper_rejected(
_assert_v8_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
@@ -386,26 +395,26 @@ func _test_full_partial_payroll_bankruptcy_and_v7_tamper() -> void:
summaries[0][&"category_totals"][&"wages"] = int(
summaries[0][&"category_totals"][&"wages"]
) + 1,
"v7 rejects DaySummary/payroll wage reconciliation tampering"
"v8 rejects DaySummary/payroll wage reconciliation tampering"
)
_assert_v7_tamper_rejected(
_assert_v8_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
tampered[&"systems"][&"runtime"][&"unexpected_v7_field"] = true,
"v7 rejects unknown Runtime fields"
tampered[&"systems"][&"runtime"][&"unexpected_v8_field"] = true,
"v8 rejects unknown Runtime fields"
)
_assert_v7_tamper_rejected(
_assert_v8_tamper_rejected(
runtime,
terminal_snapshot,
func(tampered: Dictionary) -> void:
tampered[&"systems"][&"runtime"][&"operations"][&"coordinator"][&"unexpected_field"] = true,
"v7 rejects unknown Coordinator fields"
"v8 rejects unknown Coordinator fields"
)
_free_fixture(fixture)
func _assert_v7_tamper_rejected(
func _assert_v8_tamper_rejected(
runtime: Variant,
canonical: Dictionary,
mutator: Callable,
@@ -454,7 +463,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 v7 midpoint snapshot")
_expect(restored, "fresh Runtime restores the enabled v8 midpoint snapshot")
var resumed_advanced := 0
if restored:
resumed_advanced = _advance_operations_boundary_slice(