68 lines
3.5 KiB
Python
68 lines
3.5 KiB
Python
#!/usr/bin/env python3
|
|
import hashlib
|
|
import json
|
|
import pathlib
|
|
import sys
|
|
|
|
import bpy
|
|
|
|
|
|
RECEIPT_NAME = "WBV2-P7-003-FullParityCandidateReleaseGateReceipt"
|
|
CUBE_NAME = "WBV2P7003ParityReleaseGateCube"
|
|
|
|
|
|
def state():
|
|
scene = bpy.context.scene
|
|
text = bpy.data.texts.get(RECEIPT_NAME)
|
|
cube = bpy.data.objects.get(CUBE_NAME)
|
|
if text is None or cube is None:
|
|
raise RuntimeError("release gate fixture is missing receipt or cube")
|
|
return {"sceneId": "scene:" + scene.name, "cubeId": "object:" + cube.name, "receipt": json.loads(text.as_string())}
|
|
|
|
|
|
def validate(receipt):
|
|
if receipt.get("schemaVersion") != 1 or receipt.get("receiptId") != "workflow:full_parity_candidate_release_gate":
|
|
raise RuntimeError("release gate receipt identity is invalid")
|
|
inputs = receipt.get("inputs", {})
|
|
if len(inputs) != 4 or any(len(value.get("sha256", "")) != 64 or not value.get("path") for value in inputs.values()):
|
|
raise RuntimeError("release gate input bindings are invalid")
|
|
closure = receipt.get("parityClosure", {})
|
|
evidence = receipt.get("evidenceHealth", {})
|
|
recovery = receipt.get("recoveryHealth", {})
|
|
decision = receipt.get("releaseDecision", {})
|
|
if (closure.get("status") != "BLOCKED" or closure.get("inventoryEntries") != 6900 or closure.get("clusterCount") != 15 or
|
|
closure.get("atomicTaskCount") != 45 or closure.get("currentParityLevel") != "L0" or closure.get("featureParityClaims") != 0 or
|
|
evidence.get("status") != "BLOCKED" or evidence.get("m12ProvenanceState") != "BLOCKED_SOURCE_LOST" or
|
|
evidence.get("historicalEvidencePreserved") is not True or evidence.get("m12Entries", 0) < 1 or
|
|
recovery.get("status") != "READY" or recovery.get("quickCi") != "READY" or recovery.get("inventorySaveReopen") != "EXACT" or
|
|
recovery.get("queueSaveReopen") != "EXACT" or recovery.get("malformedBlend") != "REJECTED_WITHOUT_MAIN_MUTATION" or
|
|
decision.get("status") != "BLOCKED" or decision.get("nextTask") is not None):
|
|
raise RuntimeError("release gate decision is not fail-closed")
|
|
|
|
|
|
def main():
|
|
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
|
if len(arguments) != 2:
|
|
raise SystemExit("usage: blender -b --factory-startup --python check-wbv2-p7-003-desktop.py -- FIXTURE REPORT")
|
|
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
|
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
|
before = state()
|
|
validate(before["receipt"])
|
|
temporary = fixture.with_name(f"{fixture.stem}-reopen.blend")
|
|
try:
|
|
bpy.ops.wm.save_as_mainfile(filepath=str(temporary), check_existing=False, compress=True)
|
|
bpy.ops.wm.open_mainfile(filepath=str(temporary), load_ui=False)
|
|
after = state()
|
|
finally:
|
|
temporary.unlink(missing_ok=True)
|
|
if before != after:
|
|
raise RuntimeError(f"release gate save/reopen drift: {before} != {after}")
|
|
report = {"schemaVersion": 1, "task": "WBV2-P7-003", "operation": "FULL_PARITY_CANDIDATE_RELEASE_GATE_DESKTOP", "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "state": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
|
output.parent.mkdir(parents=True, exist_ok=True)
|
|
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
print("wbv2-p7-003-desktop-ok parity=blocked evidence=blocked recovery=ready decision=blocked saveReopen=exact")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|