Skip to content

Commit ec6f33a

Browse files
committed
fail
1 parent 4137bb0 commit ec6f33a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

toolchain/mfc/gen_case_constraints_docs.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import ast
1414
import json
15+
import sys
1516
import subprocess
1617
from dataclasses import dataclass, field
1718
from pathlib import Path
@@ -391,6 +392,26 @@ class PlaybookEntry:
391392
]
392393

393394

395+
def validate_playbook_examples():
396+
"""Check that all curated examples exist and error if any are missing"""
397+
missing = []
398+
for entry in PLAYBOOK_EXAMPLES:
399+
case_path = EXAMPLES_DIR / entry.case_dir / "case.py"
400+
if not case_path.exists():
401+
missing.append(entry.case_dir)
402+
403+
if missing:
404+
print("=" * 70, file=sys.stderr)
405+
print("ERROR: Missing playbook examples:", file=sys.stderr)
406+
for example in missing:
407+
print(f" - {example}", file=sys.stderr)
408+
print("\nPlease update PLAYBOOK_EXAMPLES in:", file=sys.stderr)
409+
print(f" {Path(__file__).relative_to(REPO_ROOT)}", file=sys.stderr)
410+
print("\nRemove the missing examples from the list or restore them.", file=sys.stderr)
411+
print("=" * 70, file=sys.stderr)
412+
sys.exit(1)
413+
414+
394415
def load_case_params(case_dir: str) -> Dict[str, Any]:
395416
"""Load parameters from a case.py file"""
396417
case_path = EXAMPLES_DIR / case_dir / "case.py"
@@ -572,6 +593,9 @@ def generate_playbook() -> str:
572593
"""Generate complete playbook from curated examples"""
573594
lines = []
574595

596+
# Validate examples - will exit(1) if any are missing
597+
validate_playbook_examples()
598+
575599
lines.append("## 🧩 Case Design Playbook\n")
576600
lines.append(
577601
"> **Learn by example:** The cases below are curated from MFC's `examples/` "

0 commit comments

Comments
 (0)