Complete XYZAC LinuxCNC WASM parity and smooth 3D preview
This commit is contained in:
55
scripts/generate_xyzac_trt_parity_report.py
Normal file
55
scripts/generate_xyzac_trt_parity_report.py
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate the legacy XYZAC parity report from the structured comparator."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
STRUCTURED = ROOT / "coverage/xyzac-trt-trace-parity.report.json"
|
||||
REPORT = ROOT / "coverage/xyzac-trt-native-wasm-parity.report.json"
|
||||
|
||||
|
||||
def canonical(value: Any) -> str:
|
||||
return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
result = subprocess.run(["python3", "scripts/compare_xyzac_native_wasm_trace.py"], cwd=ROOT, check=False)
|
||||
if result.returncode != 0 or not STRUCTURED.is_file():
|
||||
return 1
|
||||
source = json.loads(STRUCTURED.read_text(encoding="utf-8"))
|
||||
report: dict[str, Any] = {
|
||||
"schema": "xyzac-trt-native-wasm-parity.v2",
|
||||
"task_id": "PARITY-00",
|
||||
"context_id": source["context_id"],
|
||||
"case": source["case"]["path"],
|
||||
"scope": "xyzac_only",
|
||||
"status": source["status"],
|
||||
"native": source.get("traces", {}).get("native", {}),
|
||||
"wasm": source.get("traces", {}).get("wasm", {}),
|
||||
"worker": source.get("traces", {}).get("worker", {}),
|
||||
"trace": {
|
||||
"levels": source["levels"],
|
||||
"native_wasm": source["native_wasm"],
|
||||
"native_worker": source["native_worker"],
|
||||
"first_divergent_tick": source["first_divergent_tick"],
|
||||
"positive_divergence_sample": source["positive_divergence_sample"],
|
||||
},
|
||||
"authority": "linuxcnc-wasm-worker",
|
||||
"js_authority": 0,
|
||||
"release_status": "STOP_RELEASE",
|
||||
"report_sha256": None,
|
||||
}
|
||||
report["report_sha256"] = hashlib.sha256(canonical({key: value for key, value in report.items() if key != "report_sha256"}).encode()).hexdigest()
|
||||
REPORT.write_text(json.dumps(report, ensure_ascii=False, sort_keys=True, indent=2) + "\n", encoding="utf-8")
|
||||
print(json.dumps({"schema": report["schema"], "status": report["status"], "scope": report["scope"], "report_sha256": report["report_sha256"]}, ensure_ascii=False))
|
||||
return 0 if report["status"] == "verified" else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user