Files
Investidor-V2/outputs/investmoz-staff-preparation-20261012/verify-fixed-delta.py
T
nala 287e991486
tests / ci (push) Waiting to run
oportunidades 7
2026-10-13 11:40:29 +02:00

31 lines
2.4 KiB
Python

import hashlib
import json
import zipfile
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
OUT = ROOT / 'outputs/investmoz-staff-preparation-20261012'
receipt = json.loads((OUT / 'delta-contacto-link.json').read_text())
folder = Path(receipt['folder'])
manifest = json.loads((folder / 'manifesto.json').read_text())
backup = json.loads((ROOT / 'storage/app/private/investmoz-v2/portal-audit/internal-designation-target-backup.json').read_text())
sha = lambda path: hashlib.sha256(path.read_bytes()).hexdigest()
assert sha(folder / 'manifesto.json') == receipt['manifest_sha256']
archive = folder / ('delta-' + receipt['revision'] + '.zip')
assert sha(archive) == receipt['zip_sha256']
assert backup['restore_verified'] and backup['files_verified'] and backup['target']['database'] == 'investemoz' and backup['target']['port'] == 5432 and backup['restored_target']['port'] == 55441
with zipfile.ZipFile(archive) as stream:
for item in manifest['files']:
current = ROOT / item['path']
assert (sha(current) if current.exists() else None) == item['before_sha256']
if current.exists():
assert backup['active_files_manifest']['active-code/' + item['path']] == item['before_sha256']
assert hashlib.sha256(stream.read(item['path'])).hexdigest() == item['after_sha256']
for item in manifest['build']:
assert hashlib.sha256(stream.read(item['path'])).hexdigest() == item['sha256']
readiness = json.loads((OUT / 'readiness-current.json').read_text())
assert readiness['flags']['organization_country_enabled'] and not readiness['flags']['profile_access_enabled'] and not readiness['flags']['notifications_enabled']
assert not readiness['queue'] and readiness['failed_jobs'] == 0 and readiness['scanner']['available']
proof = {'result': 'passed', 'revision': receipt['revision'], 'target': 'investemoz:5432', 'pre_change_backup_code_revision': '2876cdfa900a', 'restore_verified': True, 'all_previous_source_files_in_verified_backup': True, 'all_payload_hashes_verified': True, 'active_code_unchanged': True, 'schema_and_services_changed': False, 'backup_is_pre_change_not_a_claim_of_candidate_restore': True, 'ready_for_activation': False, 'remaining': ['visual proof of new contact form and affected session gate', 'final immediate recheck of target/backup/queue before authorized activation']}
(OUT / 'fixed-delta-backup-correspondence.json').write_text(json.dumps(proof, indent=2), encoding='utf-8')
print(json.dumps(proof))