Skip to content

refactor(web): convert enums to as-const objects (batch)#35059

Closed
DORI2001 wants to merge 3 commits intolanggenius:mainfrom
DORI2001:refactor/enum-to-as-const-batch
Closed

refactor(web): convert enums to as-const objects (batch)#35059
DORI2001 wants to merge 3 commits intolanggenius:mainfrom
DORI2001:refactor/enum-to-as-const-batch

Conversation

@DORI2001
Copy link
Copy Markdown

@DORI2001 DORI2001 commented Apr 13, 2026

What changed

Converts TypeScript enum declarations to as const objects with companion type aliases across 8 frontend files. This is a follow-up batch contribution to issue #27998.

Files converted

File Enum(s)
web/app/components/base/action-button/index.tsx ActionButtonState
web/app/components/base/badge/index.tsx BadgeState
web/app/components/base/markdown-blocks/form.tsx DATA_FORMAT, SUPPORTED_TAGS, SUPPORTED_TYPES
web/app/components/datasets/metadata/metadata-dataset/select-metadata-modal.tsx Step
web/app/components/header/account-dropdown/compliance.tsx DocName
web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx STEP
web/app/components/workflow/operator/zoom-in-out.tsx ZoomType
web/app/components/workflow/workflow-preview/components/zoom-in-out.tsx ZoomType

Why

TypeScript enum declarations compile to IIFE-based runtime objects (e.g. var Status; (function(Status) { ... })(Status || (Status = {}));), which:

  • Add unnecessary JavaScript runtime overhead
  • Cannot be tree-shaken by bundlers
  • Are not idiomatic modern TypeScript

as const objects produce no runtime overhead and are tree-shakeable.

Conversion pattern

// Before
enum Status {
  Active = 'active',
  Inactive = 'inactive',
}

// After
const Status = {
  Active: 'active',
  Inactive: 'inactive',
} as const
type Status = typeof Status[keyof typeof Status]

All call sites (Status.Active, Status.Inactive, etc.) are unchanged — the API is identical.

Closes part of #27998.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 13, 2026
@github-actions github-actions bot added web This relates to changes on the web. needs-revision labels Apr 13, 2026
@dosubot dosubot bot added the refactor label Apr 13, 2026
@DORI2001 DORI2001 changed the title refactor(web): 🤖 convert enums to as-const objects (batch) refactor(web): convert enums to as-const objects (batch) Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-04-13 14:48:45.677814014 +0000
+++ /tmp/pyrefly_pr.txt	2026-04-13 14:48:34.814802181 +0000
@@ -912,12 +912,6 @@
     --> tests/test_containers_integration_tests/services/test_account_service.py:2944:35
 ERROR Argument `Literal['archive']` is not assignable to parameter `value` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
     --> tests/test_containers_integration_tests/services/test_account_service.py:3334:25
-ERROR Argument `dict[str, AppMode | str] | dict[str, str]` is not assignable to parameter `args` with type `AdvancedPromptTemplateArgs` in function `services.advanced_prompt_template_service.AdvancedPromptTemplateService.get_prompt` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_advanced_prompt_template_service.py:701:63
-ERROR Argument `dict[str, AppMode | str]` is not assignable to parameter `args` with type `AdvancedPromptTemplateArgs` in function `services.advanced_prompt_template_service.AdvancedPromptTemplateService.get_prompt` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_advanced_prompt_template_service.py:816:63
-ERROR Argument `dict[str, AppMode | str]` is not assignable to parameter `args` with type `AdvancedPromptTemplateArgs` in function `services.advanced_prompt_template_service.AdvancedPromptTemplateService.get_prompt` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_advanced_prompt_template_service.py:873:63
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_agent_service.py:134:38
 ERROR `str` is not assignable to attribute `agent_mode` with type `Never` [bad-assignment]
