fix: dispatch dataset cleanup when doc_form is missing#38579
Open
Zhengcy05 wants to merge 2 commits into
Open
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-07-09 04:00:56.813213340 +0000
+++ /tmp/pyrefly_pr.txt 2026-07-09 04:00:48.392145449 +0000
@@ -1,3 +1,5 @@
+ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.delay` [bad-argument-type]
+ --> events/event_handlers/clean_when_dataset_deleted.py:20:9
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_alibabacloud_mysql.alibabacloud_mysql_vector.AlibabaCloudMySQLVectorFactory.init_vector` [bad-argument-type]
--> providers/vdb/vdb-alibabacloud-mysql/tests/unit_tests/test_alibabacloud_mysql_factory.py:42:38
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_alibabacloud_mysql.alibabacloud_mysql_vector.AlibabaCloudMySQLVectorFactory.init_vector` [bad-argument-type]
|
Contributor
Pyrefly Type Coverage
|
Contributor
|
style check failed |
Author
Thx, I've fixed it. |
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.
Important
Fixes #<issue number>.Summary
Fixes #38537
This PR fixes the dataset deletion path for migrated datasets whose
doc_formis missing.The delete event handler previously returned early when either
doc_formorindexing_techniquewas empty, which meantclean_dataset_taskwas never dispatched for some migrated datasets. However,clean_dataset_taskalready handles an emptydoc_formby falling back toPARAGRAPH_INDEX, so the handler was blocking a case the downstream cleanup path could already recover from.This change keeps the existing safeguard for missing
indexing_technique, but stops skipping cleanup when onlydoc_formis missing.Changes included in this PR:
clean_when_dataset_deleted.pydoc_form=NonecaseLocal verification:
uv run --project api --group dev pytest api/tests/unit_tests/events/event_handlers/test_clean_when_dataset_deleted.pyuv run --project api --group dev ruff check api/events/event_handlers/clean_when_dataset_deleted.py api/tests/unit_tests/events/event_handlers/test_clean_when_dataset_deleted.py api/tests/test_containers_integration_tests/services/test_dataset_service_delete_dataset.pyScreenshots
Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods