Repository navigation
Description
AI disclosure: This issue was drafted and analyzed with Codex using GPT-5.4.
I have reviewed the analysis, and I am responsible for the content.
Summary
We should remove the legacy model type alias parsing in Graphon after the Dify legacy model_type migration window has had enough time to complete.
Graphon currently accepts legacy provider-native model type strings through ModelType._missing_, including:
text-generation->llmembeddings->text-embeddingreranking->rerank
This compatibility path was useful while Dify still had persisted rows or API-origin payloads using the legacy values. The Dify-side migration has now been released, so this compatibility logic should have an explicit cleanup issue instead of staying indefinitely.
Background
- Dify had an earlier compatibility fix for legacy
model_typedeserialization in fix: legacy model_type deserialization regression dify#34717, released in Dify1.14.0on 2026-04-29. That PR fixed a regression after provider-relatedmodel_typefields were migrated toEnumText(ModelType), allowing persisted legacy values such astext-generation,embeddings, andrerankingto load correctly. - Graphon introduced the alias parsing in fix: support model type alias parsing #157.
- That PR was released in Graphon
v0.5.0, published on 2026-05-29. - The original Graphon issue was use missing in Enum #21.
- Dify introduced the data migration script in feat(api): introduce model-type migration script dify#36520.
- Dify released that migration in
1.15.0, published on 2026-06-25. - Dify
1.15.0depends ongraphon==0.5.3, and current Difymaindepends ongraphon==0.6.0, so released Dify versions already include the Graphon compatibility layer.
Proposed cleanup
Remove the legacy alias parsing once we decide the compatibility window is over:
- Remove the legacy alias mapping in
src/graphon/model_runtime/entities/model_entities.py. - Remove or update tests that assert
text-generation,embeddings, orrerankingare accepted asModelTypeinputs. - Keep canonical values as the only accepted Graphon model type representation:
llmtext-embeddingrerankspeech2textmoderationtts
Risk and compatibility notes
This is a compatibility-breaking cleanup for callers that still pass legacy provider-native values directly into Graphon. Before removing it, we should confirm that supported Dify upgrade paths require the Dify migration to be run, and that any remaining legacy values are treated as invalid data rather than silently accepted runtime input.
The expected policy is:
- Adjacent-version upgrades can rely on the temporary compatibility window.
- Multi-version skipped upgrades should either upgrade step by step or stop serving traffic while applying the required migrations.
Validation
Suggested validation after implementation:
- Run
uv run pytest tests/model_runtime/test_model_dispatch.py tests/dsl/test_slim_package_loader.py. - Run the Graphon type/check workflow used by the repository, such as
make tcif still current. - Confirm Dify no longer depends on Graphon accepting legacy values after its
1.15.0data migration path.
Activity