"""Grade only Harbor-collected sidecar evidence in a fresh verifier container.""" import json from pathlib import Path expected = json.loads(Path("/tests/expected.json").read_text()) state = json.loads(Path("/evidence/final.json").read_text()) assert state["collected_from_live_service"] is True, "Missing trusted service export" assert state["scenario_sha256"] == expected["scenario_sha256"], ( "Wrong scenario evidence" ) assert state["max_actions"] == expected["max_actions"], "Wrong budget" assert type(state["won"]) is bool assert 0 <= state["action_count"] <= state["max_actions"] assert state["termination_reason"] != "infrastructure_error", ( "Infrastructure failure is not a puzzle failure" ) assert not state["won"] or state["termination_reason"] == "success" Path("/logs/verifier").mkdir(parents=True, exist_ok=True) Path("/logs/verifier/state.json").write_text(json.dumps(state, indent=2)) Path("/logs/verifier/reward.txt").write_text("1.0\n" if state["won"] else "0.0\n")