@@ -1410,12 +1404,6 @@
    --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:186:37
 ERROR Argument `Literal['normal']` is not assignable to parameter `value` with type `MessageStatus | SQLCoreOperations[MessageStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
    --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:188:26
-ERROR Argument `dict[str, int | Unknown | None]` is not assignable to parameter `args` with type `WorkflowRunListArgs` in function `services.workflow_run_service.WorkflowRunService.get_paginate_workflow_runs` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:224:71
-ERROR Argument `dict[Unknown, Unknown]` is not assignable to parameter `args` with type `WorkflowRunListArgs` in function `services.workflow_run_service.WorkflowRunService.get_paginate_workflow_runs` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:305:71
-ERROR Argument `dict[str, int | Unknown | None]` is not assignable to parameter `args` with type `WorkflowRunListArgs` in function `services.workflow_run_service.WorkflowRunService.get_paginate_advanced_chat_workflow_runs` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:350:85
 ERROR Argument `Literal['succeeded']` is not assignable to parameter `value` with type `WorkflowNodeExecutionStatus` in function `list.count` [bad-argument-type]
    --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:501:31
 ERROR Argument `Literal['paused']` is not assignable to parameter `value` with type `WorkflowNodeExecutionStatus` in function `list.count` [bad-argument-type]
@@ -1937,9 +1925,9 @@
 ERROR Cannot set item in `OrderedDict[str, bool | list[str] | str]` [unsupported-operation]
    --> tests/unit_tests/controllers/console/app/workflow_draft_variables_test.py:134:47
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/controllers/console/auth/test_login_logout.py:527:16
+   --> tests/unit_tests/controllers/console/auth/test_login_logout.py:467:16
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/controllers/console/auth/test_login_logout.py:555:16
+   --> tests/unit_tests/controllers/console/auth/test_login_logout.py:495:16
 ERROR Object of class `tuple` has no attribute `json` [missing-attribute]
   --> tests/unit_tests/controllers/console/auth/test_token_refresh.py:74:16
 ERROR Type `Response` is not iterable [not-iterable]
@@ -5326,11 +5314,11 @@
    --> tests/unit_tests/core/tools/utils/test_parser.py:174:16
 ERROR Type `None` is not iterable [not-iterable]
    --> tests/unit_tests/core/tools/utils/test_parser.py:177:54
-ERROR Argument `Literal['not a dict']` is not assignable to parameter `d` with type `dict[str, Any]` in function `core.tools.utils.message_transformer.safe_json_dict` [bad-argument-type]
+ERROR Argument `Literal['not a dict']` is not assignable to parameter `d` with type `dict[Unknown, Unknown]` in function `core.tools.utils.message_transformer.safe_json_dict` [bad-argument-type]
    --> tests/unit_tests/core/tools/utils/test_tool_engine_serialization.py:206:28
-ERROR Argument `list[int]` is not assignable to parameter `d` with type `dict[str, Any]` in function `core.tools.utils.message_transformer.safe_json_dict` [bad-argument-type]
+ERROR Argument `list[int]` is not assignable to parameter `d` with type `dict[Unknown, Unknown]` in function `core.tools.utils.message_transformer.safe_json_dict` [bad-argument-type]
    --> tests/unit_tests/core/tools/utils/test_tool_engine_serialization.py:209:28
-ERROR Argument `Literal[42]` is not assignable to parameter `d` with type `dict[str, Any]` in function `core.tools.utils.message_transformer.safe_json_dict` [bad-argument-type]
+ERROR Argument `Literal[42]` is not assignable to parameter `d` with type `dict[Unknown, Unknown]` in function `core.tools.utils.message_transformer.safe_json_dict` [bad-argument-type]
    --> tests/unit_tests/core/tools/utils/test_tool_engine_serialization.py:212:28
 ERROR Object of class `BlobChunkMessage` has no attribute `json_object`
 ERROR Object of class `BlobChunkMessage` has no attribute `json_object`
@@ -6327,8 +6315,6 @@
    --> tests/unit_tests/services/test_model_load_balancing_service.py:673:37
 ERROR `(tenant_id: str) -> service_with_fake_configurations._FakeProviderManager` is not assignable to attribute `_get_provider_manager` with type `(tenant_id: str) -> ProviderManager` [bad-assignment]
   --> tests/unit_tests/services/test_model_provider_service_sanitization.py:74:33
-ERROR Argument `dict[Unknown, Unknown]` is not assignable to parameter `utm_info` with type `UtmInfo` in function `services.operation_service.OperationService.record_utm` [bad-argument-type]
-   --> tests/unit_tests/services/test_operation_service.py:116:57
 ERROR Argument `Literal['']` is not assignable to parameter `plan` with type `CloudPlan` in function `RagPipelineTaskProxyTestDataFactory.create_mock_features` [bad-argument-type]
    --> tests/unit_tests/services/test_rag_pipeline_task_proxy.py:409:109
 ERROR Argument `None` is not assignable to parameter `plan` with type `CloudPlan` in function `RagPipelineTaskProxyTestDataFactory.create_mock_features` [bad-argument-type]
@@ -6399,10 +6385,6 @@
     --> tests/unit_tests/services/test_webhook_service.py:1154:68
 ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
     --> tests/unit_tests/services/test_webhook_service.py:1304:61
-ERROR Argument `dict[str, str]` is not assignable to parameter `args` with type `WorkflowRunListArgs` in function `services.workflow_run_service.WorkflowRunService.get_paginate_workflow_runs` [bad-argument-type]
-   --> tests/unit_tests/services/test_workflow_run_service_pause.py:294:14
-ERROR `Literal['2']` is not assignable to TypedDict key `limit` with type `int` [bad-typed-dict-key]
-   --> tests/unit_tests/services/test_workflow_run_service_pause.py:327:99
 ERROR Missing required key `id` for TypedDict `NodeConfigDict` [bad-typed-dict-key]
     --> tests/unit_tests/services/test_workflow_service.py:2680:71
 ERROR Missing required key `data` for TypedDict `NodeConfigDict` [bad-typed-dict-key]

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-04-14 02:13:42.846051831 +0000
+++ /tmp/pyrefly_pr.txt	2026-04-14 02:13:32.640990413 +0000
@@ -912,12 +912,6 @@
     --> tests/test_containers_integration_tests/services/test_account_service.py:2944:35
 ERROR Argument `Literal['archive']` is not assignable to parameter `value` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
     --> tests/test_containers_integration_tests/services/test_account_service.py:3334:25
-ERROR Argument `dict[str, AppMode | str] | dict[str, str]` is not assignable to parameter `args` with type `AdvancedPromptTemplateArgs` in function `services.advanced_prompt_template_service.AdvancedPromptTemplateService.get_prompt` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_advanced_prompt_template_service.py:701:63
-ERROR Argument `dict[str, AppMode | str]` is not assignable to parameter `args` with type `AdvancedPromptTemplateArgs` in function `services.advanced_prompt_template_service.AdvancedPromptTemplateService.get_prompt` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_advanced_prompt_template_service.py:816:63
-ERROR Argument `dict[str, AppMode | str]` is not assignable to parameter `args` with type `AdvancedPromptTemplateArgs` in function `services.advanced_prompt_template_service.AdvancedPromptTemplateService.get_prompt` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_advanced_prompt_template_service.py:873:63
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_agent_service.py:134:38
 ERROR `str` is not assignable to attribute `agent_mode` with type `Never` [bad-assignment]
@@ -1410,12 +1404,6 @@
    --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:186:37
 ERROR Argument `Literal['normal']` is not assignable to parameter `value` with type `MessageStatus | SQLCoreOperations[MessageStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
    --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:188:26
-ERROR Argument `dict[str, int | Unknown | None]` is not assignable to parameter `args` with type `WorkflowRunListArgs` in function `services.workflow_run_service.WorkflowRunService.get_paginate_workflow_runs` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:224:71
-ERROR Argument `dict[Unknown, Unknown]` is not assignable to parameter `args` with type `WorkflowRunListArgs` in function `services.workflow_run_service.WorkflowRunService.get_paginate_workflow_runs` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:305:71
-ERROR Argument `dict[str, int | Unknown | None]` is not assignable to parameter `args` with type `WorkflowRunListArgs` in function `services.workflow_run_service.WorkflowRunService.get_paginate_advanced_chat_workflow_runs` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:350:85
 ERROR Argument `Literal['succeeded']` is not assignable to parameter `value` with type `WorkflowNodeExecutionStatus` in function `list.count` [bad-argument-type]
    --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:501:31
 ERROR Argument `Literal['paused']` is not assignable to parameter `value` with type `WorkflowNodeExecutionStatus` in function `list.count` [bad-argument-type]
@@ -1751,9 +1739,9 @@
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
     --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:1126:27
 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_create_segment_to_index_task.py:75:20
+  --> tests/test_containers_integration_tests/tasks/test_create_segment_to_index_task.py:74: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_create_segment_to_index_task.py:84:20
+  --> tests/test_containers_integration_tests/tasks/test_create_segment_to_index_task.py:83: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_dataset_indexing_task.py:122: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]
@@ -1821,15 +1809,15 @@
 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_mail_change_mail_task.py:57: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_mail_email_code_login_task.py:93:20
