Repository navigation
refactor: for db.session feedback service.export feedbacks - #37763
Merged
asukaminato0721 merged 5 commits intoJun 23, 2026
Merged
asukaminato0721 merged 5 commits into
asukaminato0721 merged 5 commits into
Conversation
Kunal152000
requested review from
JohnJyong,
QuantumGhost and
laipz8200
as code owners
June 22, 2026 12:09
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-06-23 13:03:22.228555402 +0000
+++ /tmp/pyrefly_pr.txt 2026-06-23 13:03:11.587487193 +0000
@@ -1224,6 +1224,10 @@
--> tests/test_containers_integration_tests/services/test_feature_service.py:1871:16
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_feature_service.py:1872:16
+ERROR Multiple values for argument `app_id` in function `services.feedback_service.FeedbackService.export_feedbacks` [bad-keyword-argument]
+ --> tests/test_containers_integration_tests/services/test_feedback_service.py:165:13
+ERROR Multiple values for argument `app_id` in function `services.feedback_service.FeedbackService.export_feedbacks` [bad-keyword-argument]
+ --> tests/test_containers_integration_tests/services/test_feedback_service.py:218:17
ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_file_service.py:69:20
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -2049,57 +2053,57 @@
ERROR No attribute `MethodView` in module `builtins` [missing-attribute]
--> tests/unit_tests/controllers/common/test_fields.py:9:5
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1223:74
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1170:74
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1223:98
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1170:98
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1260:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1207:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1261:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1208:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1288:22
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1235:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1289:19
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1236:19
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1294:22
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1241:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1295:19
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1242:19
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1346:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1293:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1347:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1294:27
ERROR Object of class `object` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1429:50
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1376:50
ERROR Object of class `object` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1430:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1377:30
ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1431:33
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1378:33
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1443:67
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1390:67
ERROR Object of class `object` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1469:50
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1416:50
ERROR Object of class `object` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1470:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1417:30
ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1471:33
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1418:33
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1485:67
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1432:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account | None` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1485:91
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1432:91
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1505:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1452:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account | None` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1506:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1453:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1521:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1468:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1522:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1469:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1558:26
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1505:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1559:23
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1506:23
ERROR Argument `Literal['00000000-0000-0000-0000-000000000002']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1560:24
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1507:24
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
--> tests/unit_tests/controllers/console/app/test_annotation_security.py:221:38
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
@@ -6485,53 +6489,43 @@
ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `recipients` with type `Sequence[HumanInputFormRecipient]` in function `repositories.sqlalchemy_api_workflow_run_repository._build_human_input_required_reason` [bad-argument-type]
--> tests/unit_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:56:9
ERROR Object of class `object` has no attribute `prompt` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:665:12
-ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/agent/test_agent_services.py:841:12
-ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/agent/test_agent_services.py:842:12
-ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/agent/test_agent_services.py:843:12
-ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/agent/test_agent_services.py:845:12
-ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/agent/test_agent_services.py:846:12
+ --> tests/unit_tests/services/agent/test_agent_services.py:632:12
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService._build_app_list_filters` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1863:61
+ --> tests/unit_tests/services/agent/test_agent_services.py:1408:61
ERROR Object of class `object` has no attribute `name` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2337:16
+ --> tests/unit_tests/services/agent/test_agent_services.py:1882:16
ERROR Object of class `object` has no attribute `mode` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2338:16
+ --> tests/unit_tests/services/agent/test_agent_services.py:1883:16
ERROR Object of class `object` has no attribute `agent_role` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2339:16
+ --> tests/unit_tests/services/agent/test_agent_services.py:1884:16
ERROR Object of class `object` has no attribute `agent_role` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2415:16
+ --> tests/unit_tests/services/agent/test_agent_services.py:1960:16
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.validate_agent_nodes_for_publish` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2624:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:2169:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.validate_agent_nodes_for_publish` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2646:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:2191:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.project_draft_bindings_to_graph` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2710:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:2255:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2769:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:2314:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2838:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:2383:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2893:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:2438:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2925:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:2470:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2957:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:2502:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:3003:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:2548:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:3063:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:2608:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:3133:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:2678:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:3166:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:2711:21
ERROR Cannot set item in `dict[str, str]` [unsupported-operation]
- --> tests/unit_tests/services/agent/test_agent_services.py:3412:31
+ --> tests/unit_tests/services/agent/test_agent_services.py:2957:31
ERROR Object of class `NoneType` has no attribute `workflow_prompt` [missing-attribute]
--> tests/unit_tests/services/agent/test_composer_mention_validation.py:113:5
ERROR Class member `ConcreteApiKeyAuth.validate_credentials` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
|
Contributor
Pyrefly Type Coverage
|
Contributor
|
fix ci |
Kunal152000
force-pushed
the
refactor_for_db.session_FeedbackService.export_feedbacks
branch
from
June 23, 2026 07:10
843b3e0 to
5ad9a0a
Compare
Contributor
Author
asukaminato0721
previously approved these changes
Jun 23, 2026
asukaminato0721
enabled auto-merge
June 23, 2026 08:45
Contributor
|
fix ci |
auto-merge was automatically disabled
June 23, 2026 12:02
Head branch was pushed to by a user without write access
asukaminato0721
enabled auto-merge
June 23, 2026 13:01
asukaminato0721
previously approved these changes
Jun 23, 2026
Contributor
|
fix ci |
Co-authored-by: Asuka Minato <i@asukaminato.eu.org>
asukaminato0721
self-requested a review
June 23, 2026 13:46
asukaminato0721
approved these changes
Jun 23, 2026
Ssazurov
pushed a commit
to Ssazurov/dify
that referenced
this pull request
Aug 8, 2026
…s#37763) Co-authored-by: kunalj1-arch <kunal.j1@turing.com> Co-authored-by: Asuka Minato <i@asukaminato.eu.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors
MetadataServiceto accept the databasesessionas an explicit parameter instead of relying on the global, context-localdb.session. This is part of the incremental effort under #37403 to decouple core service layers from Flask-SQLAlchemy's global session registry, which improves test isolation and makes each method's data-access dependency explicit.What changed
api/services/metadata_service.py: addedsession: Sessionas the first positional parameter to the 7 methods that touch the database (create_metadata,update_metadata_name,delete_metadata,enable_built_in_field,disable_built_in_field,update_documents_metadata,get_dataset_metadatas) and replaced everydb.session.*call withsession.*. Thedbimport is removed;get_built_in_fieldsandknowledge_base_metadata_lock_checkare unchanged (no DB access).db.session()explicitly:api/controllers/console/datasets/metadata.pyandapi/controllers/service_api/dataset/metadata.py.Sessionfixture for the integration tests, and aMock()for the early-validation unit tests.The commit-failure test now patches the passed session (
patch.object(db_session_with_containers, "commit", ...)) instead of the globaldb.session.commit.Convention
Follows the merged
TagServicerefactor:session: Sessionas the first positional argument, callers passdb.session(). No behavior change — this is a pure, behavior-preserving refactor.Part of #37403 (incremental; intentionally not using
Fixessince the umbrellaissue spans many services).
Screenshots
N/A (backend refactor, no UI changes).
Screenshots
Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods