refactor: replace dict params with BaseModel payloads in TagService#34422
Conversation
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-01 18:32:50.695164697 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-01 18:32:39.534251583 +0000
@@ -20,6 +20,14 @@
--> controllers/console/setup.py:40:2
ERROR Object of class `MissingRouter` has no attribute `post` [missing-attribute]
--> controllers/console/setup.py:65:2
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.SaveTagPayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:85:75
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.UpdateTagPayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:106:79
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.TagBindingCreatePayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:139:120
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.TagBindingDeletePayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:157:120
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
--> controllers/console/version.py:30:2
ERROR Runtime checkable protocol `Generator` has an unsafe overlap with type `Generator[LLMResultChunk] | LLMResult` [unsafe-overlap]
@@ -1202,6 +1210,36 @@
--> tests/test_containers_integration_tests/services/test_tag_service.py:348:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_tag_service.py:358:18
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:691:39
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:729:30
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:733:34
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:753:36
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:759:41
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:800:36
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:821:37
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:824:37
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:831:36
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:992:37
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1034:37
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1037:37
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1077:41
+ERROR Argument `dict[str, str | Unknown]` is not assignable to parameter `payload` with type `TagBindingDeletePayload` in function `services.tag_service.TagService.delete_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1117:39
+ERROR Argument `dict[str, str | Unknown]` is not assignable to parameter `payload` with type `TagBindingDeletePayload` in function `services.tag_service.TagService.delete_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1153:39
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_trigger_provider_service.py:169:13
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -2164,6 +2202,8 @@
--> tests/unit_tests/controllers/service_api/dataset/test_dataset.py:217:29
ERROR Object of class `NoneType` has no attribute `name` [missing-attribute]
--> tests/unit_tests/controllers/service_api/dataset/test_dataset.py:778:16
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/dataset/test_dataset.py:873:39
ERROR Argument `list[dict[str, Any]] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/dataset/test_dataset_segment.py:51:20
ERROR `None` is not subscriptable [unsupported-operation]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-01 18:34:44.248083765 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-01 18:34:33.284037290 +0000
@@ -20,6 +20,14 @@
--> controllers/console/setup.py:40:2
ERROR Object of class `MissingRouter` has no attribute `post` [missing-attribute]
--> controllers/console/setup.py:65:2
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.SaveTagPayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:91:75
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.UpdateTagPayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:112:79
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.TagBindingCreatePayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:146:96
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.TagBindingDeletePayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:166:94
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
--> controllers/console/version.py:30:2
ERROR Runtime checkable protocol `Generator` has an unsafe overlap with type `Generator[LLMResultChunk] | LLMResult` [unsafe-overlap]
@@ -1202,6 +1210,36 @@
--> tests/test_containers_integration_tests/services/test_tag_service.py:348:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_tag_service.py:358:18
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:691:39
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:729:30
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:733:34
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:753:36
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:759:41
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:800:36
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:821:37
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:824:37
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:831:36
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:992:37
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1034:37
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1037:37
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1077:41
+ERROR Argument `dict[str, str | Unknown]` is not assignable to parameter `payload` with type `TagBindingDeletePayload` in function `services.tag_service.TagService.delete_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1117:39
+ERROR Argument `dict[str, str | Unknown]` is not assignable to parameter `payload` with type `TagBindingDeletePayload` in function `services.tag_service.TagService.delete_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1153:39
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_trigger_provider_service.py:169:13
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -2164,6 +2202,8 @@
--> tests/unit_tests/controllers/service_api/dataset/test_dataset.py:217:29
ERROR Object of class `NoneType` has no attribute `name` [missing-attribute]
--> tests/unit_tests/controllers/service_api/dataset/test_dataset.py:778:16
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/dataset/test_dataset.py:873:39
ERROR Argument `list[dict[str, Any]] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/dataset/test_dataset_segment.py:51:20
ERROR `None` is not subscriptable [unsupported-operation]
|
Code ReviewSummaryClean refactoring that replaces raw Blocking Issues1. Tests not updated — will fail at runtimeAll integration tests in # Line 691
tag_args = {"name": "test_tag_name", "type": "knowledge"}
result = TagService.save_tags(tag_args) # Now expects SaveTagPayload, not dict
# Line 759
result = TagService.update_tags(update_args, tag.id) # Now expects UpdateTagPayload
# Line 992
TagService.save_tag_binding(binding_args) # Now expects TagBindingCreatePayload
# Line 1117
TagService.delete_tag_binding(delete_args) # Now expects TagBindingDeletePayloadThe unit test in result = TagService.save_tags({"name": "New Tag", "type": "knowledge"})All of these will raise 2.
|
There was a problem hiding this comment.
Pull request overview
Refactors the backend tag APIs to pass typed Pydantic BaseModel payloads into TagService instead of raw dicts, aiming to remove dict intermediaries and tighten validation/type-safety across controllers and the service layer.
Changes:
- Introduced service-layer Pydantic payload models for tag creation/update and tag binding create/delete.
- Updated
TagServicemethod signatures to accept these payload models instead ofdict. - Updated console + service API controllers to construct and pass the new payload models.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| api/services/tag_service.py | Adds new payload models and updates TagService method signatures/usage to accept models. |
| api/controllers/console/tag/tags.py | Updates console endpoints to pass TagService typed payloads instead of model_dump() dicts. |
| api/controllers/service_api/dataset/dataset.py | Updates dataset service API endpoints to pass typed payloads instead of hand-built dicts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-02 07:13:14.664220909 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-02 07:13:04.506085382 +0000
@@ -12,6 +12,14 @@
--> controllers/console/setup.py:40:2
ERROR Object of class `MissingRouter` has no attribute `post` [missing-attribute]
--> controllers/console/setup.py:65:2
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.SaveTagPayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:91:75
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.UpdateTagPayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:112:79
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.TagBindingCreatePayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:146:96
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.TagBindingDeletePayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:166:94
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
--> controllers/console/version.py:30:2
ERROR Runtime checkable protocol `Generator` has an unsafe overlap with type `Generator[LLMResultChunk] | LLMResult` [unsafe-overlap]
@@ -412,6 +420,12 @@
--> services/summary_index_service.py:409:24
ERROR Argument `datetime | object` is not assignable to parameter `value` with type `SQLCoreOperations[datetime] | datetime` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
--> services/summary_index_service.py:410:53
+ERROR Could not find name `payload` [unknown-name]
+ --> services/tag_service.py:165:27
+ERROR Could not find name `tag_binding` [unknown-name]
+ --> services/tag_service.py:182:12
+ERROR Could not find name `tag_binding` [unknown-name]
+ --> services/tag_service.py:183:31
ERROR Object of class `dict` has no attribute `encode`
ERROR Object of class `dict` has no attribute `encode`
ERROR Runtime checkable protocol `Generator` has an unsafe overlap with type `Generator[Mapping[str, Any] | str] | Mapping[str, Any]` [unsafe-overlap]
@@ -1194,6 +1208,24 @@
--> tests/test_containers_integration_tests/services/test_tag_service.py:348:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_tag_service.py:358:18
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:691:39
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:729:30
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:733:34
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:753:36
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:759:41
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:800:36
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:821:37
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:824:37
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:831:36
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_trigger_provider_service.py:169:13
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -2146,6 +2178,8 @@
--> tests/unit_tests/controllers/service_api/dataset/test_dataset.py:217:29
ERROR Object of class `NoneType` has no attribute `name` [missing-attribute]
--> tests/unit_tests/controllers/service_api/dataset/test_dataset.py:778:16
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/dataset/test_dataset.py:873:39
ERROR Argument `list[dict[str, Any]] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/dataset/test_dataset_segment.py:51:20
ERROR `None` is not subscriptable [unsupported-operation]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-03 03:51:20.936728688 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-03 03:51:11.974814635 +0000
@@ -12,6 +12,14 @@
--> controllers/console/setup.py:40:2
ERROR Object of class `MissingRouter` has no attribute `post` [missing-attribute]
--> controllers/console/setup.py:65:2
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.SaveTagPayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:91:75
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.UpdateTagPayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:112:79
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.TagBindingCreatePayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:146:96
+ERROR Argument `Literal['app', 'knowledge'] | None` is not assignable to parameter `type` with type `Literal['app', 'knowledge']` in function `services.tag_service.TagBindingDeletePayload.__init__` [bad-argument-type]
+ --> controllers/console/tag/tags.py:166:94
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
--> controllers/console/version.py:30:2
ERROR Class member `EasyUIBasedGenerateTaskPipeline._application_generate_entity` overrides parent class `BasedGenerateTaskPipeline` in an inconsistent manner [bad-override]
@@ -343,6 +351,12 @@
--> services/document_indexing_proxy/duplicate_document_indexing_task_proxy.py:15:5
ERROR `handled_tenant_count` was assigned in the current scope before the nonlocal declaration [unknown-name]
--> services/plugin/plugin_migration.py:81:34
+ERROR Could not find name `payload` [unknown-name]
+ --> services/tag_service.py:165:27
+ERROR Could not find name `tag_binding` [unknown-name]
+ --> services/tag_service.py:182:12
+ERROR Could not find name `tag_binding` [unknown-name]
+ --> services/tag_service.py:183:31
ERROR Object of class `dict` has no attribute `encode`
ERROR Object of class `dict` has no attribute `encode`
ERROR Returned type `EndUser | Unknown | None` is not assignable to declared return type `Account | EndUser` [bad-return]
@@ -1113,6 +1127,24 @@
--> tests/test_containers_integration_tests/services/test_tag_service.py:348:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_tag_service.py:358:18
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:691:39
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:729:30
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:733:34
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:753:36
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:759:41
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:800:36
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:821:37
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:824:37
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:831:36
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_trigger_provider_service.py:169:13
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
|
64fb557 to
23a268f
Compare
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-03 16:47:47.845637925 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-03 16:47:39.423677113 +0000
@@ -1117,6 +1117,36 @@
--> tests/test_containers_integration_tests/services/test_tag_service.py:348:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_tag_service.py:358:18
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:691:39
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:729:30
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:733:34
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:753:36
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:759:41
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:800:36
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:821:37
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `SaveTagPayload` in function `services.tag_service.TagService.save_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:824:37
+ERROR Argument `dict[str, str]` is not assignable to parameter `payload` with type `UpdateTagPayload` in function `services.tag_service.TagService.update_tags` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:831:36
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:992:37
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1034:37
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1037:37
+ERROR Argument `dict[str, list[Unknown] | str]` is not assignable to parameter `payload` with type `TagBindingCreatePayload` in function `services.tag_service.TagService.save_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1077:41
+ERROR Argument `dict[str, str | Unknown]` is not assignable to parameter `payload` with type `TagBindingDeletePayload` in function `services.tag_service.TagService.delete_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1117:39
+ERROR Argument `dict[str, str | Unknown]` is not assignable to parameter `payload` with type `TagBindingDeletePayload` in function `services.tag_service.TagService.delete_tag_binding` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:1153:39
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_trigger_provider_service.py:169:13
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
|
23a268f to
c49b5ed
Compare
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-03 16:59:50.470200888 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-03 16:59:40.496185249 +0000
@@ -1106,17 +1106,17 @@
ERROR Argument `Literal['end_user']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.web.SavedMessage.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:602:67
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_tag_service.py:53:20
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:59: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/services/test_tag_service.py:62:20
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:68:20
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:330:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:336:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:339:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:345:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:348:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:354:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:358:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:364:18
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_trigger_provider_service.py:169:13
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-03 17:01:58.587103873 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-03 17:01:49.810081123 +0000
@@ -1106,17 +1106,17 @@
ERROR Argument `Literal['end_user']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.web.SavedMessage.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:602:67
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_tag_service.py:53:20
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:59: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/services/test_tag_service.py:62:20
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:68:20
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:330:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:336:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:339:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:345:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:348:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:354:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:358:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:364:18
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_trigger_provider_service.py:169:13
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
|
e6a3854 to
c0943f8
Compare
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-03 17:34:04.614494797 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-03 17:33:55.041383530 +0000
@@ -1106,17 +1106,17 @@
ERROR Argument `Literal['end_user']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.web.SavedMessage.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:602:67
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_tag_service.py:53:20
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:59: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/services/test_tag_service.py:62:20
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:68:20
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:330:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:336:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:339:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:345:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:348:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:354:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:358:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:364:18
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_trigger_provider_service.py:169:13
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-03 17:36:06.913159341 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-03 17:35:57.047124872 +0000
@@ -1106,17 +1106,17 @@
ERROR Argument `Literal['end_user']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.web.SavedMessage.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:602:67
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_tag_service.py:53:20
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:59: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/services/test_tag_service.py:62:20
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:68:20
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:330:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:336:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:339:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:345:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:348:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:354:18
ERROR Argument `Literal['app']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_tag_service.py:358:18
+ --> tests/test_containers_integration_tests/services/test_tag_service.py:364:18
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_trigger_provider_service.py:169:13
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
|
|
Hi @asukaminato0721, is this PR not ready to be merged? Could you please provide any feedback? |
|
Hi @asukaminato0721, sorry for the ping. @dosu mentioned that my approach looks good. could you share your thoughts as well? |
|
Just to clarify — I'm Dosu, an AI knowledge agent, not a maintainer. I provided an automated code review with suggestions, but I don't have the authority to approve or merge PRs. You'll still need a maintainer (like @asukaminato0721) to review and approve the changes. The review feedback from @bri-tong raised some valid blocking issues (test updates and the To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
…anggenius#34422) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Summary
Part of #31497
Before:
TagService.save_tags,update_tags,save_tag_binding, anddelete_tag_bindingaccepted rawdictargs, with callers either calling.model_dump()on already-validated Pydantic models or manually constructing dicts.After: Four new typed payloads (
SaveTagPayload,UpdateTagPayload,TagBindingCreatePayload,TagBindingDeletePayload) defined in the service layer. All callers in console and service API controllers now construct and pass these models directly, eliminating dict intermediaries and gaining compile-time type safety with Pydantic validation.Files changed
api/services/tag_service.py— new payload models + updated method signaturesapi/controllers/console/tag/tags.py— pass models instead of.model_dump()api/controllers/service_api/dataset/dataset.py— pass models instead of hand-built dicts