Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/synapse/blob/main/evidence/REPAIR-RECOVERY-L662/run-postfix.py # synapse A component of the AienOS ecosystem. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `synapse / evidence / REPAIR-RECOVERY-L662 / run-postfix.py` 20 lines ยท 2566 bytes Raw Blame History 1 from pathlib import Path 2 import os,json,subprocess,hashlib,time 3 h=Path.home();root=h/'workspace/hermes-loop-synapse105-L662';out=h/'handoffs/L662-postfix-host' 4 assert json.loads((h/'handoffs/L662-behavioral-red/state.json').read_text())['complete'] 5 expected=['crates/synapse-store/src/blockdev.rs','crates/synapse-store/src/blockdev/repair.rs','crates/synapse-store/src/blockdev_tests.rs'] 6 dirty=subprocess.check_output(['git','-C',str(root),'diff','--name-only'],text=True).splitlines() 7 assert dirty==['crates/synapse-store/src/blockdev_tests.rs'],dirty 8 out.mkdir(exist_ok=False) 9 for relative,name in zip(expected,['L662-green-blockdev.rs','L662-green-repair.rs','L662-green-tests.rs']):(root/relative).write_bytes((h/'handoffs'/name).read_bytes()) 10 head=subprocess.check_output(['git','-C',str(root),'rev-parse','HEAD'],text=True).strip() 11 env=os.environ.copy();env['PATH']=str(h/'.cargo/bin')+':'+str(h/'.local/bin')+':'+env['PATH'];env['TMPDIR']=str(out/'tmp');Path(env['TMPDIR']).mkdir();env['CARGO_TARGET_DIR']=str(h/'workspace/targets/L662'/head) 12 state={'base_carry':head,'source_inputs':{f:hashlib.sha256((root/f).read_bytes()).hexdigest() for f in expected},'pid':os.getpid(),'started':time.time(),'status':'running','steps':[]} 13 commands=[('focused-green',['cargo','test','--locked','-j','6','-p','synapse-store','r1_repair','--','--test-threads=1']),('full-suite',['cargo','test','--locked','-j','6','--workspace','--no-fail-fast']),('repair-cli',['cargo','test','--locked','-j','6','-p','synapse-bench','--test','store_repair_cli']),('fmt',['cargo','fmt','--all','--check']),('clippy',['cargo','clippy','--locked','-j','6','--workspace','--all-targets','--','-D','warnings'])] 14 for name,cmd in commands: 15 state['current']=name;(out/'state.json').write_text(json.dumps(state,indent=2)+'\n');actual=['timeout','--signal=TERM','20m',str(h/'.local/bin/quiet-build'),*cmd] 16 with (out/(name+'.log')).open('w') as f:rc=subprocess.run(actual,cwd=root,env=env,stdout=f,stderr=subprocess.STDOUT).returncode 17 state['steps'].append({'step':name,'command':actual,'exit':rc});(out/'state.json').write_text(json.dumps(state,indent=2)+'\n') 18 if rc:state['status']='failed' if rc!=124 else 'incomplete_timeout';break 19 else:state['status']='passed' 20 state['finished']=time.time();state.pop('current',None);assert all(hashlib.sha256((root/f).read_bytes()).hexdigest()==s for f,s in state['source_inputs'].items());(out/'state.json').write_text(json.dumps(state,indent=2)+'\n');print(json.dumps(state,indent=2));raise SystemExit(0 if state['status']=='passed' else 1)