docs: explain conditional AIO return handling and minimal target review plan
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
"""Exclusive foreground batch178 logs; no background work or cross-batch glob."""
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[3]
|
||||
LOCAL = ROOT / ".local-evidence/batch178-aio-protocol"
|
||||
|
||||
|
||||
def main():
|
||||
key, *command = sys.argv[1:]
|
||||
assert key.replace("-", "").isalnum() and command
|
||||
paths = [LOCAL / "logs" / f"batch178-aio-protocol-{key}.{s}.txt" for s in ("stdout", "stderr")]
|
||||
record = LOCAL / "records" / (key + ".json")
|
||||
assert not record.exists() and not any(p.exists() for p in paths)
|
||||
with paths[0].open("xb") as stdout, paths[1].open("xb") as stderr:
|
||||
result = subprocess.run(command, cwd=ROOT, stdout=stdout, stderr=stderr)
|
||||
with record.open("x") as f:
|
||||
json.dump(
|
||||
dict(
|
||||
key=key,
|
||||
command=command,
|
||||
cwd="repository root",
|
||||
returncode=result.returncode,
|
||||
logs=[
|
||||
dict(
|
||||
path=str(p.relative_to(ROOT)),
|
||||
bytes=p.stat().st_size,
|
||||
sha256=hashlib.sha256(p.read_bytes()).hexdigest(),
|
||||
)
|
||||
for p in paths
|
||||
],
|
||||
),
|
||||
f,
|
||||
ensure_ascii=False,
|
||||
indent=2,
|
||||
)
|
||||
f.write("\n")
|
||||
print(key, "exit", result.returncode)
|
||||
raise SystemExit(result.returncode)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user