Spaces:
Running
Running
File size: 857 Bytes
414dc55 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | """Load sealed golden / seed case fixtures (JSON) from ``cases/seeds``.
A golden case is the FULL sealed dict: public fields + the scripted answer/delta reply
tables + the sealed solution. The public projection is taken via
``api.public_view.golden_to_public``; the scripted interrogation engine (M3) reads the
answer/delta tables directly. The returned dict is cached and must be treated as read-only.
"""
from __future__ import annotations
import json
from functools import lru_cache
from .paths import seed_case_path
@lru_cache(maxsize=8)
def load_golden(case_id: str) -> dict:
path = seed_case_path(case_id)
if not path.exists():
raise FileNotFoundError(f"golden case not found: {path}")
return json.loads(path.read_text(encoding="utf-8"))
def golden_exists(case_id: str) -> bool:
return seed_case_path(case_id).exists()
|