Advance simulation parity and 3-axis tutorial coverage
This commit is contained in:
44
scripts/generate_axis3_tutorial_persistence_report.py
Normal file
44
scripts/generate_axis3_tutorial_persistence_report.py
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate selected-case workspace persistence/restart evidence."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
REPORT = ROOT / "coverage/axis3-tutorial-persistence.report.json"
|
||||
|
||||
|
||||
def canonical(value: Any) -> str:
|
||||
return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"))
|
||||
|
||||
|
||||
def generate() -> dict[str, Any]:
|
||||
result = subprocess.run(["node", "web/worker/test_axis3_tutorial_persistence.mjs"], cwd=ROOT, capture_output=True, text=True, check=False)
|
||||
sample = None
|
||||
for line in reversed(result.stdout.splitlines()):
|
||||
try: value = json.loads(line)
|
||||
except json.JSONDecodeError: continue
|
||||
if value.get("schema") == "axis3-tutorial-persistence.v1": sample = value; break
|
||||
report: dict[str, Any] = {
|
||||
"schema": "axis3-tutorial-persistence-report.v1",
|
||||
"task_id": "TUTORIAL-13",
|
||||
"context_id": "linuxcnc-2.10.0-pre0-wasm-m1-py-c1",
|
||||
"case": "linuxcnc/configs/sim/axis/vismach/3axis-tutorial",
|
||||
"status": "verified" if result.returncode == 0 and sample else "blocked",
|
||||
"test": {"command": ["node", "web/worker/test_axis3_tutorial_persistence.mjs"], "returncode": result.returncode, "stdout_sha256": hashlib.sha256(result.stdout.encode()).hexdigest(), "stderr_sha256": hashlib.sha256(result.stderr.encode()).hexdigest(), "sample": sample},
|
||||
"checks": {"runtime_files": ["3axis-tutorial_mm.var", "tool.tbl", "position_mm.txt"], "checkpoint_endpoint_parity": sample.get("endpoint_equal") if sample else False, "bad_checkpoint_fail_closed": sample.get("blocked_bad_checkpoint") == "blocked" if sample else False, "duplicate_side_effects": "none"},
|
||||
"known_boundaries": ["native restart uses source-defined individual home order Z/X/Y; Worker persistence is independently verified", "OPFS physical crash oracle remains external"],
|
||||
}
|
||||
report["report_sha256"] = hashlib.sha256(canonical(report).encode()).hexdigest()
|
||||
REPORT.write_text(json.dumps(report, ensure_ascii=False, sort_keys=True, indent=2) + "\n", encoding="utf-8")
|
||||
print(f"axis3_tutorial_persistence={report['status']} report_sha256={report['report_sha256']}")
|
||||
return report
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(0 if generate()["status"] == "verified" else 1)
|
||||
Reference in New Issue
Block a user