test: migrate clean_dataset integration tests to SQLAlchemy 2.0 APIs#35146
Merged
asukaminato0721 merged 2 commits intolanggenius:mainfrom Apr 14, 2026
Merged
Conversation
Replace remaining legacy Session.query usage in clean_dataset task integration tests with Session.execute(delete(...)) and select-based reads to align with SQLAlchemy 2.x migration work (langgenius#22668).
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-14 07:19:40.830125314 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-14 07:19:31.072150059 +0000
@@ -1655,41 +1655,41 @@
ERROR `>` is not supported between `None` and `Literal[0]` [unsupported-operation]
--> tests/test_containers_integration_tests/tasks/test_batch_create_segment_to_index_task.py:708:16
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_clean_dataset_task.py:112:20
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:113: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_clean_dataset_task.py:122:20
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:123:20
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:297:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:298:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:300:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:301:22
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:409:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:420:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:412:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:423:22
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:477:36
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:494:36
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:480:26
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:497:26
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:532:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:551:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:535:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:554:22
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:617:36
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:640:36
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:620:26
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:643:26
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:730:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:757:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:733:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:760:22
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:816:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:849:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:819:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:852:22
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:971:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:1004:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:974:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:1007:22
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:90:23
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-14 07:21:27.631076732 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-14 07:21:17.550892653 +0000
@@ -1655,41 +1655,41 @@
ERROR `>` is not supported between `None` and `Literal[0]` [unsupported-operation]
--> tests/test_containers_integration_tests/tasks/test_batch_create_segment_to_index_task.py:708:16
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_clean_dataset_task.py:112:20
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:113: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_clean_dataset_task.py:122:20
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:123:20
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:297:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:298:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:300:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:301:22
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:409:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:422:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:412:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:425:22
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:477:36
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:498:36
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:480:26
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:501:26
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:532:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:555:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:535:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:558:22
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:617:36
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:644:36
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:620:26
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:647:26
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:730:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:761:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:733:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:764:22
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:816:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:855:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:819:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:858:22
ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:971:32
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:1012:32
ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
- --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:974:22
+ --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:1015:22
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:90:23
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
|
asukaminato0721
approved these changes
Apr 14, 2026
CodingOnStar
pushed a commit
that referenced
this pull request
Apr 14, 2026
…35146) 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
…anggenius#35146) 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
test_clean_dataset_task.pyfrom legacy SQLAlchemy Query API usage to SQLAlchemy 2.0 statement APIs.Session.query(...).delete()toSession.execute(delete(...)).query(...).filter_by(...).all()/query(...).where(...).all()toSession.scalars(select(...).where(...)).all().Changes
api/tests/test_containers_integration_tests/tasks/test_clean_dataset_task.pyfrom sqlalchemy import delete, selectRelated Issue