from pathlib import Path import json,hashlib,tempfile,re,shutil base=Path('reports/os-implementation');a=base/'K2100-smp-workers-preflight-ElJee3';b=base/'K2100-smp-workers-preflight-40iWwy';names=['OS_K2100_WORKER_'+n for n in ['ACK','RECORDS','EVIDENCE','GO','FINISH','CAPTURE_GATE','THREAD_LAYOUT']] def symbols(p):return {m[2]:{'address':int(m[0],16),'size':int(m[1],16)}for m in re.findall(r'^([0-9a-f]{16}) ([0-9a-f]{16}) [A-Za-z] (.+)$',(p/'product.nm').read_text(),re.M)} x,y=symbols(a),symbols(b);oldmissing=[n for n in names if n not in x];missing=[n for n in names if n not in y];assert oldmissing==['OS_K2100_WORKER_THREAD_LAYOUT'];assert missing==[];assert y['OS_K2100_WORKER_THREAD_LAYOUT']['size']==224 out=Path(tempfile.mkdtemp(prefix='K2100-worker-layout-review-',dir=base));shutil.copyfile(__file__,out/'harness.py.txt') def art(p):return {'path':str(p),'sha256':hashlib.sha256(Path(p).read_bytes()).hexdigest()} r={'status':'WORKER_LAYOUT_CORRECTED_AND_TESTED','guestAccepted':False,'productAccepted':False,'scope':'First candidate failed before launching a guest because unreferenced readonly layout was garbage-collected. Native evidence now retains its address and size; all seven capture symbols present. Does not grant guest acceptance.','original':art(a/'report.json'),'corrected':art(b/'report.json'),'originalNm':art(a/'product.nm'),'correctedNm':art(b/'product.nm'),'originalSource':art(a/'sources/kernel/src/k2100-smp-workers.rs'),'correctedSource':art(b/'sources/kernel/src/k2100-smp-workers.rs'),'harness':art(out/'harness.py.txt'),'missingBefore':oldmissing,'missingAfter':missing,'retained':{n:y[n]for n in names}} (out/'report.json').write_text(json.dumps(r,indent=2)+'\n');print(out/'report.json')