#!/usr/bin/env python3 """Validate the complete TestPrism verified-task release.""" from __future__ import annotations import sys from pathlib import Path ROOT = Path(__file__).resolve().parent TASKS = ROOT / "verified_tasks" / "test" EXPECTED_TASKS = 2000 FORBIDDEN_NAMES = {".DS_Store", "attempts.jsonl", ".env", "__pycache__"} def main() -> int: errors: list[str] = [] task_files = sorted(TASKS.glob("*/*/task.yaml")) task_keys = [str(path.parent.relative_to(TASKS)) for path in task_files] if len(task_keys) != EXPECTED_TASKS: errors.append( f"expected {EXPECTED_TASKS} task.yaml files, found {len(task_keys)}" ) if len(set(task_keys)) != len(task_keys): errors.append("duplicate task keys found") for task_file in task_files: task_dir = task_file.parent if not (task_dir / "solution.sh").is_file(): errors.append(f"missing solution.sh: {task_dir.relative_to(TASKS)}") for path in ROOT.rglob("*"): if any(part in FORBIDDEN_NAMES for part in path.relative_to(ROOT).parts): errors.append(f"forbidden release path: {path.relative_to(ROOT)}") if errors: print(f"FAIL: {len(errors)} data validation error(s)", file=sys.stderr) for error in errors[:100]: print(f"- {error}", file=sys.stderr) if len(errors) > 100: print(f"- ... {len(errors) - 100} more", file=sys.stderr) return 1 print(f"PASS: {len(task_keys)} verified tasks; release hygiene checks passed") return 0 if __name__ == "__main__": raise SystemExit(main())