Validate the run-metadata sidecar JSON (run-YYYY-MM-DDTHH-MM-SS.json).
(q)
| 1592 | |
| 1593 | |
| 1594 | def check_run_metadata(q): |
| 1595 | """Validate the run-metadata sidecar JSON (run-YYYY-MM-DDTHH-MM-SS.json).""" |
| 1596 | print("[Run Metadata]") |
| 1597 | results_dir = _resolve_artifact_path(q, "results") |
| 1598 | pattern = str(results_dir / "run-*.json") |
| 1599 | import glob as _glob |
| 1600 | matches = _glob.glob(pattern) |
| 1601 | if not matches: |
| 1602 | fail("run-metadata JSON missing (expected quality/results/run-YYYY-MM-DDTHH-MM-SS.json)") |
| 1603 | return |
| 1604 | if len(matches) > 1: |
| 1605 | warn(f"Multiple run-metadata files found: {len(matches)}") |
| 1606 | filename_re = re.compile(r"run-\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.json$") |
| 1607 | for path in matches: |
| 1608 | if not filename_re.search(path): |
| 1609 | fail(f"run-metadata filename does not match expected format: {path}") |
| 1610 | data = load_json(Path(path)) |
| 1611 | if data is None: |
| 1612 | fail(f"run-metadata JSON parse error: {path}") |
| 1613 | continue |
| 1614 | required_fields = ("schema_version", "skill_version", "project", "model", "runner", "start_time") |
| 1615 | for field in required_fields: |
| 1616 | if not data.get(field): |
| 1617 | fail(f"run-metadata missing or empty field: {field!r}") |
| 1618 | pass_("run-metadata JSON present") |
| 1619 | |
| 1620 | |
| 1621 | # --- Per-repo entry point --- |
no test coverage detected