P08-03: 配置の通常操作受入
This commit is contained in:
@@ -377,6 +377,8 @@ def check(project_root, evidence_dir):
|
||||
rows = []
|
||||
normal_results = {}
|
||||
inspections = {}
|
||||
bootstrap_inspection = None
|
||||
bootstrap_result = None
|
||||
for role, pid in zip(('writer', 'reader'), expected_pids):
|
||||
process = document(directory+'/'+role+'-process.json')
|
||||
require(process['pid'] == pid and process['failures'] == 0 and process['checks'] > 0, 'process attribution')
|
||||
@@ -392,7 +394,12 @@ def check(project_root, evidence_dir):
|
||||
require(path.startswith('user://') and record['absolute_path'] == str(Path(record['user_data_dir'])/path[7:]), 'save outside private user profile')
|
||||
result = decode(record['result'])
|
||||
require(isinstance(result, dict) and result.get('ok') is True, 'actual save/load failed')
|
||||
if native_os and role == "writer" and record["operation"] == "initial_inspect":
|
||||
require(result.get("read_only") is True and "snapshot" in result, "missing bootstrap inspection")
|
||||
bootstrap_inspection = typed_member(record["result"],"snapshot")
|
||||
if record['operation'] == 'runtime_operation':
|
||||
if native_os and role == "writer" and bootstrap_result is None:
|
||||
bootstrap_result = record["result"]
|
||||
operations.append(result.get('operation'))
|
||||
normal_results[role] = result
|
||||
if record['operation'] == 'formal_inspect':
|
||||
@@ -464,6 +471,30 @@ def check(project_root, evidence_dir):
|
||||
'expected_recent_count':len(decode(expected)['systems']['runtime']['domain_events']['recent_events']),
|
||||
'actual_recent_count':len(decode(typed(role+'-checkpoint'))['systems']['runtime']['domain_events']['recent_events']),
|
||||
'whole_raw_equal':True} and decode(comparison['returned_result']) == result, 'wrong operation comparison attribution')
|
||||
if native_os:
|
||||
prefix = "writer-bootstrap-"
|
||||
bootstrap_formal = typed(prefix+"formal-model")
|
||||
returned = typed(prefix+"returned-result")
|
||||
require(bootstrap_inspection is not None and not typed_differences(bootstrap_formal,bootstrap_inspection), "wrong bootstrap formal inspection")
|
||||
require(bootstrap_result is not None and not typed_differences(returned,bootstrap_result), "wrong bootstrap returned Dictionary")
|
||||
result = decode(returned)
|
||||
require(result.get("ok") is True and result.get("operation") == "recovery", "wrong bootstrap load result")
|
||||
expected = expected_operation(bootstrap_formal,result,"SAVE_RECOVERY_LOADED")
|
||||
actual = typed(prefix+"checkpoint")
|
||||
require(not typed_differences(expected,actual), "bootstrap source-defined operation drift")
|
||||
require(not typed_differences(expected,typed(prefix+"expected-operation")), "wrong bootstrap expected model")
|
||||
require(not typed_differences(actual,typed(prefix+"operation-actual")), "bootstrap inspection drift")
|
||||
for label in ("expected-operation","operation-actual"):
|
||||
require(sha(artifact(directory+"/"+prefix+label+".var")) == sha(artifact(directory+"/"+prefix+"checkpoint.var")), "wrong bootstrap raw model")
|
||||
comparison = document(directory+"/"+prefix+"operation-comparison.json")
|
||||
require(comparison == {
|
||||
"pid":expected_pids[0], "delta_kind":"source_defined_notification",
|
||||
"formal_model":prefix+"formal-model", "actual_model":prefix+"checkpoint",
|
||||
"expected_model":prefix+"expected-operation", "returned_result":returned,
|
||||
"saved_recent_count":len(decode(bootstrap_formal)["systems"]["runtime"]["domain_events"]["recent_events"]),
|
||||
"expected_recent_count":len(decode(expected)["systems"]["runtime"]["domain_events"]["recent_events"]),
|
||||
"actual_recent_count":len(decode(actual)["systems"]["runtime"]["domain_events"]["recent_events"]),
|
||||
"whole_raw_equal":True}, "wrong bootstrap comparison attribution")
|
||||
saved = document(directory+'/save.json')
|
||||
require(set(saved['members']) == set(MEMBERS) and saved['pid'] == expected_pids[0], 'missing formal members/writer')
|
||||
for member in MEMBERS:
|
||||
|
||||
Reference in New Issue
Block a user