MicroFish/backend/app
Jeffery 4ea13403bf Prevent graph builds from crashing on legacy ontology attributes
Legacy ontology payloads could be saved with attributes as free-form maps of attribute names to descriptions. The graph build path dereferenced attr_def["name"] directly, which raised a KeyError before the Zep ontology request. This adds a shared ontology normalizer, applies it when validating generated ontologies and when setting graph ontology, and adds regression tests for both normalization and graph-builder compatibility.

Constraint: The configured OpenAI-compatible provider guarantees valid JSON but not strict schema adherence for ontology attributes
Rejected: Guard only graph_builder.set_ontology against missing keys | would leave malformed ontologies persisted and unvalidated upstream
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep ontology payloads normalized at service boundaries so new generations and saved legacy projects share one schema contract
Tested: Targeted backend pytest for ontology normalization in the docker compose runtime
Tested: Python compileall for backend app and tests in the docker compose runtime
Tested: Reproduced the original saved project payload through graph_builder.set_ontology with a stubbed client
Not-tested: Live Zep API round-trip against the upstream service
2026-04-21 12:33:45 -07:00
..
api fix(i18n): replace hardcoded Chinese stage names in simulation prepare SSE 2026-04-01 17:31:00 +08:00
models feat(i18n): replace hardcoded Chinese in backend SSE progress messages 2026-04-01 16:32:10 +08:00
services Prevent graph builds from crashing on legacy ontology attributes 2026-04-21 12:33:45 -07:00
utils fix(i18n): validate Accept-Language header against registered locales 2026-04-02 14:20:15 +08:00
__init__.py Implement Report Agent for automated report generation and interaction 2025-12-09 15:10:55 +08:00
config.py fix(config): enable overriding of environment variables when loading .env file 2026-01-23 16:20:24 +08:00