Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
test(e2e): annotate ten container test modules for strict pyrefly (#45459)
Felix Shid1e859ddea8f
diff --git a/api/tests/e2e_tests/containers/controllers/console/test_api_based_extension.py b/api/tests/e2e_tests/containers/controllers/console/test_api_based_extension.pyindex 38f2400034c..ecc5be75967 100644--- a/api/tests/e2e_tests/containers/controllers/console/test_api_based_extension.py+++ b/api/tests/e2e_tests/containers/controllers/console/test_api_based_extension.py@@ -2,7 +2,8 @@from __future__ import annotations-from unittest.mock import patch+from collections.abc import Iterator+from unittest.mock import MagicMock, patchimport pytestfrom flask.testing import FlaskClient@@ -40,7 +41,7 @@ def api_extension_client(@pytest.fixture(autouse=True)-def mock_api_based_extension_ping():+def mock_api_based_extension_ping() -> Iterator[MagicMock]:with patch("services.api_based_extension_adapters.APIBasedExtensionRequestor") as requestor:requestor.return_value.request.return_value = {"result": "pong"}yield requestordiff --git a/api/tests/e2e_tests/containers/controllers/console/test_apikey.py b/api/tests/e2e_tests/containers/controllers/console/test_apikey.pyindex 09cbcccdb96..e8e0582b912 100644--- a/api/tests/e2e_tests/containers/controllers/console/test_apikey.py+++ b/api/tests/e2e_tests/containers/controllers/console/test_apikey.py@@ -218,11 +218,13 @@ class TestDatasetApiKeyListResource:"""def _bound_dataset_ids(self, session: Session, api_token_id: str) -> set[str]:- return set(- session.scalars(+ return {+ dataset_id+ for dataset_id in session.scalars(select(DatasetApiTokenBinding.dataset_id).where(DatasetApiTokenBinding.api_token_id == api_token_id)).all()- )+ if dataset_id is not None+ }def test_create_unbound_key(self,diff --git a/api/tests/e2e_tests/containers/controllers/openapi/test_account.py b/api/tests/e2e_tests/containers/controllers/openapi/test_account.pyindex 26203f120bb..f550996cad9 100644--- a/api/tests/e2e_tests/containers/controllers/openapi/test_account.py+++ b/api/tests/e2e_tests/containers/controllers/openapi/test_account.py@@ -21,7 +21,7 @@ class TestAccountInfo:api = AccountApi()with app.test_request_context("/openapi/v1/account"):- result = api.get.__handler__(api, context_for(account, session=db_session_with_containers))+ result = api.get.__handler__(api, context_for(account, session=db_session_with_containers)) # pyrefly: ignore[missing-attribute]assert result.subject_type == "account"assert result.subject_email == account.email@@ -46,7 +46,7 @@ class TestAccountInfo:api = AccountApi()with app.test_request_context("/openapi/v1/account"):- result = api.get.__handler__(api, context_for(account, session=db_session_with_containers))+ result = api.get.__handler__(api, context_for(account, session=db_session_with_containers)) # pyrefly: ignore[missing-attribute]assert {w.id for w in result.workspaces} == {owner_tenant.id, second.id}roles = {w.id: w.role for w in result.workspaces}diff --git a/api/tests/e2e_tests/containers/controllers/openapi/test_app_run.py b/api/tests/e2e_tests/containers/controllers/openapi/test_app_run.pyindex 2bdbb3ec9be..f992349bffa 100644--- a/api/tests/e2e_tests/containers/controllers/openapi/test_app_run.py+++ b/api/tests/e2e_tests/containers/controllers/openapi/test_app_run.py@@ -43,7 +43,7 @@ class TestAppRunStop:app.test_request_context(f"/openapi/v1/apps/{app_model.id}/runs/{run_id}:stop", method="POST"),pytest.raises(RunNotFound),):- api.post.__handler__(+ api.post.__handler__( # pyrefly: ignore[missing-attribute]api,context_for(account,diff --git a/api/tests/e2e_tests/containers/controllers/service_api/dataset/test_dataset.py b/api/tests/e2e_tests/containers/controllers/service_api/dataset/test_dataset.pyindex c47f4236e48..2716dc1c0e4 100644--- a/api/tests/e2e_tests/containers/controllers/service_api/dataset/test_dataset.py+++ b/api/tests/e2e_tests/containers/controllers/service_api/dataset/test_dataset.py@@ -1,6 +1,6 @@"""Container integration coverage for Service API dataset controllers."""-from unittest.mock import patch+from unittest.mock import MagicMock, patchimport pytestfrom flask import Flask@@ -23,7 +23,7 @@ class TestDatasetTagsApiGet:@patch("controllers.service_api.dataset.dataset.current_user")def test_list_tags_from_db(self,- mock_current_user,+ mock_current_user: MagicMock,app: Flask,db_session_with_containers: Session,) -> None:@@ -46,6 +46,7 @@ class TestDatasetTagsApiGet:response, status = DatasetTagsApi().get(_=None)assert status == 200+ assert isinstance(response, list)assert any(item["name"] == "Integration Tag" for item in response)assert all(set(item) == {"id", "name", "type", "binding_count"} for item in response)assert all(isinstance(item["binding_count"], str) for item in response)diff --git a/api/tests/e2e_tests/containers/helpers/__init__.py b/api/tests/e2e_tests/containers/helpers/__init__.pyindex 0b753abd1f6..c46e9ed9ee7 100644--- a/api/tests/e2e_tests/containers/helpers/__init__.py+++ b/api/tests/e2e_tests/containers/helpers/__init__.py@@ -2,8 +2,10 @@import re+from faker import Faker-def generate_valid_password(fake, length: int = 12) -> str:++def generate_valid_password(fake: Faker, length: int = 12) -> str:"""Generate a password that always satisfies the project's password validation rules.The password validation rule in ``api/libs/password.py`` requires passwords todiff --git a/api/tests/e2e_tests/containers/libs/test_auto_renew_redis_lock_integration.py b/api/tests/e2e_tests/containers/libs/test_auto_renew_redis_lock_integration.pyindex eb055ca332f..d201be51b66 100644--- a/api/tests/e2e_tests/containers/libs/test_auto_renew_redis_lock_integration.py+++ b/api/tests/e2e_tests/containers/libs/test_auto_renew_redis_lock_integration.py@@ -12,7 +12,7 @@ from libs.db_migration_lock import DbMigrationAutoRenewLock@pytest.mark.usefixtures("flask_app_with_containers")-def test_db_migration_lock_renews_ttl_and_releases():+def test_db_migration_lock_renews_ttl_and_releases() -> None:lock_name = f"test:db_migration_auto_renew_lock:{uuid.uuid4().hex}"# Keep base TTL very small, and renew frequently so the test is stable even on slower CI.diff --git a/api/tests/e2e_tests/containers/pyrefly.toml b/api/tests/e2e_tests/containers/pyrefly.tomlindex e44fc965069..e5008b81fe5 100644--- a/api/tests/e2e_tests/containers/pyrefly.toml+++ b/api/tests/e2e_tests/containers/pyrefly.toml@@ -11,32 +11,23 @@ project-excludes = ["commands/test_legacy_model_type_migration.py","controllers/console/app/test_chat_conversation_status_count_api.py","controllers/console/app/test_workflow_draft_variable.py",- "controllers/console/test_api_based_extension.py",- "controllers/console/test_apikey.py","controllers/console/workspace/test_workspace_wraps.py",- "controllers/openapi/test_account.py","controllers/openapi/test_account_sessions.py",- "controllers/openapi/test_app_run.py","controllers/openapi/test_workspaces.py",- "controllers/service_api/dataset/test_dataset.py","controllers/web/test_site.py","controllers/web/test_wraps.py","core/rag/pipeline/test_queue_integration.py","core/rag/retrieval/test_dataset_retrieval_integration.py","core/workflow/test_human_input_resume_node_execution.py","factories/test_storage_key_loader.py",- "helpers/__init__.py","helpers/execution_extra_content.py","libs/broadcast_channel/redis/test_channel.py","libs/broadcast_channel/redis/test_sharded_channel.py","libs/broadcast_channel/redis/test_streams_channel.py",- "libs/test_auto_renew_redis_lock_integration.py","models/test_conversation_message_inputs.py","models/test_types_enum_text.py",- "repositories/test_sqlalchemy_api_workflow_run_repository.py","repositories/test_sqlalchemy_execution_extra_content_repository.py","repositories/test_sqlalchemy_workflow_node_execution_repository.py",- "repositories/test_workflow_run_repository.py","services/auth/test_auth_integration.py","services/dataset_service_update_delete.py","services/document_service_status.py",@@ -63,7 +54,6 @@ project-excludes = ["services/test_human_input_delivery_test.py","services/test_message_export_service.py","services/test_message_service_execution_extra_content.py",- "services/test_message_service_extra_contents.py","services/test_messages_clean_service.py","services/test_model_load_balancing_service.py","services/test_model_provider_service.py",diff --git a/api/tests/e2e_tests/containers/repositories/test_sqlalchemy_api_workflow_run_repository.py b/api/tests/e2e_tests/containers/repositories/test_sqlalchemy_api_workflow_run_repository.pyindex 618d4af848c..50aabad8f1d 100644--- a/api/tests/e2e_tests/containers/repositories/test_sqlalchemy_api_workflow_run_repository.py+++ b/api/tests/e2e_tests/containers/repositories/test_sqlalchemy_api_workflow_run_repository.py@@ -3,6 +3,7 @@from __future__ import annotationsimport secrets+from collections.abc import Iteratorfrom dataclasses import dataclass, fieldfrom datetime import datetime, timedeltafrom unittest.mock import Mock, patch@@ -147,7 +148,7 @@ def repository(db_session_with_containers: Session) -> DifyAPISQLAlchemyWorkflow@pytest.fixture-def test_scope(db_session_with_containers: Session) -> _TestScope:+def test_scope(db_session_with_containers: Session) -> Iterator[_TestScope]:"""Provide an isolated scope and clean related data after each test."""scope = _TestScope()diff --git a/api/tests/e2e_tests/containers/repositories/test_workflow_run_repository.py b/api/tests/e2e_tests/containers/repositories/test_workflow_run_repository.pyindex 9b5013782b1..6b9cab5e10d 100644--- a/api/tests/e2e_tests/containers/repositories/test_workflow_run_repository.py+++ b/api/tests/e2e_tests/containers/repositories/test_workflow_run_repository.py@@ -2,6 +2,7 @@from __future__ import annotations+from collections.abc import Iteratorfrom dataclasses import dataclass, fieldfrom datetime import timedeltafrom uuid import uuid4@@ -86,7 +87,7 @@ def repository(db_session_with_containers: Session) -> DifyAPISQLAlchemyWorkflow@pytest.fixture-def test_scope(db_session_with_containers: Session) -> _TestScope:+def test_scope(db_session_with_containers: Session) -> Iterator[_TestScope]:"""Provide an isolated scope and clean related data after each test."""scope = _TestScope()yield scopediff --git a/api/tests/e2e_tests/containers/services/test_message_service_extra_contents.py b/api/tests/e2e_tests/containers/services/test_message_service_extra_contents.pyindex baec028ead7..51240479403 100644--- a/api/tests/e2e_tests/containers/services/test_message_service_extra_contents.py+++ b/api/tests/e2e_tests/containers/services/test_message_service_extra_contents.py@@ -6,7 +6,7 @@ import pytestfrom sqlalchemy.orm import Session, sessionmakerfrom libs.helper import to_timestamp-from models.enums import ConversationFromSource+from models.enums import ConversationFromSource, MessageStatusfrom models.model import Messagefrom repositories.message_repository import MessageRepositoryfrom repositories.sqlalchemy_execution_extra_content_repository import SQLAlchemyExecutionExtraContentRepository@@ -41,7 +41,7 @@ def test_message_details_include_serialized_extra_contents(db_session_with_contaprovider_response_latency=0,total_price=Decimal(0),currency="USD",- status="normal",+ status=MessageStatus.NORMAL,from_source=ConversationFromSource.CONSOLE,from_account_id=fixture.account.id,)