"""Build the frozen certificate eligibility snapshot from judge verdicts. Run this explicitly when the organizers want to refresh ``eligible.json``. The certificate Space itself remains independent of the verdicts dataset. """ import json import urllib.request from collections import defaultdict from pathlib import Path VERDICTS_URL = ( "https://huggingface.co/datasets/ICML-2026-agent-repro/verdicts/" "resolve/main/verdicts.json" ) POINTS = {"verified": 2, "falsified": 2, "toy": 1} def build_eligible(verdicts): records = defaultdict( lambda: { "logbooks": 0, "scored_logbooks": 0, "scored_claims": 0, "points": 0, } ) for space_id, verdict in verdicts.items(): username = space_id.split("/", 1)[0].lower() claim_points = [ POINTS.get(str(claim.get("verdict", "")).lower(), 0) for claim in verdict.get("claims", []) ] rec = records[username] rec["logbooks"] += 1 if any(claim_points): rec["scored_logbooks"] += 1 rec["scored_claims"] += sum(point > 0 for point in claim_points) rec["points"] += sum(claim_points) return { username: rec for username, rec in sorted(records.items()) if rec["points"] > 0 } def main(): with urllib.request.urlopen(VERDICTS_URL) as response: verdicts = json.load(response) destination = Path(__file__).with_name("eligible.json") destination.write_text( json.dumps(build_eligible(verdicts), indent=2) + "\n", encoding="utf-8" ) print(f"Wrote {len(build_eligible(verdicts))} eligible participants to {destination}") if __name__ == "__main__": main()