+  --> tests/test_containers_integration_tests/tasks/test_mail_email_code_login_task.py:92: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_mail_email_code_login_task.py:122:20
+   --> tests/test_containers_integration_tests/tasks/test_mail_email_code_login_task.py:121:20
 ERROR Argument `str | Unknown | None` is not assignable to parameter `to` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_mail_email_code_login_task.py:381:20
+   --> tests/test_containers_integration_tests/tasks/test_mail_email_code_login_task.py:380:20
 ERROR Argument `str | Unknown | None` is not assignable to parameter `code` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_mail_email_code_login_task.py:382:22
+   --> tests/test_containers_integration_tests/tasks/test_mail_email_code_login_task.py:381:22
 ERROR Object of class `HumanInputNodeData` has no attribute `delivery_methods` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_mail_human_input_delivery_task.py:106:26
+   --> tests/test_containers_integration_tests/tasks/test_mail_human_input_delivery_task.py:105:26
 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_mail_owner_transfer_task.py:64: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]
@@ -1849,23 +1837,23 @@
 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/test_workflow_pause_integration.py:708:20
 ERROR Argument `Literal['owner']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/trigger/conftest.py:37:79
+  --> tests/test_containers_integration_tests/trigger/conftest.py:36:79
 ERROR Argument `dict[str, dict[str, dict[str, str] | str] | str]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `core.trigger.debug.event_selectors.TriggerDebugEventPoller.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:304:21
+   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:301:21
 ERROR Argument `MockPluginSubscription` is not assignable to parameter `subscription` with type `TriggerSubscription` in function `tasks.trigger_processing_tasks.dispatch_trigger_debug_event` [bad-argument-type]
-   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:355:26
+   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:352:26
 ERROR Argument `dict[str, dict[str, dict[Unknown, Unknown] | str] | str]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `core.trigger.debug.event_selectors.TriggerDebugEventPoller.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:469:21
+   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:466:21
 ERROR Argument `dict[str, Any]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.schedule_service.ScheduleService.to_schedule_config` [bad-argument-type]
-   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:664:49
+   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:659:49
 ERROR Argument `Literal['api-key']` is not assignable to parameter `credential_type` with type `CredentialType | SQLCoreOperations[CredentialType]` in function `models.trigger.TriggerSubscription.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:733:25
