Files
SkillFactory/performance_v042/seal_delivery.py
T
chenlin c528dd268f feat: checkpoint Go2 FL simulation performance v0.4.2
Include callable skill and live-GUI prerequisites, epoch sensor reads, packed snapshots, sampled bit-exact kinematics, and verified-tick rendering without changing the physical/control schedule.

Record bounded analytic S1 GUI/headless qualification, original failures and CPU evidence (1557 passed, 6 skipped). Preserve accepted_skill=false and sub-real-time limitations. Exclude native authorities, caches, large media and local delivery copies; retain sealed artifact digest.
2026-10-16 15:46:01 +08:00

32 lines
3.0 KiB
Python

#!/usr/bin/python3.12
"""Seal and independently read back every archive payload; no native/GPU run."""
import pathlib,json,hashlib,tarfile,xml.etree.ElementTree as ET
A=pathlib.Path(__file__).resolve().parent;P=pathlib.Path(json.loads((A/'assembly.json').read_text())['package']);archive=P.with_suffix('.tar.gz')
# with_suffix would truncate the dotted version; use the whole directory name.
archive=P.parent/(P.name+'.tar.gz');assert not archive.exists();assert not (P/'SHA256SUMS').exists()
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
auth=json.loads((A/'runs/display-S1-05/campaign/approval.json').read_text())['sources'];assert len(auth)==41 and all(sha(P/n)==h for n,h in auth.items())
xml=ET.parse(A/'delivery-cpu-final.xml');s=next(xml.iter('testsuite'));assert int(s.attrib['failures'])==0 and int(s.attrib['errors'])==0 and int(s.attrib['skipped'])==6 and int(s.attrib['tests'])==1563
validation=json.loads((A/'delivery-validation-final.json').read_text());assert validation['execution_authorized'] is False and validation['new_physics_calls']==0 and validation['sources']==auth
assert validation['frozen']['snapshot_files_verified']==134 and validation['frozen']['candidate_sha256']=='c088bb3aecaca751867118858626fd508f7a3983303802d7524353f80802cf99'
files=sorted(p for p in P.rglob('*') if p.is_file());assert not any(p.is_symlink() for p in P.rglob('*'))
manifest={str(p.relative_to(P)):sha(p) for p in files}
(P/'SHA256SUMS').write_text(''.join(h+' '+n+'\n' for n,h in manifest.items()))
manifest['SHA256SUMS']=sha(P/'SHA256SUMS')
with tarfile.open(archive,'w:gz',compresslevel=6) as t:t.add(P,arcname=P.name)
readback={}
with tarfile.open(archive,'r:gz') as t:
for m in t:
path=pathlib.PurePosixPath(m.name)
assert not path.is_absolute() and '..' not in path.parts and path.parts[0]==P.name
assert m.isdir() or m.isfile(),m.name
if m.isfile():
name=str(path.relative_to(P.name));assert name not in readback
h=hashlib.sha256();f=t.extractfile(m)
while chunk:=f.read(1024*1024):h.update(chunk)
readback[name]=h.hexdigest()
assert readback==manifest,'Archive payload differs from sealed package'
h=sha(archive);side=pathlib.Path(str(archive)+'.sha256');side.write_text(h+' '+archive.name+'\n')
r={'version':'0.4.2','accepted_skill':False,'package':str(P),'archive':str(archive),'archive_bytes':archive.stat().st_size,'archive_sha256':h,'checksum_file':str(side),'payload_files_including_manifest':len(manifest),'sha256sums_entries':len(manifest)-1,'authority_inputs_match_native_staging':41,'all_manifest_files_match':True,'every_archive_payload_readback_verified':True,'no_illegal_members':True,'native_run_at_delivery_path':False,'native_qualification_scope':'analyticS1GUI/headless27000ticks each; source-identical copied artifact, not fullmatrix/u256/nativefaultinjection','CPU_package':{'passed':1557,'skipped':6,'failed':0},'validation_receipt':str(A/'delivery-validation-final.json')}
(A/'package-verification.json').write_text(json.dumps(r,indent=2)+'\n');print(json.dumps(r,indent=2))