Integrate reviewed full action pack admission and bounded idle scheduling
This commit is contained in:
@@ -35,7 +35,7 @@ with tempfile.TemporaryDirectory(prefix='voice-gateway-stage-') as folder:
|
||||
for name,content in bundle.items():
|
||||
path=stage/name;path.parent.mkdir(parents=True,exist_ok=True);path.write_bytes(base64.b64decode(content))
|
||||
test_start=time.perf_counter()
|
||||
result=subprocess.run([sys.executable,str(stage/'scripts/check-archive.py'),'--vad-model',str(root/'models/silero_vad.onnx')],cwd=stage,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,timeout=120,env={**os.environ,'PYTHONDONTWRITEBYTECODE':'1'})
|
||||
result=subprocess.run([sys.executable,str(stage/'scripts/check-archive.py')],cwd=stage,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,timeout=120,env={**os.environ,'PYTHONDONTWRITEBYTECODE':'1'})
|
||||
summary={'status':'tests_passed' if result.returncode==0 else 'tests_failed','test_output':result.stdout.decode(errors='replace'),'test_elapsed_ms':round((time.perf_counter()-test_start)*1000,2),'applied':False,'expected_hashes':original,
|
||||
'candidate_source_hashes':{name:hashlib.sha256((stage/name).read_bytes()).hexdigest() for name in deploy_files}}
|
||||
if result.returncode: print(json.dumps(summary));raise SystemExit(1)
|
||||
@@ -45,7 +45,7 @@ with tempfile.TemporaryDirectory(prefix='voice-gateway-stage-') as folder:
|
||||
if health().get('busy'):raise RuntimeError('gateway_busy_after_tests_no_restart')
|
||||
backup=root/'.runtime/backups'/time.strftime('voice-gateway-%Y%m%d-%H%M%S');backup.mkdir(parents=True,mode=0o700)
|
||||
# Save all actual runtime Python sources/tests, modes, plus unit/env privately. No logs/history/audio copied.
|
||||
for path in list(root.glob('*.py'))+list((root/'tests').glob('*.py'))+list((root/'personas').glob('*.json')):
|
||||
for path in list(root.glob('*.py'))+list((root/'tests').glob('*.py'))+list((root/'personas').glob('*.json'))+list(root.glob('reviewed_action_packs.json')):
|
||||
dst=backup/path.relative_to(root);dst.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(path,dst)
|
||||
for i,path in enumerate(private_files):
|
||||
dst=backup/'private'/str(i);dst.parent.mkdir(parents=True,exist_ok=True,mode=0o700);shutil.copy2(path,dst)
|
||||
@@ -86,9 +86,9 @@ def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--apply',action='store_true');args=parser.parse_args()
|
||||
source=root/'gateway';manifest=json.loads((source/'SOURCE_MANIFEST.json').read_text())
|
||||
baseline=manifest.get('deployment_baseline',manifest['provider_baseline'])['files']
|
||||
files=sorted(set(baseline)|{p.relative_to(source).as_posix() for p in source.glob('*.py')}|{p.relative_to(source).as_posix() for p in (source/'tests').glob('*.py')})
|
||||
files=sorted(set(baseline)|{p.relative_to(source).as_posix() for p in source.glob('*.py')}|{p.relative_to(source).as_posix() for p in (source/'tests').glob('*.py')}|{'reviewed_action_packs.json'})
|
||||
public_personas={'personas/lvbu.lorebook.json','personas/yangmi.lorebook.json'}
|
||||
assert all((n.endswith('.py') or n in public_personas) and not Path(n).is_absolute() and '..' not in Path(n).parts for n in files)
|
||||
assert all((n.endswith('.py') or n in public_personas or n=='reviewed_action_packs.json') and not Path(n).is_absolute() and '..' not in Path(n).parts for n in files)
|
||||
expected={name:baseline.get(name) for name in files}
|
||||
record=root/'logs/voice-investigation/gateway-emotion-deploy.json'
|
||||
# SOURCE_MANIFEST is the reviewed expected live baseline. Old ignored records
|
||||
|
||||
Reference in New Issue
Block a user