Unclaimed files left in the canonical checkout. Inventory: canonical-cleanup-inventory.md (commit-as-evidence groups). detect-secrets scan clean on 2026-11-02: hits are sha256 pins, git object ids, test sentinels already in tracked tests and unit-file lines.
22 lines
1.2 KiB
Python
22 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Run shell suites from a detached worktree, capture every exit."""
|
|
import pathlib, subprocess, json, datetime, sys, os
|
|
root=pathlib.Path.cwd()
|
|
if root == pathlib.Path('/mnt/storage/src/mosaic-stack'):
|
|
raise SystemExit('gate refuses canonical checkout')
|
|
if subprocess.check_output(['git','branch','--show-current'],text=True).strip():
|
|
raise SystemExit('gate requires detached HEAD')
|
|
if os.environ.get('DOCKER_HOST') != 'unix:///nonexistent.sock':
|
|
raise SystemExit('decision 127 requires DOCKER_HOST=unix:///nonexistent.sock')
|
|
out=pathlib.Path(sys.argv[1]); out.mkdir(parents=True,exist_ok=True)
|
|
results=[]
|
|
for suite in sorted(root.glob('scripts/test-*.sh')):
|
|
began=datetime.datetime.now(datetime.timezone.utc).isoformat()
|
|
with (out/(suite.stem+'.txt')).open('w') as log:
|
|
p=subprocess.run(['bash',str(suite)],cwd=root,stdout=log,stderr=subprocess.STDOUT,timeout=600)
|
|
row={'suite':str(suite.relative_to(root)),'exit':p.returncode,'began':began,'ended':datetime.datetime.now(datetime.timezone.utc).isoformat()}
|
|
results.append(row)
|
|
(out/'shell-results.json').write_text(json.dumps(results,indent=2)+'\n')
|
|
print(json.dumps(row),flush=True)
|
|
sys.exit(any(r['exit'] for r in results))
|