P08-03: 配置の通常操作受入

This commit is contained in:
Agent Control Runner
2026-10-14 04:53:00 +09:00
parent 8e3d79d5f2
commit 4a17d0e0f5
15 changed files with 14249 additions and 56 deletions
+29
View File
@@ -5,6 +5,7 @@ fabricated unit-test data, never collector output. Semantic corruption tests rep
their bytes, so they cannot pass merely by detecting a stale artifact checksum.
"""
import copy
import json
import hashlib
import json
from pathlib import Path
@@ -290,6 +291,34 @@ def make(base, source, checker):
'result':typed({'ok':True,'read_only':True,'snapshot':copy.deepcopy(model)}),
'raw_sha256':sha(folder/(inspect_stem+'.var'))})
put(folder/(role+'-save-results.json'), {'pid':pid,'records':[stem,inspect_stem]})
if method == "native_os":
prefix = "writer-bootstrap-"
returned = {"ok":True,"operation":"recovery","code":"OK","save_path":"user://saves/manual_ui"}
expected = checker.expected_operation(formal_model,returned,"SAVE_RECOVERY_LOADED")
for label,value in [("formal-model",formal_model),("returned-result",typed(returned)),
("checkpoint",expected),("expected-operation",expected),("operation-actual",expected)]:
put(folder/(prefix+label+".json"),value)
(folder/(prefix+label+".var")).write_bytes(json.dumps(value,sort_keys=True).encode())
records = []
for suffix,operation,value in [
("0000-bootstrap","runtime_operation",returned),
("0000-inspect","initial_inspect",{"ok":True,"read_only":True,"snapshot":copy.deepcopy(model)})]:
stem = "writer-save-result-"+suffix
(folder/(stem+".var")).write_bytes(b"synthetic bootstrap Dictionary")
put(folder/(stem+".json"), {"pid":pids[0],"operation":operation,
"requested_path":"user://saves/manual_ui","absolute_path":absolute,"user_data_dir":profile,
"result":typed(value),"raw_sha256":sha(folder/(stem+".var"))})
records.append(stem)
log = json.loads((folder/"writer-save-results.json").read_text())
log["records"] = records+log["records"]
put(folder/"writer-save-results.json",log)
count = len(model["systems"]["runtime"]["domain_events"]["recent_events"])
put(folder/(prefix+"operation-comparison.json"), {
"pid":pids[0],"delta_kind":"source_defined_notification",
"formal_model":prefix+"formal-model","actual_model":prefix+"checkpoint",
"expected_model":prefix+"expected-operation","returned_result":typed(returned),
"saved_recent_count":count,"expected_recent_count":count+1,"actual_recent_count":count+1,
"whole_raw_equal":True})
put(folder/'save.json', {'members': {n: sha(formal/n) for n in checker.MEMBERS},
'pid': pids[0], 'cell': target, 'instance_id': 'f4'})
row = {'id': 'resume_overlap', 'kind': 'build', 'position': position(target),
+8 -1
View File
@@ -75,7 +75,14 @@ func setup() -> void:
var stored: Dictionary = SaveService.inspect_snapshot(ProjectSettings.globalize_path(String(main.manual_save_path)))
record_save_result("initial_inspect", String(main.manual_save_path), stored)
expect(bool(stored.get("ok", false)), "read-only initial formal inspection")
expect(runtime.create_snapshot() == stored.get("snapshot", {}), "OS initial formal model exact")
var formal: Dictionary = stored.get("snapshot", {})
capture_model("bootstrap-formal-model", formal)
capture("bootstrap-checkpoint")
expect(not operation_results.is_empty(), "bootstrap returned load Dictionary")
if not operation_results.is_empty():
var returned: Dictionary = operation_results.back()
capture_model("bootstrap-returned-result", returned)
verify_operation(formal, returned, &"SAVE_RECOVERY_LOADED", "bootstrap-")
expect(clock.paused, "diagnostic formal fixture starts paused")
func diagnostic_budget() -> void:
+8 -8
View File
@@ -343,7 +343,7 @@ func inspect_formal() -> Dictionary:
capture_model("formal-model", formal)
return formal
func verify_operation(formal: Dictionary, result: Dictionary, event_type: StringName) -> void:
func verify_operation(formal: Dictionary, result: Dictionary, event_type: StringName, prefix: String = "") -> void:
var expected := formal.duplicate(true)
var model: Dictionary = expected[&"systems"][&"runtime"]
var counters: Dictionary = model[&"id_generator"]["counters"]
@@ -379,20 +379,20 @@ func verify_operation(formal: Dictionary, result: Dictionary, event_type: String
stream["recent_events"].append(notification.to_dictionary())
if stream["recent_events"].size() > DomainEventStream.RECENT_EVENT_LIMIT:
stream["recent_events"].pop_front()
capture_model("expected-operation", expected)
capture("operation-actual")
var actual: Dictionary = bytes_to_var(FileAccess.get_file_as_bytes(directory.path_join(role + "-checkpoint.var")))
json_file(role + "-operation-comparison.json", {
capture_model(prefix + "expected-operation", expected)
capture(prefix + "operation-actual")
var actual: Dictionary = bytes_to_var(FileAccess.get_file_as_bytes(directory.path_join(role + "-" + prefix + "checkpoint.var")))
json_file(role + "-" + prefix + "operation-comparison.json", {
"pid": OS.get_process_id(), "delta_kind": "source_defined_notification",
"formal_model": role + "-formal-model", "actual_model": role + "-checkpoint",
"expected_model": role + "-expected-operation", "returned_result": Codec.new().typed(result),
"formal_model": role + "-" + prefix + "formal-model", "actual_model": role + "-" + prefix + "checkpoint",
"expected_model": role + "-" + prefix + "expected-operation", "returned_result": Codec.new().typed(result),
"saved_recent_count": formal[&"systems"][&"runtime"][&"domain_events"]["recent_events"].size(),
"expected_recent_count": stream["recent_events"].size(),
"actual_recent_count": actual[&"systems"][&"runtime"][&"domain_events"]["recent_events"].size(),
"whole_raw_equal": var_to_bytes(expected) == var_to_bytes(actual),
})
# Complete raw actual/expected snapshots remain available on unknown drift.
expect(var_to_bytes(expected) == var_to_bytes(actual), "whole source-defined save operation model; see " + role + "-operation-comparison.json")
expect(var_to_bytes(expected) == var_to_bytes(actual), "whole source-defined save operation model; see " + role + "-" + prefix + "operation-comparison.json")
expect(var_to_bytes(actual) == var_to_bytes(runtime.create_snapshot()), "read-only inspection preserves live model")
func record_save_operation(result: Dictionary) -> void: