35 lines
1.8 KiB
Python
35 lines
1.8 KiB
Python
"""Freeze the successfully admitted migrated six-file example for native editing."""
|
|
from pathlib import Path
|
|
import hashlib
|
|
import json
|
|
|
|
root = Path(__file__).resolve().parent.parent
|
|
trial = root / '.local/native-qa/navigation-palette-20260913-01'
|
|
migration = trial / 'source-example-migration-r2'
|
|
run_path = trial / 'migrate-example-e124029-r2/run.json'
|
|
run = json.loads(run_path.read_bytes())
|
|
assert run['exit'] == 0 and run['outcome'] == 'passed' and run['inputs_unchanged']
|
|
result = json.loads((migration / 'result.json').read_bytes())
|
|
assert result['status'] == 'PASS' and result['independent_full_project_equal'] and result['current_readmission_exact']
|
|
bundle = json.loads((migration / 'baseline-source-bundle.json').read_bytes())
|
|
assert bundle['entry'] == 'project.arcadia' and len(bundle['files']) == 6
|
|
rows = []
|
|
for role in ('source-baseline', 'source-work'):
|
|
folder = trial / role
|
|
folder.mkdir(exist_ok=False)
|
|
for name, text in bundle['files'].items():
|
|
raw = text.encode('utf-8')
|
|
assert (migration / 'baseline' / name).read_bytes() == raw
|
|
target = folder / name
|
|
assert target.resolve().is_relative_to(folder.resolve())
|
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
with target.open('xb') as stream:
|
|
stream.write(raw)
|
|
rows.append({'path': target.relative_to(trial).as_posix(), 'bytes': len(raw),
|
|
'sha256': hashlib.sha256(raw).hexdigest()})
|
|
with (trial / 'source-example-preparation.json').open('x', encoding='utf-8', newline='\n') as stream:
|
|
stream.write(json.dumps({'scope': 'Copies of actual admitted migration only; no native edits.',
|
|
'run': str(run_path), 'run_sha256': hashlib.sha256(run_path.read_bytes()).hexdigest(),
|
|
'migration': str(migration), 'files': rows}, indent=2) + '\n')
|
|
print(json.dumps({'copied_files': len(rows), 'trial': str(trial)}))
|