31 lines
2.7 KiB
Python
31 lines
2.7 KiB
Python
"""Run authorized normal Cluster maintenance with exact client source and retained baseline."""
|
|
from pathlib import Path
|
|
import hashlib,json,subprocess
|
|
here=Path(__file__).resolve().parent;root=Path('/home/worsch/railiance-cluster')
|
|
packet=here.parent/'netkingdom-target-2026-10-16/cluster-historical-publication-r1/owner-followthrough-r5'
|
|
manifest=json.loads((packet/'manifest.json').read_text())
|
|
for name in ['scripts/consistency_check.py','api/services/historical_projection.py']:
|
|
pin=next(x['candidate_sha256'] for x in manifest['files'] if x['path']==name)
|
|
assert hashlib.sha256((Path('/home/worsch/state-hub')/name).read_bytes()).hexdigest()==pin,'fixed-client-source-drift'
|
|
assert json.loads((here/'receiver-rollout-r4/before-corrected-client.json').read_text())['stage']=='before-corrected-client'
|
|
backup=here/'railiance-cluster-publication-backup';originals=json.loads((backup/'originals.json').read_text())
|
|
def git(*a):return subprocess.check_output(['git','-C',str(root),*a],stderr=subprocess.PIPE)
|
|
for name,index in originals.items():
|
|
assert (root/name).read_bytes()==(backup/(name+'.worktree')).read_bytes()
|
|
assert git('ls-files','--stage','--',name).decode()==index
|
|
try:
|
|
for label,argv,limit in [('corrected-client-cluster-consistency',['statehub','fix-consistency','--repo','railiance-cluster','--json'],300),('corrected-client-cluster-projection',['/home/worsch/repo-manager/.venv/bin/rmgr','sync','--path',str(root),'--push'],180)]:
|
|
r=subprocess.run(argv,cwd=root,capture_output=True,text=True,timeout=limit)
|
|
(here/(label+'.json')).write_text(r.stdout);(here/(label+'.stderr.txt')).write_text(r.stderr)
|
|
assert r.returncode==0,label+'-refused-receipt-retained'
|
|
finally:
|
|
for name,index in originals.items():
|
|
(root/name).write_bytes((backup/(name+'.worktree')).read_bytes())
|
|
mode,oid,stage,path=index.split();assert stage=='0';git('update-index','--cacheinfo',mode,oid,path)
|
|
assert git('ls-files','--stage','--',name).decode()==index
|
|
c=json.loads((here/'corrected-client-cluster-consistency.json').read_text());assert c['summary']['fail']==c['summary']['automation_error']==0
|
|
p=json.loads((here/'corrected-client-cluster-projection.json').read_text());assert p['status']=='applied'
|
|
assert p['commit']==p['receipt']['expected_commit']==p['receipt']['derived_commit']=='c562d7134c38679952a8ffd17a8a893a900aef0d'
|
|
assert p['receipt']['instance_role']=='primary' and p['receipt']['instance_label']=='railiance01'
|
|
assert not p['receipt']['outcome']['refused'] and not p['receipt']['outcome']['retired']
|
|
print(json.dumps({'status':'applied','commit':p['commit'],'fixed_client_source_verified':True,'current_hash_comparison':'pending','original_failed_comparison_retained':True,'unrelated_work_preserved':True}))
|