Files
Investidor-V2/outputs/investmoz-parques-L1-ativacao-20261018/prepare-final.py
T
nala 6bc0cc6f52
tests / ci (push) Canceled after 0s
versao nrgocios 3
2026-10-18 11:17:35 +02:00

21 lines
2.1 KiB
Python

from pathlib import Path
out=Path(__file__).resolve().parent
s=(out.parent/'investmoz-parques-ativacao-20261016/verify-preservation.php').read_text('utf-8')
s=s.replace('2026_10_16_130000_add_investment_zone_editorial_draft','2026_10_16_140000_add_investment_zone_operational_details').replace("column_name='editorial_draft'","column_name='operational_details'").replace("'data_type'=>'text'","'data_type'=>'jsonb'").replace('WHERE editorial_draft IS NOT NULL','WHERE operational_details IS NOT NULL')
s=s.replace('investment-zone-profile-installation','investment-zone-details-installation').replace('outputs/investmoz-parques-QA-20261016/para-revisao/MANIFESTO-CANDIDATA.json','outputs/investmoz-parques-L1-QA-20261016/para-revisao/MANIFESTO-ENTREGA.json').replace("$root.'/outputs/investmoz-parques-QA-20261016/ATIVO-ANTES.json'","__DIR__.'/ATIVO-ANTES.json'").replace("$m['build']","$m['candidate_build']").replace("'candidate_application_verified'=>16","'candidate_application_verified'=>12")
# Login activity is inspected field by field; never exclude account permissions from comparison.
needle=" $events=$a->query"
pos=s.index(needle)
s=s[:pos]+''' $userChanges=[];
$oldUsers=$q->query('SELECT * FROM users ORDER BY id')->fetchAll(PDO::FETCH_ASSOC);
$newUsers=$a->query('SELECT * FROM users ORDER BY id')->fetchAll(PDO::FETCH_ASSOC);
if(count($oldUsers)!==count($newUsers))throw new RuntimeException('User set changed');
foreach($oldUsers as $i=>$u){foreach($u as $field=>$v){if($v!==$newUsers[$i][$field])$userChanges[$field]=true;}}
$allowed=['last_login_at','last_login_ip','updated_at','two_factor_confirmed_at','remember_token'];
if(array_diff(array_keys($userChanges),$allowed))throw new RuntimeException('Unexpected account field change: '.implode(',',array_keys($userChanges)));
$diff=array_values(array_filter($diff,fn($n)=>$n!=='"public"."users"'));
''' +s[pos:]
s=s.replace("'technical_table_differences'=>$technicalDiff", "'account_login_fields_changed'=>array_keys($userChanges),'technical_table_differences'=>$technicalDiff")
(out/'verify-preservation.php').write_text(s,'utf-8')
print('Read-only L1 preservation check prepared')