Files
Investidor-V2/outputs/investmoz-negocios-classificacao-ativacao-20261016/prepare-name-execution.py
T
nala 6a76aac80f
tests / ci (push) Canceled after 0s
versao compilada 1
2026-10-16 09:17:28 +02:00

25 lines
3.1 KiB
Python

from pathlib import Path
import hashlib,json,datetime
root=Path(__file__).resolve().parents[2];out=Path(__file__).resolve().parent
release=root/'outputs/investmoz-negocios-classificacao-QA-20261016'
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
m=json.loads((release/'MANIFESTO.json').read_text('utf-8'));p=json.loads((out/'COMPILACAO-NOME-QA.json').read_text('utf-8'))
assert not (out/'AUTORIZACAO-EXTENSAO-NOME.json').exists()
for s in m['sources']:assert sha(root/s['path'])==s['after_sha256']
for s in m['build']:assert sha(root/s['path'])==s['sha256']
auth={'at':datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=2))).isoformat(),'candidate':p['candidate'],'message':'Autorizar o suplemento de compilação','scope':'Only the reviewed 161-file compiled VITE_APP_NAME correction, zero application-source/config changes, with fresh backup/restore and build-only reversal. No business writes, grants or functional acceptance repeated.','proposal_sha256':'77ccb12fa5078ef60cd8b0c9498e38d4bab05d7666331866776cad836a97afa0','zip_sha256':'0670a7a6ab3077e22cfbdb977d9a076feeadf4e15409a1171c3e847b86009635'}
(out/'AUTORIZACAO-EXTENSAO-NOME.json').write_text(json.dumps(auth,ensure_ascii=False,indent=2)+'\n','utf-8')
current=dict(m);current['candidate']=p['candidate'];current['sources']=[dict(s,before_sha256=s['after_sha256']) for s in m['sources']]
(out/'MANIFESTO-CURRENT.json').write_text(json.dumps(current,indent=2)+'\n','utf-8')
prior=json.loads((release/'ATIVO-ANTES.json').read_text('utf-8'));files={n:sha(root/n) for n in prior['files'] if not n.startswith('public/build/')}
files.update({s['path']:s['after_sha256'] for s in m['sources']});files.update({s['path']:s['sha256'] for s in m['build']})
(out/'ATIVO-CURRENT.json').write_text(json.dumps({'files':files,'protected':prior['protected']},indent=2)+'\n','utf-8')
backup=(out/'fresh-backup.php').read_text('utf-8').replace('investmoz-negocios-classificacao-QA-20261016','investmoz-negocios-classificacao-ativacao-20261016').replace('MANIFESTO.json','MANIFESTO-CURRENT.json').replace('ATIVO-ANTES.json','ATIVO-CURRENT.json').replace('negocios-before-','negocios-nome-before-').replace('negocios_before_','negocios_nome_before_').replace('FRESH-BACKUP.json','FRESH-BACKUP-NOME.json')
(out/'fresh-backup-name.php').write_text(backup,'utf-8')
boot=(out/'boot-restored-clone.php').read_text('utf-8').replace('FRESH-BACKUP.json','FRESH-BACKUP-NOME.json').replace('negocios-classificacao-QA-53311df2f59c',p['candidate']).replace('negocios_before_','negocios_nome_before_').replace('ARRANQUE-CLONE-RESTAURADO.json','ARRANQUE-CLONE-NOME.json')
(out/'boot-restored-name.php').write_text(boot,'utf-8')
deliver=(out/'deliver-name.py').read_text('utf-8').replace("out/'FRESH-BACKUP.json'","out/'FRESH-BACKUP-NOME.json'")
deliver=deliver.replace("assert b['restore_verified']", "assert json.loads((out/'ARRANQUE-CLONE-NOME.json').read_text('utf-8'))['kernel_bootstrap']=='passed'\nassert b['restore_verified']")
(out/'deliver-name.py').write_text(deliver,'utf-8')
print(json.dumps({'candidate':p['candidate'],'source_changes':0,'fresh_current_backup_prepared':True}))