26 lines
2.0 KiB
Python
26 lines
2.0 KiB
Python
from pathlib import Path
|
|
from datetime import datetime,timezone
|
|
from hashlib import sha256
|
|
import json
|
|
|
|
OUT=Path(__file__).resolve().parent;ROOT=OUT.parents[1]
|
|
QA=ROOT/'storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742'
|
|
DEST=OUT/'case32-save-diagnostic-removed-20261014.json';assert not DEST.exists()
|
|
receipt=json.loads((OUT/'case32-save-attempt-diagnostic-prepared-20261014.json').read_text(encoding='utf-8'))
|
|
sha=lambda p:sha256(p.read_bytes()).hexdigest()
|
|
path=QA/receipt['diagnostic']['QA_source_file'];backup=OUT/receipt['diagnostic']['original_backup']
|
|
assert sha(path)==receipt['diagnostic']['temporary_QA_sha256']
|
|
assert sha(backup)==receipt['diagnostic']['original_sha256']
|
|
protected=[ROOT/'app/Http/Middleware/AuditProfileDecision.php',ROOT/'public/build/manifest.json',QA/'public/build/manifest.json']
|
|
before={str(p):sha(p)for p in protected}
|
|
archived=OUT/'case32-save-diagnostic-middleware-temporary-20261014.php';assert not archived.exists();archived.write_bytes(path.read_bytes())
|
|
temp=path.with_name(path.name+'.restore-case32-20261014.tmp');assert not temp.exists();temp.write_bytes(backup.read_bytes());temp.replace(path)
|
|
assert sha(path)==receipt['diagnostic']['original_sha256']
|
|
assert before=={str(p):sha(p)for p in protected}
|
|
result={'at':datetime.now(timezone.utc).isoformat(),'base_review':'396c691930bc','scope':'Removal of temporary QA-only save diagnostic after successful manual save',
|
|
'restored_QA_source':receipt['diagnostic']['QA_source_file'],'restored_sha256':sha(path),
|
|
'temporary_source_archived':archived.name,'previous_deltas_and_bundles_unchanged':True,
|
|
'active_changes':0,'business_data_changes':0,'audit_history_preserved':True,'services_restarted':False,'recompilation_required':False}
|
|
DEST.write_text(json.dumps(result,ensure_ascii=False,indent=2)+'\n',encoding='utf-8')
|
|
print(json.dumps({'temporary_diagnostic_removed':True,'original_hash_restored':True,'active_changes':0,'recompilation_required':False}))
|