Skip to content

fix: legacy model_type deserialization regression - #34717

Merged
asukaminato0721 merged 2 commits into
langgenius:mainfrom
IthacaDream:fix/legacy_model_type
Apr 8, 2026
Merged

asukaminato0721 merged 2 commits into
langgenius:mainfrom
IthacaDream:fix/legacy_model_type

Conversation

@IthacaDream

Copy link
Copy Markdown
Contributor

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Fixes #34683
This PR fixes a backward-compatibility regression introduced in #34300.
After provider-related model_type fields were migrated to EnumText(ModelType), workspaces containing legacy persisted values such as text-generation, embeddings, or reranking could no longer be loaded correctly

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 8, 2026
@IthacaDream IthacaDream mentioned this pull request Apr 8, 2026
6 tasks done
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-04-08 04:01:32.499122306 +0000
+++ /tmp/pyrefly_pr.txt	2026-04-08 04:01:22.744096855 +0000
@@ -307,6 +307,8 @@
   --> extensions/storage/huawei_obs_storage.py:31:20
 ERROR Argument `Module[Crypto.Hash.SHA1] | Unknown` is not assignable to parameter with type `Hash | HashModule` [bad-argument-type]
   --> libs/gmpy2_pkcs10aep_cipher.py:73:49
+ERROR Returned type `object` is not assignable to declared return type `T | None` [bad-return]
+   --> models/types.py:152:24
 ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=int | str | Unknown, port=int | str | Unknown, password=int | str | Unknown | None, db=int, ssl=bool, ssl_ca_certs=str | None, ssl_cert_reqs=Any | None, ssl_certfile=Any | None, ssl_keyfile=Any | None, socket_timeout=Literal[5], socket_connect_timeout=Literal[5], health_check_interval=Literal[30]) [no-matching-overload]
   --> schedule/queue_monitor_task.py:14:21
 ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -724,15 +726,15 @@
 ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=str, port=int, decode_responses=Literal[False]) [no-matching-overload]
   --> tests/test_containers_integration_tests/libs/broadcast_channel/redis/test_streams_channel.py:38:27
 ERROR Object of class `TypeEngine` has no attribute `length` [missing-attribute]
-  --> tests/test_containers_integration_tests/models/test_types_enum_text.py:96:16
+   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:104:16
 ERROR Object of class `NoneType` has no attribute `user_type` [missing-attribute]
-   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:133:20
+   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:141:20
 ERROR Object of class `NoneType` has no attribute `user_type_nullable` [missing-attribute]
-   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:134:20
+   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:142:20
 ERROR Object of class `NoneType` has no attribute `user_type` [missing-attribute]
-   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:138:20
+   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:146:20
 ERROR Object of class `NoneType` has no attribute `user_type_nullable` [missing-attribute]
-   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:139:20
+   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:147:20
 ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_execution` [bad-instantiation]
    --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
 ERROR Generator function should return `Generator` [bad-return]

@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-04-08 04:15:05.946029252 +0000
+++ /tmp/pyrefly_pr.txt	2026-04-08 04:14:57.110026187 +0000
@@ -724,15 +724,15 @@
 ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=str, port=int, decode_responses=Literal[False]) [no-matching-overload]
   --> tests/test_containers_integration_tests/libs/broadcast_channel/redis/test_streams_channel.py:38:27
 ERROR Object of class `TypeEngine` has no attribute `length` [missing-attribute]
-  --> tests/test_containers_integration_tests/models/test_types_enum_text.py:96:16
+   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:104:16
 ERROR Object of class `NoneType` has no attribute `user_type` [missing-attribute]
-   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:133:20
+   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:141:20
 ERROR Object of class `NoneType` has no attribute `user_type_nullable` [missing-attribute]
-   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:134:20
+   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:142:20
 ERROR Object of class `NoneType` has no attribute `user_type` [missing-attribute]
-   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:138:20
+   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:146:20
 ERROR Object of class `NoneType` has no attribute `user_type_nullable` [missing-attribute]
-   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:139:20
+   --> tests/test_containers_integration_tests/models/test_types_enum_text.py:147:20
 ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_execution` [bad-instantiation]
    --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
 ERROR Generator function should return `Generator` [bad-return]

@asukaminato0721
asukaminato0721 added this pull request to the merge queue Apr 8, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 8, 2026
Merged via the queue into langgenius:main with commit e138523 Apr 8, 2026
27 checks passed
HanqingZ pushed a commit to HanqingZ/dify that referenced this pull request Apr 23, 2026
Ssazurov pushed a commit to Ssazurov/dify that referenced this pull request Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

embeddings' is not a valid ModelType

2 participants