39 lines
4.4 KiB
GDScript
39 lines
4.4 KiB
GDScript
extends "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-build-preview-monitor-compressed-r06.gd"
|
|
# One sample of an adjacent Guest bulk r313-r02/library314-r02 versus hot-loop r326/library327 pair. Only the synchronous tick is timed.
|
|
func run() -> void:
|
|
output = OS.get_environment("THE_TREE_RUNTIME_MONITOR_OUTPUT")
|
|
var input_path := OS.get_environment("THE_TREE_REPLAY_SNAPSHOT")
|
|
var candidate := OS.get_environment("THE_TREE_PAIRED_CANDIDATE")
|
|
if not output.is_absolute_path() or not input_path.is_absolute_path() or candidate not in ["baseline","candidate"]: quit(98); return
|
|
var original := FileAccess.get_file_as_bytes(input_path).decompress(11411840, FileAccess.COMPRESSION_ZSTD)
|
|
var initial: Dictionary = bytes_to_var(original)
|
|
runtime = root.get_node("SimulationRuntime")
|
|
clock = root.get_node("GameClock")
|
|
runtime.initialize(clock, root.get_node("GameState"), int(initial[&"systems"][&"runtime"][&"world_seed"]))
|
|
check(runtime.restore_snapshot(initial), "fixed646 public restore")
|
|
check(var_to_bytes(runtime.create_snapshot()) == original, "complete input bytes identical")
|
|
check(clock.absolute_minute == 646 and clock.paused and clock.speed == 1, "same paused646 speed1")
|
|
var path_listeners: Array = runtime.path_service.get_signal_connection_list(&"path_query_measured")
|
|
check(path_listeners.size() == 1 and path_listeners[0]["callable"] == Callable(runtime, "_on_path_query_measured") and int(path_listeners[0]["flags"]) == 0, "only builtin path listener")
|
|
check(clock.performance_budget.get_signal_connection_list(&"budget_exceeded").is_empty(), "no external budget listener")
|
|
check(clock.get_signal_connection_list(&"tick_phase_started").is_empty() and clock.get_signal_connection_list(&"tick_completed").is_empty(), "no phase or completion instrumentation")
|
|
check(runtime.path_service.cache_hits == 0 and runtime.path_service.cache_misses == 0 and runtime.path_service.cached_path_count() == 0, "same cold derived cache")
|
|
check(runtime.path_service._query_batch.is_empty() and runtime.path_service._guest_tree_workspace.is_empty() and runtime.path_service._guest_step_connector_memo.is_empty(), "same cold tree/native-edge/step workspace")
|
|
check(runtime._guest_access_batch_can_select(), "both candidates active fast guard")
|
|
check(runtime.path_service.get_script().get_source_code().sha256_text() == OS.get_environment("THE_TREE_EXPECTED_PATH_SHA") and FileAccess.get_sha256("res://scripts/core/performance_budget.gd") == OS.get_environment("THE_TREE_EXPECTED_BUDGET_SHA"), "actual loaded original Path and same candidate Budget sources")
|
|
var started := Time.get_ticks_usec()
|
|
clock.advance_minutes(1)
|
|
var elapsed := Time.get_ticks_usec() - started
|
|
check(clock.absolute_minute == 647 and clock.paused, "tick returns at paused647")
|
|
var after: Dictionary = runtime.create_snapshot()
|
|
var oracle := FileAccess.get_file_as_bytes(OS.get_environment("THE_TREE_CANDIDATE_ORACLE")).decompress(11487732, FileAccess.COMPRESSION_ZSTD)
|
|
check(var_to_bytes(after) == oracle, "complete after647 equals pinned r32 oracle")
|
|
var after_pin := typed("after647", after)
|
|
check(after_pin["uncompressed_sha256"] == "9df3c1b6f65dfd8be944cd5cab8c631f7533530dfef3820d9fa5d74a5b1ac30f", "complete output digest identical")
|
|
var report := {"plan_id":"P23-02", "candidate":candidate, "sample":OS.get_environment("THE_TREE_PAIRED_SAMPLE"), "pid":OS.get_process_id(), "manual_tick_us":elapsed, "after647":after_pin, "cache_hits":runtime.path_service.cache_hits, "cache_misses":runtime.path_service.cache_misses, "checks":checks, "failures":failures, "passed":failures.is_empty(), "unit_accepted":false, "performance_budget_accepted":false, "normal_OS_accepted":false, "Windows_accepted":false, "candidate_adopted":false, "limits":["One sample from an adjacent baseline Guest bulk r313-r02/library314-r02 versus hot-loop r326/library327 pair; fixed cold restored646. Only exploratory pair observation, no stable speedup, percentile or budget acceptance.", "No Main, rendering, OS input or realtime x3. Timed interval contains builtin production callbacks; snapshot verification and compression occur after timing."]}
|
|
var file := FileAccess.open(output.path_join("report.json"), FileAccess.WRITE)
|
|
if file == null: quit(98); return
|
|
file.store_string(JSON.stringify(report, "\t")); file.close()
|
|
print("SDK whole647: %d checks, %d failures" % [checks, failures.size()])
|
|
quit(0 if failures.is_empty() else 1)
|