You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
registry: validate AppManifest at the catalog boundary (tsk-y5tp24)
App manifests come from an externally-authored git repo
(tinyagentos/catalog_sync.py) and were previously parsed with
data.get(key, default) defaults and no type checks. A single malformed
entry broke the whole store listing at install time -- the audit's
noted cases were:
- requires=data.get("requires", {}) accepting a YAML string, then
raising AttributeError deep in install code with no indication
which manifest was malformed.
- context_window=data.get("context_window", 0) accepting a string,
which flowed into model-selection arithmetic.
- id=data["id"] raising bare KeyError; the loop in registry.py:168
built the catalog inside a try/except that only swallowed
yaml.YAMLError and KeyError, so one bad manifest took the whole
store listing offline.
Converting AppManifest from a @DataClass to a pydantic.BaseModel gives
per-field coercion and a ValidationError naming the offending field
and manifest at the boundary, for zero new install weight (pydantic is
already pulled in by FastAPI). The catalog load loop now wraps the
validate step and skips a malformed manifest with a named log message
instead of aborting the rest of the listing.
scripts/check_manifests.py was the mirror-image bug on the CI side
('if not isinstance(lifecycle, dict): continue' silently skipped a
malformed manifest, so a typo'd manifest passed the gate); the lint
now validates every service manifest against the same AppManifest
model the runtime uses. model_json_schema() is published as
scripts/manifest.schema.json for third-party app authors.
Red proof (before fix, tests/test_registry_manifest.py written, fix
not yet applied):
```
FAILED tests/test_registry_manifest.py::TestBoundaryRejectsWrongTypes::test_string_requires_is_rejected
Failed: DID NOT RAISE ValidationError
FAILED tests/test_registry_manifest.py::TestBoundaryRejectsWrongTypes::test_string_context_window_is_coerced_or_rejected
AssertionError: assert 8192 == '8192'
+ where '8192' = AppManifest(...).context_window
2 failed, 2 passed in 0.46s
```
Green proof (after fix):
```
tests/test_registry_manifest.py::TestBoundaryRejectsWrongTypes::test_string_requires_is_rejected PASSED
tests/test_registry_manifest.py::TestBoundaryRejectsWrongTypes::test_string_context_window_is_coerced_or_rejected PASSED
tests/test_registry_manifest.py::TestCatalogResilience::test_one_bad_manifest_does_not_abort_catalog PASSED
tests/test_registry_manifest.py::TestWellFormedManifestStillLoads::test_well_formed_manifest_loads PASSED
4 passed in 0.29s
```
Rollout: warn-only -- the live catalog has a few float-typed version
fields (dreamshaper-8-lcm, flux-schnell-gguf, pixart-sigma-512,
sdxs-512) and the hailo-ollama service manifest was missing version
entirely. The loop logs each skip with a named error and the rest of
the catalog loads (259 of 276 loaded in the live catalog pass; old
loader loaded 262). hailo-ollama gets a version: 0.1.0 to make the
live catalog clean against the new schema.
Docs-Reviewed: no README change needed; the only catalog manifest
edit adds a required 'version' field to hailo-ollama, no manifest is
added or removed and the catalog list in README is unchanged.
"description": "A loaded catalog manifest.\n\nApp manifests are externally-authored input, pulled from a remote git repo\nby ``tinyagentos/catalog_sync.py``. Validating at this boundary keeps a\nsingle malformed entry from breaking install-time code paths deep in\nthe stack (the prior ``data.get(key, default)`` loader happily let a\nstring ``requires`` through to install code, which then raised\n``AttributeError: 'str' object has no attribute 'get'`` with no\nindication which manifest was malformed).\n\n``extra=\"ignore\"`` keeps the model forward-compatible with newer\ncatalog fields the runtime has not learned about yet.",
0 commit comments