MicroFish/backend/app/services
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
..
__init__.py Implement Interview feature for agent interactions in simulations 2025-12-08 15:55:39 +08:00
graph_builder.py Prevent graph builds from crashing on legacy ontology attributes 2026-04-21 12:33:45 -07:00
oasis_profile_generator.py feat(i18n): replace remaining Chinese in config generator and profile generator 2026-04-01 17:19:12 +08:00
ontology_generator.py Prevent graph builds from crashing on legacy ontology attributes 2026-04-21 12:33:45 -07:00
ontology_schema.py Prevent graph builds from crashing on legacy ontology attributes 2026-04-21 12:33:45 -07:00
report_agent.py feat(i18n): replace all user-visible Chinese in report_agent.py 2026-04-01 17:44:52 +08:00
simulation_config_generator.py feat(i18n): replace remaining Chinese in config generator and profile generator 2026-04-01 17:19:12 +08:00
simulation_ipc.py Implement Interview feature for agent interactions in simulations 2025-12-08 15:55:39 +08:00
simulation_manager.py feat(i18n): replace remaining hardcoded Chinese in progress callbacks 2026-04-01 16:53:29 +08:00
simulation_runner.py fix(i18n): pass locale to background threads via thread-local storage 2026-04-01 16:55:51 +08:00
text_processor.py Introduce Project ID for context management, finalizing the stateful API pipeline from file submission to graph construction. 2025-11-28 17:21:08 +08:00
zep_entity_reader.py feat(graph): implement pagination for fetching nodes and edges; add utility functions for streamlined data retrieval 2026-02-27 15:53:29 +08:00
zep_graph_memory_updater.py fix(i18n): pass locale to background threads via thread-local storage 2026-04-01 16:55:51 +08:00
zep_tools.py feat(i18n): replace all user-visible Chinese logger messages in zep_tools.py 2026-04-01 17:46:39 +08:00