Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

fix(experiments): a manifest that is not a JSON object crashed the validator

kevin93271c48c8589a9a
diff --git a/c/experiment_manifest.py b/c/experiment_manifest.py
index 49b6571e..d9babf6b 100644
--- a/c/experiment_manifest.py
+++ b/c/experiment_manifest.py
@@ -52,6 +52,7 @@ def _run(record, name):
def validate(record):
"""Return a normalized summary or raise ValueError with an exact field."""
+ _object(record, "manifest")
if record.get("version") != 1:
raise ValueError("version must be 1")
for field in ("hypothesis", "commit", "model", "command", "prompt_hash"):
diff --git a/c/tests/test_experiment_manifest.py b/c/tests/test_experiment_manifest.py
index 51d75e83..be126852 100644
--- a/c/tests/test_experiment_manifest.py
+++ b/c/tests/test_experiment_manifest.py
@@ -1,7 +1,11 @@
+import contextlib
import copy
+import io
+import tempfile
import unittest
+from pathlib import Path
-from experiment_manifest import validate
+from experiment_manifest import main, validate
def run(config, speeds):
@@ -62,6 +66,23 @@ class ExperimentManifestTest(unittest.TestCase):
with self.assertRaisesRegex(ValueError, "64 hex"):
validate(record)
+ def test_rejects_a_document_that_is_not_an_object(self):
+ # A list, string, or null document escaped as AttributeError, which
+ # main() does not report by name.
+ for record in ([manifest()], "manifest", None):
+ with self.assertRaisesRegex(ValueError, "manifest must be an object"):
+ validate(record)
+
+ def test_cli_names_a_document_that_is_not_an_object(self):
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "result.json"
+ path.write_text("[]\n", encoding="utf-8")
+ out = io.StringIO()
+ with contextlib.redirect_stdout(out):
+ status = main([str(path)])
+ self.assertEqual(status, 1)
+ self.assertEqual(out.getvalue(), f"{path}: manifest must be an object\n")
+
if __name__ == "__main__":
unittest.main()