INNER CODE UNIT · Python
summarize
Fausto-404/js-reverse-automation--skill · js-reverse-automation/scripts/adversarial_diff.py:24
def summarize(items: list[dict]) -> dict:
types = Counter(str(item.get("type", "unknown")) for item in items)
paths = Counter(str(item.get("path")) for item in items if item.get("path"))
return {
"events": len(items),
"types": dict(sorted(types.items())),
"paths": dict(sorted(paths.items())),
"requests": sum(count for name, count in types.items() if name.startswith("network.")),
"errors": sum(count for name, count in types.items() if "error" in name or "reject" in name),
"interventions": sum(count for name, count in types.items() if name.startswith("intervention.")),
}
def main() -> int:
parser = argparse.ArgumentParser(description="Compare JSRA adversarial probe exports.")
parser.add_argument("--baseline", required=True)
parser.add_argument("--patched", required=True)
parser.add_argument("--output", required=True)