34 lines
2.5 KiB
Python
34 lines
2.5 KiB
Python
from pathlib import Path
|
|
import json, hashlib, zipfile, datetime
|
|
root=Path(__file__).resolve().parents[2]
|
|
release=root/'outputs/investmoz-fintech-investimento-QA-20261015'
|
|
out=Path(__file__).parent
|
|
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
|
|
r=json.loads((release/'RECIBO-INTEGRIDADE.json').read_text('utf-8'))
|
|
archive=root/'outputs'/r['archive']
|
|
assert sha(archive)==r['archive_sha256'] and archive.stat().st_size==r['archive_bytes']
|
|
with zipfile.ZipFile(archive) as z:
|
|
assert z.testzip() is None
|
|
integrity=json.loads(z.read('INTEGRIDADE-CONTEUDO.json'))
|
|
for n,v in integrity['files'].items():
|
|
b=z.read(n)
|
|
assert hashlib.sha256(b).hexdigest()==v['sha256'] and len(b)==v['bytes'],n
|
|
assert sha(release/n)==v['sha256'],n
|
|
for n,h in r['artifact_hashes'].items(): assert sha(release/n)==h,n
|
|
m=json.loads((release/'MANIFESTO-ENTREGA.json').read_text('utf-8'))
|
|
for s in m['sources']:
|
|
p=root/s['path']
|
|
assert (sha(p) if p.is_file() else None)==s['before_sha256'],s['path']
|
|
assert sha(release/'fontes-candidata'/s['path'])==s['candidate_sha256'],s['path']
|
|
assert sha(root/'public/build/manifest.json')==m['build']['before_manifest_sha256']
|
|
for b in m['build']['files']: assert sha(release/'compilacao/public/build'/b['path'])==b['sha256'],b['path']
|
|
assert not (root/'public/hot').exists()
|
|
assert not (root/'storage/framework/down').exists()
|
|
caches=[str(p.relative_to(root)) for p in (root/'bootstrap/cache').glob('*.php') if p.name=='config.php' or p.name.startswith('routes')]
|
|
assert not caches,caches
|
|
protected=['.env','config/portal.php','config/investor-path.php','config/inertia.php','composer.lock','package-lock.json','bootstrap/app.php']
|
|
record={'at':datetime.datetime.now(datetime.timezone.utc).isoformat(),'candidate':m['candidate'],'authorization':'Tempo: Autorizo a disponibilizar (current conversation)','document_revision':'DOC01','archive_sha256':r['archive_sha256'],'archive_crc':'passed','payload_hashes_verified':len(integrity['files']),'previous_sources_verified':12,'new_paths_absent':4,'candidate_sources':16,'candidate_build_files':len(m['build']['files']),'old_build_manifest_sha256':m['build']['before_manifest_sha256'],'protected_files':{n:sha(root/n) for n in protected},'caches':caches,'active_business_writes':0}
|
|
assert not (out/'PREFLIGHT.json').exists()
|
|
(out/'PREFLIGHT.json').write_text(json.dumps(record,ensure_ascii=False,indent=2)+'\n',encoding='utf-8')
|
|
print(json.dumps({k:v for k,v in record.items() if k!='protected_files'}))
|