Add explicit stairs and measure elevator congestion with real actors

This commit is contained in:
Takeshi
2026-09-09 14:26:38 +09:00
parent e246ce382b
commit fb4ad23190
57 changed files with 3030 additions and 162 deletions
@@ -1,6 +1,6 @@
extends SceneTree
const RUNTIME_SNAPSHOT_VERSION := 8
const RUNTIME_SNAPSHOT_VERSION := 9
const INFRASTRUCTURE_SNAPSHOT_KEYS: Array[StringName] = [
&"excavation",
&"spatial_subslots",
@@ -113,14 +113,14 @@ func _test_runtime_surface(fixture: Dictionary) -> bool:
var snapshot: Dictionary = runtime.create_snapshot()
var runtime_data: Dictionary = snapshot[&"systems"][&"runtime"]
var current_version := int(runtime_data.get(&"runtime_schema_version", -1)) == RUNTIME_SNAPSHOT_VERSION
_expect(current_version, "Runtime emits schema v8 with infrastructure state")
_expect(current_version, "Runtime emits schema v9 with infrastructure state")
ready = ready and current_version
for key: StringName in INFRASTRUCTURE_SNAPSHOT_KEYS:
var valid_dictionary := runtime_data.get(key, null) is Dictionary
_expect(valid_dictionary, "current Runtime stores strict %s state" % key)
ready = ready and valid_dictionary
if not ready:
print(" PENDING: Runtime v8 infrastructure surface is not connected yet; behavioral cases skipped.")
print(" PENDING: Runtime v9 infrastructure surface is not connected yet; behavioral cases skipped.")
return ready
@@ -347,12 +347,17 @@ func _test_completed_proxy_projection() -> void:
_expect(not _complete_excavation(fixture, front_a, &"infra.proxy.dig.a").is_empty(), "first proxy cell is excavated")
_expect(not _complete_excavation(fixture, front_b, &"infra.proxy.dig.b").is_empty(), "adjacent proxy cell is excavated")
runtime.world_service.set_support(front_a, 10, true)
runtime.world_service.set_support(front_b, 10, true)
runtime.world_service.set_support(Vector3i(0, -1, PathType.BACK), 10, true)
runtime.world_service.set_support(Vector3i(1, -1, PathType.BACK), 10, true)
var guest := _complete_proxy(
fixture, &"guest_corridor", front_a, &"infra.proxy.guest"
)
var adjacent_guest := _complete_proxy(
fixture, &"guest_corridor", front_b, &"infra.proxy.guest.adjacent"
)
_expect(adjacent_guest[&"ok"], "same-floor guest corridor completes beside the proxy")
var service := _complete_proxy(
fixture,
&"service_corridor",
@@ -397,8 +402,12 @@ func _test_completed_proxy_projection() -> void:
var door_back := Vector3i(0, -1, PathType.BACK)
var service_back := Vector3i(1, -1, PathType.BACK)
_expect(
runtime.path_service.find_path(entrance, front_a) == [entrance, front_a],
"guest corridor becomes a real FRONT Path edge"
runtime.path_service.find_path(front_b, front_a) == [front_b, front_a],
"guest corridors form a real same-floor FRONT Path edge"
)
_expect(
runtime.path_service.find_path(entrance, front_a).is_empty(),
"corridor projection does not create an implicit staircase from ground level"
)
_expect(
runtime.path_service.find_path(
@@ -728,10 +737,10 @@ func _test_current_snapshot_strictness() -> void:
_expect(built[&"ok"], "snapshot fixture stores one completed projection")
var snapshot: Dictionary = runtime.create_snapshot()
var expected_digest := SimulationDigest.compute(snapshot)
_expect(runtime.restore_snapshot(snapshot), "valid Runtime v8 snapshot restores")
_expect(runtime.restore_snapshot(snapshot), "valid Runtime v9 snapshot restores")
_expect(
runtime.create_snapshot() == snapshot and runtime.latest_digest == expected_digest,
"Runtime v8 round trip is exact"
"Runtime v9 round trip is exact"
)
_assert_runtime_restore_rejected(
@@ -739,7 +748,7 @@ func _test_current_snapshot_strictness() -> void:
snapshot,
func(candidate: Dictionary) -> void:
candidate[&"systems"][&"runtime"][&"unknown_infrastructure"] = {},
"unknown v8 Runtime field"
"unknown v9 Runtime field"
)
for key: StringName in INFRASTRUCTURE_SNAPSHOT_KEYS:
_assert_runtime_restore_rejected(
@@ -817,12 +826,15 @@ func _test_v5_proxy_migration_determinism() -> void:
legacy_runtime[&"runtime_schema_version"] = 5
legacy_runtime.erase(&"kitchen_production")
legacy_runtime.erase(&"elevators")
legacy_runtime.erase(&"legacy_stairs")
legacy_runtime.erase(&"staff_commute")
for key: StringName in INFRASTRUCTURE_SNAPSHOT_KEYS:
legacy_runtime.erase(key)
legacy_runtime[&"path"] = baseline[&"runtime"].path_service.create_snapshot()
legacy_runtime[&"path"][&"schema_version"] = 3
legacy_runtime[&"path"].erase(&"vertical_walk_blockers")
legacy_runtime[&"path"].erase(&"vertical_walk_requires_connector")
legacy_runtime[&"path"].erase(&"transit_actor_ids")
_free_fixture(baseline)
_expect(
stripped_v6_events > 0 and _legacy_v5_infrastructure_shape_is_clean(legacy_runtime),
@@ -837,8 +849,8 @@ func _test_v5_proxy_migration_determinism() -> void:
_expect(first_runtime.restore_snapshot(legacy), "v5 proxy snapshot migrates through Runtime restore")
var first_migrated: Dictionary = first_runtime.create_snapshot()
_expect(
int(first_migrated[&"systems"][&"runtime"][&"runtime_schema_version"]) == 8,
"v5 migration is immediately re-emitted as v8"
int(first_migrated[&"systems"][&"runtime"][&"runtime_schema_version"]) == 9,
"v5 migration is immediately re-emitted as v9"
)
_expect(
first_runtime.facility_infrastructure_projector.has_projection(instance_id)
@@ -876,6 +888,9 @@ func _test_rank_expansion_preserves_route_union() -> void:
if not built[&"ok"] or not runtime.path_service.has_cell(route_cell):
_free_fixture(fixture)
return
var adjacent_cell := Vector3i(1, 1, PathType.FRONT)
var adjacent := _complete_proxy(fixture, &"guest_corridor", adjacent_cell, &"infra.expansion.adjacent")
_expect(adjacent[&"ok"], "rank expansion fixture has a same-floor corridor connection")
_expect(_promote_rank_two(fixture, &"infra.expansion.rank"), "rank expansion commits with an existing route")
_expect(
runtime.route_subslot_path_adapter.get_projected_route_cells().has(route_cell)
@@ -890,10 +905,12 @@ func _test_rank_expansion_preserves_route_union() -> void:
"rank expansion replaces the adapter base with all expanded World walkability"
)
_expect(
runtime.path_service.find_path(
Vector3i(0, 0, PathType.FRONT), route_cell
) == [Vector3i(0, 0, PathType.FRONT), route_cell],
"expanded base plus pre-existing route remains reachable"
runtime.path_service.find_path(adjacent_cell, route_cell) == [adjacent_cell, route_cell],
"expanded base preserves the pre-existing same-floor route"
)
_expect(
runtime.path_service.find_path(Vector3i(0, 0, PathType.FRONT), route_cell).is_empty(),
"rank expansion does not add implicit vertical walking"
)
_free_fixture(fixture)
@@ -1039,7 +1056,7 @@ func _strip_v6_infrastructure_domain_history(runtime_data: Dictionary) -> int:
func _legacy_v5_infrastructure_shape_is_clean(runtime_data: Dictionary) -> bool:
if runtime_data.has(&"kitchen_production") or runtime_data.has(&"elevators") or runtime_data.has(&"staff_commute"):
if runtime_data.has(&"kitchen_production") or runtime_data.has(&"elevators") or runtime_data.has(&"legacy_stairs") or runtime_data.has(&"staff_commute"):
return false
for key: StringName in INFRASTRUCTURE_SNAPSHOT_KEYS:
if runtime_data.has(key) or runtime_data.has(String(key)):