Preserve complete P08 regression profile with verified compression

This commit is contained in:
Takeshi
2026-10-13 23:58:03 +09:00
parent e97d912bac
commit f159c6c712
2 changed files with 20993 additions and 0 deletions
@@ -0,0 +1,53 @@
"""Bind only ended, passing exact-candidate full regression; retain all QA evidence."""
from pathlib import Path
import json,hashlib,subprocess,time
R=Path('/Users/korizatou114/Projects/とりにく工房ゲーム制作部')
W=Path('/Users/korizatou114/Projects/TheTree-managed-worktrees/p08-02/P08-02-implement')
S=R/'artifacts/original-completion-2026-10-02/p08-02-final-full174-native-r01'
N=R/'artifacts/original-completion-2026-10-02/p08-02-native-mixed-r06'
E=Path('/Users/korizatou114/Projects/TheTree-managed-worktrees/p08-02/.runtime/P08-02/build/p08-evidence')
def read(p):return json.loads(p.read_text())
def sha(p):
h=hashlib.sha256()
with p.open('rb') as stream:
for block in iter(lambda:stream.read(1048576),b''):h.update(block)
return h.hexdigest()
ended=read(S/'runner-ended.json');inp=read(S/'runner-input.json');index=read(N/'index.json')
assert ended['passed'] and ended['engine_ended'] and not ended['error'] and not ended['guard_errors'] and not ended['cleanup_errors']
assert inp['selected_source_map']==index['source_map']
assert ended['remaining_unexecuted_tests']==[] and ended['failed_suites']==0
assert [x['test'] for x in ended['phases'] if x.get('test')]==inp['roster']
assert subprocess.check_output(['git','rev-parse','HEAD'],cwd=W,text=True).strip()==index['commit']
assert not (N/'regression').exists() and not (E/'regression').exists()
rows=[];start=time.monotonic()
def copy(source,name,pin=None):
assert source.is_file() and not source.is_symlink()
before={'bytes':source.stat().st_size,'sha256':sha(source)}
if pin is not None:assert before==pin
for base in [N,E]:
target=base/name;target.parent.mkdir(parents=True,exist_ok=True);subprocess.run(['/bin/cp','-pc',str(source),str(target)],check=True)
assert target.stat().st_size==before['bytes'] and sha(target)==before['sha256']
assert sha(source)==before['sha256'];index['artifacts'][name]=before
rows.append({'path':name,'source':str(source),**before})
for source in sorted(S.rglob('*')):
rel=source.relative_to(S)
if not source.is_file():continue
if rel.parts[0]=='stage':continue
copy(source,'regression/'+rel.as_posix())
generated={}
for phase in ended['phases']:
generated.update(phase.get('generated_reports',{}))
for field in ['whole_startup_profile_after','whole_runtime_profile_after']:
profile=phase.get(field)
if not profile:continue
base=Path(profile['path']);assert base.name.startswith('TheTree-PCK-tests-') and base.parent==Path.home()/'Library/Application Support'
actual={str(f.relative_to(base)) for f in base.rglob('*') if f.is_file()};assert actual==set(profile['files'])
for name,pin in profile['files'].items():copy(base/name,'regression/profiles/'+base.name+'/'+name,pin)
for name,pin in generated.items():copy(S/'stage'/name,'regression/stage/'+name,{'bytes':pin['bytes'],'sha256':pin['sha256']})
index['regression']='regression/proof.json'
proof={'commit':index['commit'],'input':'regression/runner-input.json','ended':'regression/runner-ended.json','directory':'regression','canonical_stage_sources':'available in frozen candidate source checkout; exact full source map verified by runner','import_cache':'not acceptance evidence; import log and native lifecycle preserved','profile_proofs':'full completed private profile contents retained; no snapshots sampled','formal_acceptance':False}
tmp=R/'docs/plans/original-completion-2026-10-02/execution/p08-02-audit-r06/final_regression_proof.json';tmp.write_text(json.dumps(proof,ensure_ascii=False,indent=2)+'\n');copy(tmp,'regression/proof.json')
manifest={'candidate':index['commit'],'files':rows,'file_count':len(rows),'elapsed_seconds':time.monotonic()-start,'whole_profile_inventory_preserved':True,'accepted':False}
p=R/'docs/plans/original-completion-2026-10-02/execution/p08-02-audit-r06/REGISTERED_FINAL_REGRESSION_BINDING.json';p.write_text(json.dumps(manifest,ensure_ascii=False,indent=2)+'\n')
for base in [N,E]:(base/'index.json').write_text(json.dumps(index,ensure_ascii=False,indent=2)+'\n')
print(json.dumps({k:v for k,v in manifest.items() if k!='files'}),flush=True)