case0 / src /case_zero /persistence /golden.py
HusseinEid's picture
Case Zero - initial public release (fully local: Qwen2.5-1.5B via llama.cpp + Supertonic, custom pixel-noir SPA via gradio.Server)
414dc55
"""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()