"""Harbor entry point. Keep evaluation errors distinct from candidate failures.""" import json import os from pathlib import Path from penrose_score import VERSION, evaluate def test_rubric(): log = Path(os.environ.get("T35_LOG_DIR", "/logs/verifier")) log.mkdir(parents=True, exist_ok=True) (log / "reward.txt").unlink(missing_ok=True) (log / "evaluation-error.json").unlink(missing_ok=True) try: result = evaluate( os.environ.get("T35_FINAL", "/root/Desktop/final.mp4"), os.environ.get("T35_PNG", "/root/edit/penrose.png"), os.environ.get("T35_EDIT", "/root/edit"), os.environ.get("T35_TERMINAL_LOG", "/logs/artifacts/terminal-attempts.log"), ) except Exception as err: (log / "evaluation-error.json").write_text( json.dumps({"rubric_version": VERSION, "evaluation_error": str(err), "reward": None}, indent=2) + "\n") raise (log / "score-report.json").write_text(json.dumps(result, indent=2, allow_nan=False) + "\n") (log / "reward.txt").write_text("%.6f\n" % result["reward"]) for c in result["checks"]: print("%-32s %.4f / %.4f" % (c["id"], c["earned"], c["weight"])) if result.get("reference_svg_imported"): print("GATE: reference SVG was opened in GIMP -> all drawing credit forfeited") print(" hits: %s" % result["reference_svg_import_hits"]) if result.get("terminal_attempts"): print("GATE: terminal attempts logged -> reward 0") for line in result["terminal_attempts"]: print(" %s" % line) print("Fractional reward:", result["reward"]) assert 0 <= result["reward"] <= 1