test: migrate document indexing task tests to SQLAlchemy 2.0 select API#35145
Merged
asukaminato0721 merged 2 commits intolanggenius:mainfrom Apr 14, 2026
Conversation
Replace remaining legacy Session.query patterns in document indexing integration tests with scalar/select and scalars(select(...)) to align with SQLAlchemy 2.x migration efforts.
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-14 07:15:26.946994580 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-14 07:15:16.270009008 +0000
@@ -1769,21 +1769,21 @@
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/tasks/test_disable_segment_from_index_task.py:64:20
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/tasks/test_disable_segments_from_index_task.py:53:20
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:54:20
ERROR Object of class `Account` has no attribute `tenant_id` [missing-attribute]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:58:9
-ERROR Object of class `Account` has no attribute `type` [missing-attribute]
--> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:59:9
+ERROR Object of class `Account` has no attribute `type` [missing-attribute]
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:60:9
ERROR `Literal['owner']` is not assignable to attribute `role` with type `TenantAccountRole | None` [bad-assignment]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:60:24
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:61:24
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:70:20
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:71:20
ERROR Object of class `Account` has no attribute `tenant_id` [missing-attribute]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:72:21
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:73:21
ERROR Object of class `DatasetProcessRule` has no attribute `tenant_id` [missing-attribute]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:233:9
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:234:9
ERROR Object of class `DatasetProcessRule` has no attribute `updated_by` [missing-attribute]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:245:9
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:246:9
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/tasks/test_document_indexing_sync_task.py:33: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]
@@ -1797,9 +1797,9 @@
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:163:20
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/tasks/test_document_indexing_update_task.py:43:20
+ --> tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.py:44: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]
- --> tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.py:48:53
+ --> tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.py:49:53
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/tasks/test_duplicate_document_indexing_task.py:84: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]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-14 07:17:36.348315637 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-14 07:17:25.530402479 +0000
@@ -1769,21 +1769,21 @@
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/tasks/test_disable_segment_from_index_task.py:64:20
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/tasks/test_disable_segments_from_index_task.py:53:20
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:54:20
ERROR Object of class `Account` has no attribute `tenant_id` [missing-attribute]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:58:9
-ERROR Object of class `Account` has no attribute `type` [missing-attribute]
--> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:59:9
+ERROR Object of class `Account` has no attribute `type` [missing-attribute]
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:60:9
ERROR `Literal['owner']` is not assignable to attribute `role` with type `TenantAccountRole | None` [bad-assignment]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:60:24
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:61:24
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:70:20
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:71:20
ERROR Object of class `Account` has no attribute `tenant_id` [missing-attribute]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:72:21
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:73:21
ERROR Object of class `DatasetProcessRule` has no attribute `tenant_id` [missing-attribute]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:233:9
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:234:9
ERROR Object of class `DatasetProcessRule` has no attribute `updated_by` [missing-attribute]
- --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:245:9
+ --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:246:9
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/tasks/test_document_indexing_sync_task.py:33: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]
@@ -1797,9 +1797,9 @@
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:163:20
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/tasks/test_document_indexing_update_task.py:43:20
+ --> tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.py:44: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]
- --> tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.py:48:53
+ --> tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.py:49:53
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/tasks/test_duplicate_document_indexing_task.py:84: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]
|
asukaminato0721
approved these changes
Apr 14, 2026
CodingOnStar
pushed a commit
that referenced
this pull request
Apr 14, 2026
…PI (#35145) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
HanqingZ
pushed a commit
to HanqingZ/dify
that referenced
this pull request
Apr 23, 2026
…PI (langgenius#35145) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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
Session.query(...).first()withSession.scalar(select(...).limit(1)).Session.query(...).count()withSession.scalar(select(func.count()).select_from(...).where(...)).Session.query(...).all()withSession.scalars(select(...).where(...)).all().Changes
Updated files
api/tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.pyselectandfuncimports.api/tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.pyselectimport.query(...).all()toscalars(select(...)).all().Related Issue