diff --git a/dokimi/changelog.d/20261205_130000_napetrov_arch-r14-3a.md b/dokimi/changelog.d/20261205_130000_napetrov_arch-r14-3a.md new file mode 100644 index 000000000..a920a8de1 --- /dev/null +++ b/dokimi/changelog.d/20261205_130000_napetrov_arch-r14-3a.md @@ -0,0 +1,8 @@ + + +### Changed + +- **No user-visible change.** The `commands` grader reads its run record with the shared run-record reader; the messages and their order are the same. diff --git a/dokimi/dokimi/repos/graders/command.py b/dokimi/dokimi/repos/graders/command.py index 7552001d7..e5b47cf04 100644 --- a/dokimi/dokimi/repos/graders/command.py +++ b/dokimi/dokimi/repos/graders/command.py @@ -25,16 +25,16 @@ from __future__ import annotations import importlib -import json import os import posixpath from pathlib import Path from typing import Any if __package__: - from . import hidden_tests + from . import hidden_tests, run_record else: # a script under -I, loaded by main.py, which put this directory on sys.path hidden_tests = importlib.import_module("hidden_tests") + run_record = importlib.import_module("run_record") # Bump when a result for the same inputs changes (a metric or ``pass``). VERSION = "1" @@ -122,16 +122,9 @@ def steps(raw: dict[str, Any]) -> list[tuple[str, int, str, list[str]]]: def _record(run_dir: Path) -> dict[str, Any]: - path = run_dir / RECORD - if not path.is_file(): - raise ValueError(f"no {RECORD}: the commands did not run") - doc = json.loads(path.read_text(encoding="utf-8")) - if not isinstance(doc, dict): - raise ValueError(f"{RECORD} is not an object") - if doc.get("problem"): # the framework could not stage the hidden files - raise ValueError(str(doc["problem"])) - groups = doc.get("groups") - if not isinstance(groups, dict): + # read_run_record raises the framework's problem, if the record holds one + doc = run_record.read_run_record(run_dir, RECORD, "the commands did not run") + if not isinstance(doc.get("groups"), dict): raise ValueError(f"{RECORD} has no groups") return doc