from pathlib import Path import json,hashlib,shutil out=Path(__file__).resolve().parent;private=Path('C:/Users/macbook/.config/investmoz/parques-QA-20261016');qa=private/'source' sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest();plan=json.loads((out/'COMPATIBILITY-PREPARED.json').read_text('utf-8'));reverse=json.loads((out/'REVERSAO-APLICADA-QA.json').read_text('utf-8')) for n in plan['paths']: assert (qa/n).resolve().as_posix().lower().startswith(qa.resolve().as_posix().lower()+'/');shutil.copy2(private/'candidate-sources'/n,qa/n);assert sha(qa/n)==plan['candidate'][n] for file in (qa/'public/build').rglob('*'): if file.is_file(): relative=file.relative_to(qa/'public/build').as_posix();assert sha(file)==reverse['compatibility_files'][relative];file.unlink() shutil.copytree(private/'candidate-final-build',qa/'public/build',dirs_exist_ok=True) print(json.dumps({'candidate_sources_restored':16,'QA_data_preserved':True,'active_changes':0}))