File size: 995 Bytes
49aa045
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""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")