from dashboard import view
def test_live_view_distinguishes_rollouts_from_updates_and_escapes_code():
ep = {"task_id": "task-a", "step": 0, "completions": [""],
"turns": [{"stage": "timed", "correct": True, "speedup": 0.8, "reward": 0.3}]}
snap = {"manifest": {"steps": 16, "groups": {"training_tasks": ["task-a"], "official_heldout": ["task-b"]}},
"train": [ep], "before": [ep]}
state = view(snap, cost=2.5)
assert state["completed"] == 0 and not state["steps"][0]["updated"]
assert state["kernel_evals"] == 2 and state["cost"] == 2.5
assert state["groups"]["training_tasks"]["before"]["correct_pct"] == 100
assert state["groups"]["official_heldout"]["before"]["episodes"] == 0
assert "