Files
Investidor-V2/outputs/investmoz-parques-QA-20261016/freeze-candidate.py
T
nala cef6e201c7
tests / ci (push) Canceled after 0s
versao nrgocios 2
2026-10-16 20:11:05 +02:00

18 lines
1.8 KiB
Python

from pathlib import Path
import json,shutil,hashlib,subprocess
out=Path(__file__).resolve().parent;private=Path('C:/Users/macbook/.config/investmoz/parques-QA-20261016');qa=private/'source';restored=private/'restored-source';p=json.loads((out/'COMPATIBILITY-PREPARED.json').read_text('utf-8'));sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
assert not (private/'candidate-final-sources').exists()
for n in p['paths']:
dest=private/'candidate-final-sources'/n;dest.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(qa/n,dest);shutil.copy2(qa/n,restored/n)
shutil.copytree(qa/'public/build',private/'candidate-final-build')
for file in(restored/'public/build').rglob('*'):
if file.is_file():
assert file.resolve().as_posix().lower().startswith(restored.resolve().as_posix().lower()+'/public/build/');file.unlink()
shutil.copytree(qa/'public/build',restored/'public/build',dirs_exist_ok=True)
record={'sources':{n:sha(qa/n)for n in p['paths']},'build':{f.relative_to(qa/'public/build').as_posix():sha(f)for f in(qa/'public/build').rglob('*')if f.is_file()},'counts':{'sources_including_migration':16,'build_files':162},'post_use_core_contract_unchanged':all(sha(qa/n)==p['candidate'][n]for n in p['retained']),'delta_since_post_use_proof':'Readable labels/unknown summaries in zones.tsx cards only; compatibility build and seven retained components unchanged.'}
assert record['post_use_core_contract_unchanged'];assert len(record['build'])==162
(out/'FROZEN-CANDIDATE.json').write_text(json.dumps(record,indent=2)+'\n','utf-8')
for name in ['BUILD-CANDIDATE-FINAL.log','LINT-CARTOES.log']:
f=out/name;raw=f.read_bytes();f.write_text(raw.decode('utf-16') if raw.startswith(b'\xff\xfe')else raw.decode('utf-8-sig'),'utf-8')
print(json.dumps({'frozen_sources':16,'frozen_build_files':162,'restored_QA_uses_final_candidate':True,'retained_contract_unchanged':True}))