Implement AXIS parity UI and execution baseline
This commit is contained in:
14
scripts/generate_clp_s2_report.py
Normal file
14
scripts/generate_clp_s2_report.py
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate deterministic S2-01 ClassicLadder parser/runtime evidence."""
|
||||
from __future__ import annotations
|
||||
import argparse,hashlib,json,subprocess
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
OUTPUTS=(Path("web/worker/plc-runtime.mjs"),Path("web/worker/test_plc_runtime.mjs"))
|
||||
def canonical(v:Any)->str:return json.dumps(v,ensure_ascii=False,sort_keys=True,separators=(",",":"))
|
||||
def sha256(p:Path)->str:return hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
def generate(root:Path,out:Path)->dict[str,Any]:
|
||||
r=subprocess.run(["node","web/worker/test_plc_runtime.mjs"],cwd=root,stdout=subprocess.PIPE,stderr=subprocess.PIPE,check=False);report={"schema":"clp-s2-report.v1","task_id":"S2-01","context_id":"linuxcnc-2.10.0-pre0-wasm-m1-py-c1","status":"verified" if r.returncode==0 else "blocked","features":[".clp rung block parser","cell type validation","PLC register scan","timer/counter","sampler/backpressure","malformed input error"],"test":{"status":"verified" if r.returncode==0 else "blocked","stdout_sha256":hashlib.sha256(r.stdout).hexdigest(),"stderr_sha256":hashlib.sha256(r.stderr).hexdigest()},"outputs":[{"path":p.as_posix(),"bytes":(root/p).stat().st_size,"sha256":sha256(root/p)} for p in OUTPUTS]};report["report_sha256"]=hashlib.sha256(canonical(report).encode()).hexdigest();out.parent.mkdir(parents=True,exist_ok=True);out.write_text(json.dumps(report,ensure_ascii=False,sort_keys=True,indent=2)+"\n");return report
|
||||
def main()->int:
|
||||
p=argparse.ArgumentParser();p.add_argument("--repo-root",type=Path,default=Path(__file__).resolve().parents[1]);p.add_argument("--report",type=Path,default=Path("coverage/clp-s2.report.json"));a=p.parse_args();r=generate(a.repo_root.resolve(),a.repo_root.resolve()/a.report);print(f"clp_s2={r['status']}");return 0 if r["status"]=="verified" else 1
|
||||
if __name__=="__main__":raise SystemExit(main())
|
||||
Reference in New Issue
Block a user