Harden output metadata and restart serialization checks

This commit is contained in:
Codex
2026-07-02 23:36:00 +08:00
parent b9299f14c6
commit f66768f261
4 changed files with 182 additions and 22 deletions
+14
View File
@@ -28,6 +28,15 @@ def read_fields(output: str) -> dict[str, str]:
return fields
def read_summary(path: Path) -> dict[str, str]:
metrics: dict[str, str] = {}
for line in path.read_text(encoding="utf-8").splitlines()[1:]:
if "," in line:
name, value = line.split(",", 1)
metrics[name.strip()] = value.strip()
return metrics
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--exe", required=True)
@@ -87,6 +96,11 @@ def main() -> int:
summary_file = Path(output_dir) / f"sphlite_{output_step:08d}_summary.csv"
if not output_file.exists() or not summary_file.exists():
raise AssertionError("CLI output files were not written")
summary = read_summary(summary_file)
if int(summary["step"]) != output_step:
raise AssertionError("CLI summary step does not match actual step")
if abs(float(summary["time"]) - float(run_fields["time"])) > 1.0e-12:
raise AssertionError("CLI summary time does not match actual time")
bad = run_command([exe, bad_model, "--check"], expect_ok=False)
require_field(bad.stderr, "error_code")