24 lines
1.8 KiB
Python
24 lines
1.8 KiB
Python
from pathlib import Path
|
|
import subprocess,hashlib,json,datetime
|
|
ROOT=Path('/home/worsch/the-custodian/docs/changes/netkingdom-target-2026-10-16/protected-execution-trusted-successor')
|
|
REPO=Path('/home/worsch/railiance-platform')
|
|
manifest=json.loads((ROOT/'budget-source-manifest-r1.json').read_text())
|
|
patch=ROOT/'budget-source-slice-r1.patch'
|
|
assert hashlib.sha256(patch.read_bytes()).hexdigest()==manifest['patch_sha256']
|
|
base=subprocess.check_output(['git','rev-parse','HEAD'],cwd=REPO,text=True).strip()
|
|
assert base==manifest['canonical_base_full'], 'canonical HEAD changed; re-review before mutation'
|
|
for name,expected in manifest['files'].items():
|
|
path=REPO/name
|
|
actual=hashlib.sha256(path.read_bytes()).hexdigest() if path.exists() else None
|
|
assert actual==expected['before_sha256'], name
|
|
subprocess.run(['git','apply','--check',str(patch)],cwd=REPO,check=True)
|
|
subprocess.run(['git','apply',str(patch)],cwd=REPO,check=True)
|
|
files={}
|
|
for name,expected in manifest['files'].items():
|
|
digest=hashlib.sha256((REPO/name).read_bytes()).hexdigest()
|
|
assert digest==expected['after_sha256'], name
|
|
files[name]='sha256:'+digest
|
|
subprocess.run(['git','diff','--check','--',*files],cwd=REPO,check=True)
|
|
receipt={'repo':'railiance-platform','base_commit':base,'patch_sha256':'sha256:'+manifest['patch_sha256'],'integrated_at':datetime.datetime.now(datetime.timezone.utc).isoformat(),'files_sha256':files,'source_integrated':True,'committed':False,'published':False,'native_accepted':False,'review_scope':'fixed Unix native fixture budget and exact v2 source byte guard; full provider/native proof pending'}
|
|
(ROOT/'canonical-integration.json').write_text(json.dumps(receipt,indent=2)+'\n')
|
|
print('Integrated five exact source files; unrelated WORK-RECORDS preserved. Commit/publication pending.')
|