+   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:728:25
 ERROR Cannot set item in `str` [unsupported-operation]
-   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:739:5
+   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:734:5
 ERROR Argument `Literal['api-key']` is not assignable to parameter `credential_type` with type `CredentialType | SQLCoreOperations[CredentialType]` in function `models.trigger.TriggerSubscription.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:830:25
+   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:824:25
 ERROR Argument `dict[str, dict[str, dict[Unknown, Unknown] | str] | str]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `core.trigger.debug.event_selectors.TriggerDebugEventPoller.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:857:21
+   --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:851:21
 ERROR Argument `Literal['unsupported_language']` is not assignable to parameter `language` with type `CodeLanguage` in function `core.helper.code_executor.code_executor.CodeExecutor.execute_workflow_code_template` [bad-argument-type]
   --> tests/test_containers_integration_tests/workflow/nodes/code_executor/test_code_executor.py:10:62
 ERROR Expected a callable, got `None` [not-callable]
@@ -1937,9 +1925,9 @@
 ERROR Cannot set item in `OrderedDict[str, bool | list[str] | str]` [unsupported-operation]
    --> tests/unit_tests/controllers/console/app/workflow_draft_variables_test.py:134:47
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/controllers/console/auth/test_login_logout.py:527:16
+   --> tests/unit_tests/controllers/console/auth/test_login_logout.py:467:16
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/controllers/console/auth/test_login_logout.py:555:16
+   --> tests/unit_tests/controllers/console/auth/test_login_logout.py:495:16
 ERROR Object of class `tuple` has no attribute `json` [missing-attribute]
   --> tests/unit_tests/controllers/console/auth/test_token_refresh.py:74:16
 ERROR Type `Response` is not iterable [not-iterable]
@@ -4087,7 +4075,7 @@
    --> tests/unit_tests/core/model_runtime/test_model_provider_factory.py:407:23
 ERROR Missing argument `text` in function `core.moderation.api.api.ModerationOutputParams.__init__` [missing-argument]
   --> tests/unit_tests/core/moderation/api/test_api.py:47:35
-ERROR Argument `Literal['invalid']` is not assignable to parameter `config` with type `dict[str, Any] | None` in function `core.moderation.base.Moderation.__init__` [bad-argument-type]
+ERROR Argument `Literal['invalid']` is not assignable to parameter `config` with type `dict[Unknown, Unknown] | None` in function `core.moderation.base.Moderation.__init__` [bad-argument-type]
     --> tests/unit_tests/core/moderation/test_sensitive_word_filter.py:1282:92
 ERROR Object of class `NoneType` has no attribute `trace_id` [missing-attribute]
    --> tests/unit_tests/core/ops/aliyun_trace/data_exporter/test_traceclient.py:229:16
@@ -6249,7 +6237,7 @@
    --> tests/unit_tests/services/test_external_dataset_service.py:116:60
 ERROR Argument `str` is not assignable to parameter `type` with type `Literal['api-key', 'no-auth']` in function `services.entities.external_knowledge_entities.external_knowledge_entities.Authorization.__init__` [bad-argument-type]
    --> tests/unit_tests/services/test_external_dataset_service.py:117:35
-ERROR Argument `None` is not assignable to parameter `api_settings` with type `dict[str, Any]` in function `services.external_knowledge_service.ExternalDatasetService.validate_api_list` [bad-argument-type]
+ERROR Argument `None` is not assignable to parameter `api_settings` with type `dict[Unknown, Unknown]` in function `services.external_knowledge_service.ExternalDatasetService.validate_api_list` [bad-argument-type]
    --> tests/unit_tests/services/test_external_dataset_service.py:401:54
 ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
    --> tests/unit_tests/services/test_external_dataset_service.py:880:31
@@ -6327,8 +6315,6 @@
    --> tests/unit_tests/services/test_model_load_balancing_service.py:673:37
 ERROR `(tenant_id: str) -> service_with_fake_configurations._FakeProviderManager` is not assignable to attribute `_get_provider_manager` with type `(tenant_id: str) -> ProviderManager` [bad-assignment]
   --> tests/unit_tests/services/test_model_provider_service_sanitization.py:74:33
-ERROR Argument `dict[Unknown, Unknown]` is not assignable to parameter `utm_info` with type `UtmInfo` in function `services.operation_service.OperationService.record_utm` [bad-argument-type]
-   --> tests/unit_tests/services/test_operation_service.py:116:57
 ERROR Argument `Literal['']` is not assignable to parameter `plan` with type `CloudPlan` in function `RagPipelineTaskProxyTestDataFactory.create_mock_features` [bad-argument-type]
    --> tests/unit_tests/services/test_rag_pipeline_task_proxy.py:409:109
 ERROR Argument `None` is not assignable to parameter `plan` with type `CloudPlan` in function `RagPipelineTaskProxyTestDataFactory.create_mock_features` [bad-argument-type]
@@ -6399,10 +6385,6 @@
     --> tests/unit_tests/services/test_webhook_service.py:1154:68
 ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
     --> tests/unit_tests/services/test_webhook_service.py:1304:61
-ERROR Argument `dict[str, str]` is not assignable to parameter `args` with type `WorkflowRunListArgs` in function `services.workflow_run_service.WorkflowRunService.get_paginate_workflow_runs` [bad-argument-type]
-   --> tests/unit_tests/services/test_workflow_run_service_pause.py:294:14
-ERROR `Literal['2']` is not assignable to TypedDict key `limit` with type `int` [bad-typed-dict-key]
-   --> tests/unit_tests/services/test_workflow_run_service_pause.py:327:99
 ERROR Missing required key `id` for TypedDict `NodeConfigDict` [bad-typed-dict-key]
     --> tests/unit_tests/services/test_workflow_service.py:2680:71
 ERROR Missing required key `data` for TypedDict `NodeConfigDict` [bad-typed-dict-key]

@crazywoola
Copy link
Copy Markdown
Member

Please resolve the lint errors

@DORI2001
Copy link
Copy Markdown
Author

@crazywoola The Pyrefly diff the bot posted shows errors being removed relative to the base branch (all reported lines are prefixed with -, meaning they exist in main but not in this PR). The PR introduces no new type errors.

Regarding the frontend: the eslint-suppressions.json has been updated to remove the erasable-syntax-only/enums suppressions for each of the 9 converted files — matching the changes one-for-one. No residual enum references remain in the converted files.

Could you point to the specific files or rules you'd like addressed? Happy to resolve anything concrete.

@DORI2001
Copy link
Copy Markdown
Author

Closing this PR because it mixes too many unrelated changes:

  1. Frontend enum → as-const conversions (the stated purpose — 8 files)
  2. Python backend TypedDict removals (AdvancedPromptTemplateArgs, WorkflowRunListArgs, UtmInfo, LoginFailureReason) — these aren't lint fixes; they reduce type safety by replacing typed dicts with bare dict
  3. react-i18next upgrade 16.5.8 → 17.0.2 — unrelated and potentially breaking
  4. Docker workflow path triggers — unrelated

The Pyrefly errors that appear 'removed' in the bot diff are gone because the TypedDicts they enforced were deleted, not because the code was fixed.

I'll reopen as a clean, focused PR containing only the frontend enum conversions with the corresponding eslint-suppressions.json update.

@DORI2001 DORI2001 closed this Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-revision refactor size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants