Files
linuxcncWebWASM/scripts/generate_jog_limit_acceptance.py

29 lines
1.8 KiB
Python

import hashlib
import json
import shutil
from pathlib import Path
root = Path(__file__).resolve().parents[1]
output = root / 'coverage/glb-machine/jog-limits'
for name in ['worker', 'browser', 'checkpoint', 'motion', 'step', 'recovery', 'build', 'manual', 'buttons', 'manual-baseline', 'buttons-baseline', 'before']:
shutil.copyfile(Path('/tmp') / f'jog-limits-{name}.log', output / f'{name}.log')
for name in ['worker.report.json', 'browser.report.json', 'motion.report.json', 'exact-checkpoint.report.json', 'shadow.report.json']:
assert json.loads((output / name).read_text())['status'] == 'verified', name
assert 'built in' in (output / 'build.log').read_text()
report = {
'report_id': 'jog-limit-acceptance-v1', 'status': 'verified',
'tasks': ['TRT-JOG02', 'GLB-UI02'],
'wasm_sha256': hashlib.sha256((root / 'build-wasm/linuxcnc-sim-core.wasm').read_bytes()).hexdigest(),
'known_baseline_failures': [
{'test': 'test_xyzac_manual_control.mjs', 'failure': 'synchronous homing mask 0 != 1; identical with HEAD modules'},
{'test': 'test_xyzac_button_constraints.mjs', 'failure': 'unhomed versus machine-off gate priority; identical with HEAD modules'},
],
'boundaries': ['RTCP limit stops at last valid servo sample; no predictive hardware deceleration claim', 'Previously broken transport sessions require page reload'],
'evidence': [
{'path': str(path.relative_to(root)), 'sha256': hashlib.sha256(path.read_bytes()).hexdigest()}
for path in sorted(output.rglob('*')) if path.is_file() and path.name != 'acceptance.report.json'
],
}
(output / 'acceptance.report.json').write_text(json.dumps(report, indent=2) + '\n')
print(json.dumps({'report_id': report['report_id'], 'status': report['status'], 'evidence_count': len(report['evidence'])}))