Files
Investidor-V2/outputs/investmoz-audit-current-20261012/install-line11-recovery-20261015.py
T
nala c13f250b87
tests / ci (push) Canceled after 0s
versao compilada
2026-10-15 17:37:00 +02:00

16 lines
1.7 KiB
Python

from pathlib import Path
import json,hashlib,shutil,os
out=Path(__file__).resolve().parent;root=out.parents[1];qa=root/'storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742';before=out/'line11-recovery-before-20261015';build=qa/'public/build';prepared=qa/'public/build-line11-recovery-prepared-20261015'
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
for rel,h in json.loads((before/'protected-root-hashes.json').read_text()).items():assert sha(root/rel)==h
assert sha(build/'manifest.json')==sha(before/'manifest.json')
manifest=json.loads((prepared/'manifest.json').read_text());entry=manifest['resources/js/pages/land-assistance/form.tsx']['file'];assert 'Tentar recuperar novamente' in (prepared/entry).read_text(encoding='utf-8')
for p in prepared.rglob('*'):
if not p.is_file() or p.name in ['manifest.json','fonts-manifest.json']:continue
d=build/p.relative_to(prepared)
if d.exists():assert sha(d)==sha(p)
else:d.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(p,d)
pending=build/'manifest.line11-recovery.pending';shutil.copy2(prepared/'manifest.json',pending);os.replace(pending,build/'manifest.json')
receipt={'QA_only':True,'type_check_exit':0,'build_exit':0,'root_hashes_preserved':True,'old_manifest_sha256':sha(before/'manifest.json'),'new_manifest_sha256':sha(build/'manifest.json'),'new_assets_preserve_old':True,'business_data_changes':0,'active_changes':0,'reversal':'Restore QA form.tsx and public/build/manifest.json from line11-recovery-before-20261015; old assets retained','visual_verification':'pending'}
(out/'line11-recovery-install-20261015.json').write_text(json.dumps(receipt,indent=2)+'\n');print('Installed QA recovery and visible diagnostics; root hashes unchanged')