asnannp commited on
Commit
5ee0a39
·
1 Parent(s): d5ee82b

deploy: sync backend to Space root (learn-lesson HF cache fix)

Browse files
app/services/content_manifest.py CHANGED
@@ -95,6 +95,11 @@ def _required_string(value: Any, label: str) -> str:
95
 
96
  @lru_cache(maxsize=1)
97
  def load_content_manifest() -> ContentManifest:
 
 
 
 
 
98
  raw = json.loads(MANIFEST_PATH.read_text(encoding="utf-8"))
99
  if raw.get("schemaVersion") != 1:
100
  raise RuntimeError("Unsupported content manifest schema version.")
 
95
 
96
  @lru_cache(maxsize=1)
97
  def load_content_manifest() -> ContentManifest:
98
+ if not MANIFEST_PATH.is_file():
99
+ raise RuntimeError(
100
+ f"Content manifest is missing at {MANIFEST_PATH}. "
101
+ "Commit shared/content-manifest.json so CI and production can plan lessons."
102
+ )
103
  raw = json.loads(MANIFEST_PATH.read_text(encoding="utf-8"))
104
  if raw.get("schemaVersion") != 1:
105
  raise RuntimeError("Unsupported content manifest schema version.")
tests/test_content_manifest.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from app.services.content_manifest import MANIFEST_PATH, load_content_manifest
2
+
3
+
4
+ def test_content_manifest_file_is_present_and_loadable() -> None:
5
+ assert MANIFEST_PATH.is_file(), MANIFEST_PATH
6
+ manifest = load_content_manifest()
7
+ assert manifest.chapter("phy-p1-c1") is not None
8
+ assert manifest.mission("phy-p1-c1", "M1") is not None