40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
import json, re, sys
|
|
|
|
SEED = "/root/troupe-standup/inbox/seed-2026-09-26.json"
|
|
REPORT = "/root/.hermes/wizard-outputs/sol/inbox-triage-2026-10-20.md"
|
|
|
|
def expected(p):
|
|
e = (p.get("evidence") or "") + " " + (p.get("proposed_action") or "")
|
|
if "push" in e or "pull request" in (p.get("proposed_action") or "").lower():
|
|
return "push-branch"
|
|
if "audio under checksum" in e or "unreleased audio" in e or "Q9" in e:
|
|
return "audio-qc"
|
|
if "Trial by Timmy" in e:
|
|
return "authorize-trial"
|
|
return "publish-correction"
|
|
|
|
def main():
|
|
seed = json.load(open(SEED, encoding="utf-8"))
|
|
pending = seed["pending"]
|
|
want = {p["id"] for p in pending}
|
|
text = open(REPORT, encoding="utf-8").read()
|
|
ids = [int(x) for x in re.findall(r"id=(\d+)", text)]
|
|
cats = re.findall(r"category=([a-z-]+)", text)
|
|
if len(ids) != len(pending):
|
|
print("CHECK FAIL: %d rows, want %d" % (len(ids), len(pending)))
|
|
return 1
|
|
got = dict(zip(ids, cats))
|
|
if set(got) != want:
|
|
print("CHECK FAIL: ids %s" % sorted(got))
|
|
return 1
|
|
for p in pending:
|
|
i = p["id"]
|
|
if got[i] != expected(p):
|
|
print("CHECK FAIL: id %d got %r want %r" % (i, got[i], expected(p)))
|
|
return 1
|
|
print("CHECK OK: %d pending escalations classified; all match source evidence" % len(pending))
|
|
return 0
|
|
|
|
sys.exit(main())
|