Files
aigc-home/docs/hel-892/batch175-closure-evidence/history.py
T

50 lines
1.6 KiB
Python

"""Bounded per-thread reads for this whole-delivery evidence ledger."""
import concurrent.futures
import json
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[3]
LOCAL = ROOT / ".local-evidence/batch175-closure"
def fetch(row):
key = row["id"]
path = LOCAL / "threads" / (key + ".json")
error = LOCAL / "threads" / (key + ".stderr.txt")
command = [
"multica",
"issue",
"comment",
"list",
"01a17913-2ff2-725f-93c7-6c9084381c47",
"--thread",
key,
"--tail",
"30",
"--compact",
"--output",
"json",
]
with path.open("xb") as out, error.open("xb") as err:
result = subprocess.run(command, cwd=ROOT, stdout=out, stderr=err)
assert result.returncode == 0, key
return dict(root=key, command=command, returncode=result.returncode)
def main():
(LOCAL / "threads").mkdir()
rows = json.loads((ROOT / ".local-evidence/resume174-check/threads.json").read_bytes())
# Whole ledger needs historical delivery/review references, not unrelated system threads.
relevant = [r for r in rows if r["author_id"] == "4846a27a-ba87-49c9-939d-7275f63efcc7"]
with concurrent.futures.ThreadPoolExecutor(max_workers=6) as pool:
records = list(pool.map(fetch, relevant))
with (LOCAL / "history-reads.json").open("x") as f:
json.dump(records, f, ensure_ascii=False, indent=2)
print("PASS", len(records), "own delivery threads, bounded tail30 each; no other-card reads")
if __name__ == "__main__":
main()