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-initial.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-initial.py` 27 lines ยท 2718 bytes Raw Blame History 1 from pathlib import Path 2 import json,os,subprocess,time,sys 3 h=Path.home();root=h/'workspace/hermes-loop-synapse105-L662';out=h/'handoffs/L662-initial-host' 4 if len(sys.argv)>1 and sys.argv[1]=='setup': 5 if root.exists() or out.exists():raise SystemExit('Existing workspace/run: inspect rather than relaunch') 6 root.parent.mkdir(parents=True,exist_ok=True);out.mkdir(parents=True) 7 subprocess.run(['git','clone','--no-checkout','https://github.com/aien-dev/synapse.git',str(root)],check=True) 8 subprocess.run(['git','-C',str(root),'fetch',str(h/'handoffs/L662-synapse105-initial.bundle'),'refs/heads/qualification/105-recovered'],check=True) 9 subprocess.run(['git','-C',str(root),'switch','-c','qualification/105-recovered','FETCH_HEAD'],check=True) 10 print('Prepared owned Linux checkout',root);raise SystemExit(0) 11 sha=subprocess.check_output(['git','-C',str(root),'rev-parse','HEAD'],text=True).strip() 12 assert subprocess.check_output(['git','-C',str(root),'status','--porcelain'],text=True)=='' 13 env=os.environ.copy();env['PATH']=str(h/'.cargo/bin')+':'+str(h/'.local/bin')+':'+env['PATH'];env['TMPDIR']=str(out/'tmp');env['CARGO_TARGET_DIR']=str(h/'workspace/targets/L662'/sha) 14 Path(env['TMPDIR']).mkdir(exist_ok=True) 15 state={'source':sha,'pid':os.getpid(),'started':time.time(),'status':'running','steps':[]};(out/'state.json').write_text(json.dumps(state,indent=2)+'\n') 16 commands=[('tools',['bash','-c','rustc -vV; cargo -V; uname -a']),('full-suite',['cargo','test','--locked','-j','6','--workspace','--no-fail-fast']),('repair',['cargo','test','--locked','-j','6','-p','synapse-store','r1_repair','--','--test-threads=1']),('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'])] 17 for name,cmd in commands: 18 state['current']=name;(out/'state.json').write_text(json.dumps(state,indent=2)+'\n') 19 with (out/(name+'.log')).open('w') as log: 20 actual=['timeout','--signal=TERM','20m',str(h/'.local/bin/quiet-build'),*cmd] if name!='tools' else cmd 21 rc=subprocess.run(actual,cwd=root,env=env,stdout=log,stderr=subprocess.STDOUT).returncode 22 state['steps'].append({'step':name,'command':actual,'exit':rc});(out/'state.json').write_text(json.dumps(state,indent=2)+'\n') 23 if rc: 24 state['status']='failed' if rc!=124 else 'incomplete_timeout';break 25 else:state['status']='passed' 26 state['finished']=time.time();state.pop('current',None);(out/'state.json').write_text(json.dumps(state,indent=2)+'\n');print(json.dumps(state,indent=2)) 27 raise SystemExit(0 if state['status']=='passed' else 1)