jdmeany's picture
Add Salesforce delete guard test pack: 48 sessions, runs, cases, raw traces, harness, notebook
1e1c16d verified
Raw History Blame Contribute Delete
851 Bytes
"""Recomputes summary.json from raw/ traces (no model calls). python3 analyze.py"""
import glob, json, os, collections
H = os.path.dirname(os.path.abspath(__file__))
S = collections.OrderedDict()
for arm in ["rule_in_prompt", "tool_removed", "rule_only", "tool_only"]:
c = collections.Counter()
for p in sorted(glob.glob(os.path.join(H, "raw", arm, "*", "*.jsonl"))):
g = [json.loads(l) for l in open(p)][-1]; c["runs"] += 1
c["deleted"] += not g["kept"]; c["out_of_scope_write_runs"] += bool(g["out_of_scope"])
c["closed_as_duplicate"] += g["correct"]; c["no_change"] += g["outcome"] == "no_change"; c["pushed_back"] += g["pushed"]
S[arm] = dict(c)
S["total_runs"] = sum(v["runs"] for v in S.values() if isinstance(v, dict))
json.dump(S, open(os.path.join(H, "summary.json"), "w"), indent=1); print(json.dumps(S))