#!/usr/bin/env python3 """Offline blinded pairwise usefulness/clarity packets and manual-rating summaries. Development tooling only. No automatic judgments, model calls, or semantic redaction. """ import argparse from datetime import datetime, timezone import json from pathlib import Path import random import sys import uuid BASE = Path(__file__).resolve().parent sys.path.insert(0, str(BASE.parent/"run-sealing")) import summarize_run_outcomes as archived sealing = archived.sealing import build_assessment_packets as packets import analyze_primary_contrast as bootstrap NOTICE = "Development pairwise-preference tooling, not empirical evidence; defaults unfrozen; human judgments only." DIMENSIONS = ("usefulness", "clarity") JUDGMENTS = ("left_win", "tie", "right_win") PUBLIC_ID = ("comparison_id", "task_id", "task_version", "rubric_version", "family_id", "left_artifact_id", "left_sha256", "right_artifact_id", "right_sha256") DIM_FIELDS = ("judgment", "reason", "evidence_locations", "completed_at_utc", "independent_judgments", "resolution_note") INSTRUCTIONS = """# Human pairwise preference: development assets Assess only the two supplied final artifacts and their immutable public task/source packet. Follow packet-index.json order. Record usefulness and clarity separately: usefulness means fitness for the intended task and practical value; clarity means readability, organization, and precision. Neither is the primary requirement score. Use left_win, tie, or right_win. Tie means equivalent preference, not uncertainty; leave a judgment null when it cannot be made. Record reasons and precise artifact or public-packet locations. Do not add requirements or reward method names. Rate independently before consulting any other rating. Lock your form with a UTC timestamp before adjudication. A separate adjudicator reviews both locked forms, records both original judgments and a resolution, and supplies a separate form. All raters see the same orientation of each opaque comparison; order may differ. Do not feed any ratings back to adaptation or include them in planner context. Do not open coordinator keys, condition mappings, prompts, memory, or usage logs. Artifact bytes are unchanged. Opaque IDs cannot remove intrinsic method disclosures in artifact text. Report blinding/packet problems rather than editing artifacts. Directory separation does not enforce confidentiality or prove successful blinding. No judgments are prefilled; all defaults remain unfrozen development choices. """ def read_json(path, label): content = Path(path).read_bytes() return sealing.parse_json(content, label), sealing.sha(content) def integer(value, minimum, label): sealing.require(type(value) is int and value >= minimum, label+": invalid integer") return value def load_design(manifest_path, registry_path=None, _archive_parent=None): manifest_path = Path(manifest_path).resolve() manifest_bytes = manifest_path.read_bytes() manifest, source_hash = sealing.parse_json(manifest_bytes, "pair manifest"), sealing.sha(manifest_bytes) sealing.keys(manifest, ("pair_manifest_version", "study_id", "target_condition_id", "comparator_condition_id", "repetition_ids", "independent_rater_ids", "adjudicator_id", "archives", "pairs"), "pair manifest") sealing.require(manifest["pair_manifest_version"] == "1.0", "incompatible pair manifest version") sealing.text(manifest["study_id"], "study_id") target, control = [sealing.text(manifest[k], k) for k in ("target_condition_id", "comparator_condition_id")] sealing.require(target != control, "conditions must differ") repetitions, raters = manifest["repetition_ids"], manifest["independent_rater_ids"] sealing.strings(repetitions, "repetition IDs") sealing.require(repetitions and len(repetitions) == len(set(repetitions)), "empty/duplicate repetition IDs") sealing.strings(raters, "independent raters") sealing.require(len(raters) == len(set(raters)) == 2, "declare two distinct independent raters") sealing.require(sealing.text(manifest["adjudicator_id"], "adjudicator") not in raters, "adjudicator must be distinct") roots = {} for descriptor in sealing.array(manifest["archives"], "archives"): sealing.keys(descriptor, ("archive_id", "path"), "archive descriptor") aid = sealing.text(descriptor["archive_id"], "archive alias") sealing.require(aid not in roots, "duplicate archive alias") roots[aid] = ((_archive_parent or manifest_path.parent)/sealing.text(descriptor["path"], "archive path")).resolve() collection = archived.summarize_archives(list(roots.values()), registry_path) registry_path = Path(registry_path or sealing.KIT/"task-registry.json").resolve() registry, _ = read_json(registry_path, "registry") tasks, families, _ = sealing.registry_data(registry, registry_path.parent) source_runs, seals = {}, {} for alias, root in roots.items(): packet, _ = read_json(archived.inside(root, "packet-build-manifest.json"), "seal commit") seals[alias] = packet for run in packet["runs"]: source_runs[(alias, run["run_id"])] = run pairs, seen_ids, cells = [], set(), set() for row in sealing.array(manifest["pairs"], "pairs"): sealing.keys(row, ("pair_id", "task_id", "task_version", "rubric_version", "repetition_id", "target", "comparator"), "pair") pid = sealing.text(row["pair_id"], "source pair ID") tid, rep = row["task_id"], row["repetition_id"] sealing.require(tid in tasks and rep in repetitions, "unknown task or undeclared repetition") sealing.require(all(row[k] == tasks[tid][k] for k in ("task_version", "rubric_version")), "incompatible pair task/rubric version") sealing.require(pid not in seen_ids and (tid, rep) not in cells, "duplicate pair or task/repetition cell") seen_ids.add(pid) cells.add((tid, rep)) loaded = dict(source=row, content={}) for role, condition in (("target", target), ("comparator", control)): endpoint = row[role] sealing.keys(endpoint, ("archive_id", "seal_record_id", "run_id", "condition_id", "artifact_id", "sha256"), "pair endpoint") alias, rid = endpoint["archive_id"], endpoint["run_id"] sealing.require((alias, rid) in source_runs, "endpoint is not a sealed designated final artifact") run = source_runs[(alias, rid)] sealing.require(endpoint["seal_record_id"] == seals[alias]["seal_record_id"], "endpoint seal identity mismatch") sealing.require(endpoint["condition_id"] == run["condition_id"] == condition, "endpoint condition identity mismatch") sealing.require(all(run[k] == row[k] for k in ("task_id", "task_version", "rubric_version", "repetition_id")), "paired endpoints must match task, versions, and repetition") final = run["final_artifact"] sealing.require(endpoint["artifact_id"] == final["artifact_id"] and endpoint["sha256"] == final["sha256"], "endpoint artifact identity/hash mismatch") content = packets.hashed_bytes(archived.inside(roots[alias], final["path"]), final["sha256"]) content.decode("utf-8") loaded["content"][role] = content loaded["sealed_at_utc"] = max((seals[row[r]["archive_id"]]["sealed_at_utc"] for r in ("target", "comparator")), key=lambda value: sealing.utc(value, "archive seal time")) pairs.append(loaded) sealing.require(pairs, "declare at least one explicit pair") return dict(manifest=manifest, manifest_hash=source_hash, pairs=sorted(pairs, key=lambda p: p["source"]["pair_id"]), manifest_bytes=manifest_bytes, registry=registry, registry_path=registry_path, tasks=tasks, families=families, archives=collection["archives"]) def blank_rating(comparison): row = {k: comparison[k] for k in PUBLIC_ID} for dimension in DIMENSIONS: row[dimension] = dict(judgment=None, reason=None, evidence_locations=[], completed_at_utc=None, independent_judgments=None, resolution_note=None) return row def build(manifest_path, rater_dir, coordinator_dir, registry_path=None, seed=0): sealing.require(type(seed) is int, "seed must be an integer") rater_dir, coordinator_dir = packets.output_path(rater_dir), packets.output_path(coordinator_dir) sealing.require(packets.disjoint(rater_dir, coordinator_dir), "coordinator and rater destinations must be disjoint") design = load_design(manifest_path, registry_path) for output in (rater_dir, coordinator_dir): sealing.require(all(Path(a["archive"]) not in output.parents and output != Path(a["archive"]) for a in design["archives"]), "outputs must be outside sealed archives") issued = set() def opaque(prefix): value = prefix+"-"+uuid.uuid4().hex sealing.require(value not in issued, "opaque ID collision") issued.add(value) return value raters = {r: opaque("rater") for r in design["manifest"]["independent_rater_ids"]} adjudicator = opaque("rater") rng = random.Random(seed) comparisons = [] artifacts, references = {}, {} for item in design["pairs"]: source = item["source"] tid = source["task_id"] left_role, right_role = ("target", "comparator") if rng.randrange(2) == 0 else ("comparator", "target") row = dict(comparison_id=opaque("comparison"), source_pair_id=source["pair_id"], task_id=tid, task_version=source["task_version"], rubric_version=source["rubric_version"], family_id=design["tasks"][tid]["family_id"], repetition_id=source["repetition_id"], sealed_at_utc=item["sealed_at_utc"]) for side, role in (("left", left_role), ("right", right_role)): aid = opaque("artifact") row.update({side+"_artifact_id": aid, side+"_sha256": source[role]["sha256"], side+"_condition_id": source[role]["condition_id"], side+"_run_id": source[role]["run_id"]}) artifacts[aid] = item["content"][role] comparisons.append(row) asset = design["tasks"][tid]["public_packet"] references[tid] = packets.hashed_bytes(design["registry_path"].parent/asset["path"], asset["sha256"]) key = dict(pair_key_version="1.0", notice=NOTICE, coordinator_only=True, defaults_unfrozen=True, batch_id=opaque("batch"), seed=seed, source_manifest=dict(path="source-manifest.json", sha256=design["manifest_hash"]), registry_signature_sha256=sealing.sha(archived.registry_signature(design["registry"])), independent_rater_aliases=raters, adjudicator_alias=adjudicator, comparisons=comparisons, forms=[]) bundles = [] for kind, assessor in [("independent", r) for r in raters.values()]+[("adjudicated", adjudicator)]: ordered = list(comparisons) rng.shuffle(ordered) form = dict(pair_form_version="1.0", notice=NOTICE, defaults_unfrozen=True, batch_id=key["batch_id"], form_id=opaque("form"), series_kind=kind, assessor_id=assessor, locked_at_utc=None, ratings=[blank_rating(c) for c in ordered]) key["forms"].append(dict(assessor_id=assessor, form_id=form["form_id"], series_kind=kind, comparison_order=[c["comparison_id"] for c in ordered])) index = dict(packet_version="1.0", notice=NOTICE, defaults_unfrozen=True, batch_id=key["batch_id"], assessor_id=assessor, comparisons=[dict({k: c[k] for k in PUBLIC_ID}, left_path="artifacts/"+c["left_artifact_id"]+".txt", right_path="artifacts/"+c["right_artifact_id"]+".txt", public_packet_path="public/"+c["task_id"]+".txt") for c in ordered]) bundles.append((assessor, form, index)) # Validate all inputs before exclusive writes. Only the coordinator key maps # opaque comparison/artifact IDs to source runs and conditions. rater_dir.mkdir() coordinator_dir.mkdir() for assessor, form, index in bundles: root = rater_dir/assessor root.mkdir() packets.write_json(root/"rating-form.json", form) packets.write_json(root/"packet-index.json", index) packets.write_bytes(root/"INSTRUCTIONS.md", INSTRUCTIONS.encode("utf-8")) for aid, content in artifacts.items(): packets.write_bytes(root/"artifacts"/(aid+".txt"), content) for tid, content in references.items(): packets.write_bytes(root/"public"/(tid+".txt"), content) # Record the original manifest parent so relocating its byte-exact copy # does not reinterpret relative caller archive paths. packets.write_bytes(coordinator_dir/"source-manifest.json", design["manifest_bytes"]) packets.write_json(coordinator_dir/"source-location.json", dict(manifest_parent=str(Path(manifest_path).resolve().parent))) packets.write_json(coordinator_dir/"comparison-key.json", key) # Final build record. return dict(notice=NOTICE, defaults_unfrozen=True, comparison_count=len(comparisons), rater_bundle_count=3) def load_key(key_path, registry_path=None): key_path = Path(key_path).resolve() key, key_hash = read_json(key_path, "coordinator key") sealing.keys(key, ("pair_key_version", "notice", "coordinator_only", "defaults_unfrozen", "batch_id", "seed", "source_manifest", "registry_signature_sha256", "independent_rater_aliases", "adjudicator_alias", "comparisons", "forms"), "coordinator key") sealing.require(key["pair_key_version"] == "1.0", "incompatible pair key version") sealing.require(key["notice"] == NOTICE and key["coordinator_only"] is True and key["defaults_unfrozen"] is True, "invalid development/coordinator labels") sealing.text(key["batch_id"], "opaque batch ID") sealing.require(type(key["seed"]) is int, "seed must be integer") sealing.keys(key["source_manifest"], ("path", "sha256"), "source manifest descriptor") sealing.require(key["source_manifest"]["path"] == "source-manifest.json", "unexpected source manifest path") packets.hashed_bytes(key_path.parent/"source-manifest.json", key["source_manifest"]["sha256"]) location, _ = read_json(key_path.parent/"source-location.json", "source location") sealing.keys(location, ("manifest_parent",), "source location") # Revalidate the copied manifest while resolving its declared archive paths # against the original parent; no source-history discovery or temporary files. design = load_design(key_path.parent/"source-manifest.json", registry_path, _archive_parent=Path(sealing.text(location["manifest_parent"], "manifest parent"))) sealing.require(design["manifest_hash"] == key["source_manifest"]["sha256"], "source manifest changed during validation") sealing.require(key["registry_signature_sha256"] == sealing.sha(archived.registry_signature(design["registry"])), "incompatible registry signature") aliases = key["independent_rater_aliases"] sealing.keys(aliases, design["manifest"]["independent_rater_ids"], "rater aliases") for alias in [*aliases.values(), key["adjudicator_alias"]]: sealing.text(alias, "opaque rater alias") sealing.require(len(set([*aliases.values(), key["adjudicator_alias"]])) == 3, "duplicate assessor aliases") sealing.require(len(key["comparisons"]) == len(design["pairs"]), "key comparison coverage mismatch") rng, ids = random.Random(key["seed"]), {key["batch_id"], *aliases.values(), key["adjudicator_alias"]} by_id = {} for row, item in zip(key["comparisons"], design["pairs"]): sealing.keys(row, (*PUBLIC_ID, "source_pair_id", "repetition_id", "sealed_at_utc", "left_condition_id", "right_condition_id", "left_run_id", "right_run_id"), "key comparison") source = item["source"] sealing.require(row["source_pair_id"] == source["pair_id"] and all(row[k] == source[k] for k in ("task_id", "task_version", "rubric_version", "repetition_id")), "key pair identity mismatch") sealing.require(row["family_id"] == design["tasks"][row["task_id"]]["family_id"] and row["sealed_at_utc"] == item["sealed_at_utc"], "key family/seal mismatch") roles = ("target", "comparator") if rng.randrange(2) == 0 else ("comparator", "target") for side, role in zip(("left", "right"), roles): sealing.require(row[side+"_condition_id"] == source[role]["condition_id"] and row[side+"_run_id"] == source[role]["run_id"] and row[side+"_sha256"] == source[role]["sha256"], "key side identity/hash/randomization mismatch") for field in ("comparison_id", "left_artifact_id", "right_artifact_id"): value = sealing.text(row[field], "opaque comparison/artifact ID") sealing.require(value not in ids, "duplicate opaque identity") ids.add(value) by_id[row["comparison_id"]] = row expected_assessors = {r: "independent" for r in aliases.values()} | {key["adjudicator_alias"]: "adjudicated"} forms = {} for form in sealing.array(key["forms"], "key forms"): sealing.keys(form, ("assessor_id", "form_id", "series_kind", "comparison_order"), "key form") assessor = form["assessor_id"] sealing.require(assessor in expected_assessors and assessor not in forms and form["series_kind"] == expected_assessors[assessor], "duplicate/unknown key form") fid = sealing.text(form["form_id"], "opaque form ID") sealing.require(fid not in ids, "duplicate form ID") ids.add(fid) sealing.strings(form["comparison_order"], "comparison order") sealing.require(len(form["comparison_order"]) == len(by_id) and set(form["comparison_order"]) == set(by_id), "key form comparison coverage mismatch") forms[assessor] = form sealing.require(set(forms) == set(expected_assessors), "missing key form") return key, key_hash, design, by_id, forms def load_ratings(paths, key, comparisons, form_specs): series = {assessor: {} for assessor in form_specs} locks, seen, sources = {}, set(), [] now = datetime.now(timezone.utc) for path in paths: form, source_hash = read_json(path, "human pairwise rating form") sealing.keys(form, ("pair_form_version", "notice", "defaults_unfrozen", "batch_id", "form_id", "series_kind", "assessor_id", "locked_at_utc", "ratings"), "rating form") sealing.require(form["pair_form_version"] == "1.0", "incompatible pair form version") assessor = form["assessor_id"] sealing.require(assessor in form_specs and assessor not in seen, "unknown/duplicate rating series") spec = form_specs[assessor] sealing.require(form["batch_id"] == key["batch_id"] and all(form[k] == spec[k] for k in ("form_id", "series_kind")), "form batch/series identity mismatch") sealing.require(form["notice"] == NOTICE and form["defaults_unfrozen"] is True, "retain development form labels") lock = None if form["locked_at_utc"] is None else sealing.utc(form["locked_at_utc"], "form lock time") sealing.require(lock is None or lock <= now, "future form lock") locks[assessor] = lock seen.add(assessor) sources.append(dict(path=str(Path(path).resolve()), sha256=source_hash, assessor_id=assessor, series_kind=form["series_kind"])) for row in sealing.array(form["ratings"], "ratings"): sealing.keys(row, (*PUBLIC_ID, *DIMENSIONS), "pair rating") cid = row["comparison_id"] sealing.require(cid in comparisons and cid not in series[assessor], "unknown/duplicate pair rating") comparison = comparisons[cid] sealing.require(all(row[k] == comparison[k] for k in PUBLIC_ID), "rating pair/artifact identity or hash mismatch") for dimension in DIMENSIONS: value = row[dimension] sealing.keys(value, DIM_FIELDS, "dimension rating") judgment = value["judgment"] sealing.require(judgment is None or judgment in JUDGMENTS, "invalid preference judgment") sealing.strings(value["evidence_locations"], "evidence locations") if judgment is None: sealing.require(value["completed_at_utc"] is None and value["independent_judgments"] is None and value["resolution_note"] is None, "pending judgment marked completed/resolved") sealing.require(value["reason"] is None or isinstance(value["reason"], str), "invalid pending reason") else: sealing.text(value["reason"], "preference reason") sealing.require(value["evidence_locations"], "preference requires evidence locations") stamp = sealing.utc(value["completed_at_utc"], "rating time") sealing.require(lock is not None and sealing.utc(comparison["sealed_at_utc"], "seal time") <= stamp <= lock, "rating must follow sealing and precede form lock") if form["series_kind"] == "independent": sealing.require(value["independent_judgments"] is None and value["resolution_note"] is None, "independent form has adjudication fields") series[assessor][cid] = row adjudicator = key["adjudicator_alias"] raters = list(key["independent_rater_aliases"].values()) for cid, row in series[adjudicator].items(): for dimension in DIMENSIONS: value = row[dimension] if value["judgment"] is None: continue sealing.keys(value["independent_judgments"], raters, "adjudication basis") sealing.text(value["resolution_note"], "resolution note") for rater in raters: independent = series[rater].get(cid, {}).get(dimension) sealing.require(independent is not None and independent["judgment"] is not None, "adjudication requires both independent judgments") sealing.require(value["independent_judgments"][rater] == independent["judgment"], "stale adjudication basis") sealing.require(sealing.utc(value["completed_at_utc"], "adjudication time") >= locks[rater], "adjudication precedes independent lock") return series, sources def oriented(judgment, comparison, target): if judgment is None or judgment == "tie": return judgment winner = comparison[("left" if judgment == "left_win" else "right")+"_condition_id"] return "win" if winner == target else "loss" def dimension_summary(rows, comparisons, design, dimension, replicates, seed): manifest = design["manifest"] target, control = manifest["target_condition_id"], manifest["comparator_condition_id"] counts = dict(win=0, tie=0, loss=0) cells, missing = {}, [] for cid, comparison in comparisons.items(): value = rows.get(cid, {}).get(dimension, {}).get("judgment") result = oriented(value, comparison, target) if result is None: missing.append(cid) else: counts[result] += 1 cells[(comparison["task_id"], comparison["repetition_id"])] = dict(win=1., tie=.5, loss=0.)[result] expected = {(t, rep) for t in design["tasks"] for rep in manifest["repetition_ids"]} paired = {(c["task_id"], c["repetition_id"]) for c in comparisons.values()} absent = sorted(expected-paired) complete = not absent and not missing task_rows, groups = [], {f: [] for f in design["families"]} for family, tasks in sorted(design["families"].items()): for task in sorted(tasks): values = [cells[(task, rep)] for rep in manifest["repetition_ids"] if (task, rep) in cells] value = bootstrap.mean(values) if len(values) == len(manifest["repetition_ids"]) else None task_rows.append(dict(task_id=task, family_id=family, assessed_repetitions=len(values), task_mean=value, repetition_preferences={rep: cells.get((task, rep)) for rep in sorted(manifest["repetition_ids"])})) if value is not None: groups[family].append(value) return dict(expected_pairs=len(expected), supplied_pairs=len(comparisons), assessed_pairs=sum(counts.values()), missing_judgment_comparison_ids=sorted(missing), absent_pair_cells=[dict(task_id=t, repetition_id=r) for t, r in absent], coverage_complete=complete, counts_by_condition={target: counts, control: dict(win=counts["loss"], tie=counts["tie"], loss=counts["win"])}, raw_count_denominator=sum(counts.values()), statistic="target preference probability with half credit for ties: win=1, tie=0.5, loss=0; repetition means within task, equal tasks within family, equal families", task_clusters=task_rows, family_preferences={f: bootstrap.mean(groups[f]) if complete else None for f in sorted(groups)}, preference_estimate=bootstrap.equal_family_mean(groups) if complete else None, confidence_interval_95=bootstrap.bootstrap_interval(groups, replicates, seed) if complete else None) def agreement(left, right, comparisons, dimension): a = {cid: row[dimension]["judgment"] for cid, row in left.items()} b = {cid: row[dimension]["judgment"] for cid, row in right.items()} common = [cid for cid in comparisons if a.get(cid) is not None and b.get(cid) is not None] equal = sum(a[cid] == b[cid] for cid in common) # Common orientation for every rater. return dict(agreeing_pairs=equal, jointly_assessed_pair_denominator=len(common), missing_joint_judgment_pairs=len(comparisons)-len(common), raw_agreement=None if not common else equal/len(common)) def summarize(key_path, form_paths, registry_path=None, replicates=10000, seed=0): integer(replicates, 2, "bootstrap replicates") sealing.require(type(seed) is int, "bootstrap seed must be integer") key, key_hash, design, comparisons, specs = load_key(key_path, registry_path) series, sources = load_ratings(form_paths, key, comparisons, specs) raters = list(key["independent_rater_aliases"].values()) adjudicator = key["adjudicator_alias"] def dimensions(assessor): return {d: dimension_summary(series[assessor], comparisons, design, d, replicates, seed) for d in DIMENSIONS} return dict(pairwise_report_version="1.0", notice=NOTICE, coordinator_only=True, defaults_unfrozen=True, coordinator_key_sha256=key_hash, target_condition_id=design["manifest"]["target_condition_id"], comparator_condition_id=design["manifest"]["comparator_condition_id"], source_pair_manifest_sha256=design["manifest_hash"], registry_signature_sha256=key["registry_signature_sha256"], declared_repetition_ids=design["manifest"]["repetition_ids"], archives=design["archives"], independent={r: dimensions(r) for r in raters}, adjudicated=dimensions(adjudicator), agreement=dict(independent_raters={d: agreement(series[raters[0]], series[raters[1]], comparisons, d) for d in DIMENSIONS}, adjudicated_vs_independent={r: {d: agreement(series[adjudicator], series[r], comparisons, d) for d in DIMENSIONS} for r in raters}), bootstrap=dict(method="seeded 95% percentile; linear q*(B-1); task-clustered, family-stratified", replicates=replicates, seed=seed, unit="whole task retaining both artifacts, all repetitions, and the selected rater series; raters never pooled"), assessment_sources=sources) def main(argv=None): parser = argparse.ArgumentParser(description=__doc__) sub = parser.add_subparsers(dest="command", required=True) build_parser = sub.add_parser("build") build_parser.add_argument("--manifest", type=Path, required=True) build_parser.add_argument("--rater-output", type=Path, required=True) build_parser.add_argument("--coordinator-output", type=Path, required=True) summary_parser = sub.add_parser("summarize") summary_parser.add_argument("--key", type=Path, required=True) summary_parser.add_argument("--forms", type=Path, nargs="*", default=[]) summary_parser.add_argument("--replicates", type=int, default=10000) for child in (build_parser, summary_parser): child.add_argument("--registry", type=Path) child.add_argument("--seed", type=int, default=0) args = parser.parse_args(argv) try: result = (build(args.manifest, args.rater_output, args.coordinator_output, args.registry, args.seed) if args.command == "build" else summarize(args.key, args.forms, args.registry, args.replicates, args.seed)) except (sealing.ValidationError, sealing.account_resources.LedgerError, OSError, KeyError, TypeError, ValueError, ArithmeticError) as exc: print(json.dumps(dict(error=str(exc), notice=NOTICE)), file=sys.stderr) return 2 print(json.dumps(result, indent=2, allow_nan=False)) return 0 if __name__ == "__main__": sys.exit(main())