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(api): annotate three test modules so strict pyrefly can check them (#45337)
Felix Shi7e9edeab4247
diff --git a/api/tests/unit_tests/controllers/common/test_errors.py b/api/tests/unit_tests/controllers/common/test_errors.pyindex 90fb8f3e35d..f6b6c3b823d 100644--- a/api/tests/unit_tests/controllers/common/test_errors.py+++ b/api/tests/unit_tests/controllers/common/test_errors.py@@ -92,7 +92,7 @@ def test_refresh_unavailability_has_one_documented_response(source_api: Externalclass TestFilenameNotExistsError:- def test_defaults(self):+ def test_defaults(self) -> None:error = FilenameNotExistsError()assert error.code == 400@@ -106,7 +106,7 @@ class TestFilenameNotExistsError:class TestRemoteFileUploadError:- def test_defaults(self):+ def test_defaults(self) -> None:error = RemoteFileUploadError()assert error.code == 400@@ -160,7 +160,7 @@ def test_remote_file_errors(class TestFileTooLargeError:- def test_defaults(self):+ def test_defaults(self) -> None:error = FileTooLargeError()assert error.code == 413@@ -169,7 +169,7 @@ class TestFileTooLargeError:class TestUnsupportedFileTypeError:- def test_defaults(self):+ def test_defaults(self) -> None:error = UnsupportedFileTypeError()assert error.code == 415@@ -178,7 +178,7 @@ class TestUnsupportedFileTypeError:class TestBlockedFileExtensionError:- def test_defaults(self):+ def test_defaults(self) -> None:error = BlockedFileExtensionError()assert error.code == 400@@ -187,7 +187,7 @@ class TestBlockedFileExtensionError:class TestTooManyFilesError:- def test_defaults(self):+ def test_defaults(self) -> None:error = TooManyFilesError()assert error.code == 400@@ -196,7 +196,7 @@ class TestTooManyFilesError:class TestNoFileUploadedError:- def test_defaults(self):+ def test_defaults(self) -> None:error = NoFileUploadedError()assert error.code == 400diff --git a/api/tests/unit_tests/controllers/common/test_file_response.py b/api/tests/unit_tests/controllers/common/test_file_response.pyindex b7500fb7f99..3641b03f67e 100644--- a/api/tests/unit_tests/controllers/common/test_file_response.py+++ b/api/tests/unit_tests/controllers/common/test_file_response.py@@ -8,18 +8,18 @@ from controllers.common.file_response import (class TestNormalizeMimeType:- def test_returns_empty_string_for_none(self):+ def test_returns_empty_string_for_none(self) -> None:assert _normalize_mime_type(None) == ""- def test_returns_empty_string_for_empty_string(self):+ def test_returns_empty_string_for_empty_string(self) -> None:assert _normalize_mime_type("") == ""- def test_normalizes_mime_type(self):+ def test_normalizes_mime_type(self) -> None:assert _normalize_mime_type("Text/HTML; Charset=UTF-8") == "text/html"class TestIsHtmlContent:- def test_detects_html_via_mime_type(self):+ def test_detects_html_via_mime_type(self) -> None:mime_type = "text/html; charset=UTF-8"result = is_html_content(@@ -30,7 +30,7 @@ class TestIsHtmlContent:assert result is True- def test_detects_html_via_extension_argument(self):+ def test_detects_html_via_extension_argument(self) -> None:result = is_html_content(mime_type="text/plain",filename=None,@@ -39,7 +39,7 @@ class TestIsHtmlContent:assert result is True- def test_detects_html_via_filename_extension(self):+ def test_detects_html_via_filename_extension(self) -> None:result = is_html_content(mime_type="text/plain",filename="report.html",@@ -48,7 +48,7 @@ class TestIsHtmlContent:assert result is True- def test_returns_false_when_no_html_detected_anywhere(self):+ def test_returns_false_when_no_html_detected_anywhere(self) -> None:"""Missing negative test:- MIME type is not HTML@@ -63,7 +63,7 @@ class TestIsHtmlContent:assert result is False- def test_returns_false_when_all_inputs_are_none(self):+ def test_returns_false_when_all_inputs_are_none(self) -> None:result = is_html_content(mime_type=None,filename=None,@@ -74,7 +74,7 @@ class TestIsHtmlContent:class TestEnforceDownloadForHtml:- def test_sets_attachment_when_filename_missing(self):+ def test_sets_attachment_when_filename_missing(self) -> None:response = Response("payload", mimetype="text/html")updated = enforce_download_for_html(@@ -89,7 +89,7 @@ class TestEnforceDownloadForHtml:assert response.headers["Content-Type"] == "application/octet-stream"assert response.headers["X-Content-Type-Options"] == "nosniff"- def test_sets_headers_when_filename_present(self):+ def test_sets_headers_when_filename_present(self) -> None:response = Response("payload", mimetype="text/html")updated = enforce_download_for_html(@@ -105,7 +105,7 @@ class TestEnforceDownloadForHtml:assert response.headers["Content-Type"] == "application/octet-stream"assert response.headers["X-Content-Type-Options"] == "nosniff"- def test_does_not_modify_response_for_non_html_content(self):+ def test_does_not_modify_response_for_non_html_content(self) -> None:response = Response("payload", mimetype="text/plain")updated = enforce_download_for_html(diff --git a/api/tests/unit_tests/pyrefly.toml b/api/tests/unit_tests/pyrefly.tomlindex a1bf59b073b..ee0de4a9dec 100644--- a/api/tests/unit_tests/pyrefly.toml+++ b/api/tests/unit_tests/pyrefly.toml@@ -11,9 +11,6 @@ project-excludes = ["commands/test_retention.py","dev/test_generate_swagger_specs.py","commands/test_system.py",- "repositories/test_app_definition_query_repository.py",- "controllers/common/test_errors.py",- "controllers/common/test_file_response.py","controllers/console/app/test_agent_config_inspector.py","controllers/console/app/test_app.py","controllers/console/app/test_app_import.py",diff --git a/api/tests/unit_tests/repositories/test_app_definition_query_repository.py b/api/tests/unit_tests/repositories/test_app_definition_query_repository.pyindex f2e11d70a9f..e04af8a61a1 100644--- a/api/tests/unit_tests/repositories/test_app_definition_query_repository.py+++ b/api/tests/unit_tests/repositories/test_app_definition_query_repository.py@@ -935,7 +935,7 @@ def test_published_agent_app_parameters_use_soul_file_upload(@pytest.mark.parametrize("sqlite_session", [(Agent, AgentConfigSnapshot, AgentConfigRevision)], indirect=True)-def test_published_agent_app_parameters_requires_bound_agent(sqlite_session: Session):+def test_published_agent_app_parameters_requires_bound_agent(sqlite_session: Session) -> None:tenant_id = _stable_uuid("tenant:unbound")app_model = _app_model(tenant_id=tenant_id)@@ -944,7 +944,7 @@ def test_published_agent_app_parameters_requires_bound_agent(sqlite_session: Ses@pytest.mark.parametrize("sqlite_session", [(Agent, AgentConfigSnapshot, AgentConfigRevision)], indirect=True)-def test_published_agent_app_parameters_requires_existing_active_agent(sqlite_session: Session):+def test_published_agent_app_parameters_requires_existing_active_agent(sqlite_session: Session) -> None:requested_tenant_id = _stable_uuid("tenant:requested")agent_id = _stable_uuid("agent:cross-tenant")app_model = _app_model(tenant_id=requested_tenant_id)@@ -965,7 +965,7 @@ def test_published_agent_app_parameters_requires_existing_active_agent(sqlite_se@pytest.mark.parametrize("sqlite_session", [(Agent, AgentConfigSnapshot, AgentConfigRevision)], indirect=True)def test_published_agent_app_parameters_requires_published_agent(active_config_is_published: bool, sqlite_session: Session-):+) -> None:tenant_id = _stable_uuid(f"tenant:published:{active_config_is_published}")agent_id = _stable_uuid(f"agent:published:{active_config_is_published}")app_model = _app_model(tenant_id=tenant_id)@@ -983,7 +983,7 @@ def test_published_agent_app_parameters_requires_published_agent(@pytest.mark.parametrize("sqlite_session", [(Agent, AgentConfigSnapshot, AgentConfigRevision)], indirect=True)-def test_published_agent_app_parameters_allows_unpublished_draft_with_active_snapshot(sqlite_session: Session):+def test_published_agent_app_parameters_allows_unpublished_draft_with_active_snapshot(sqlite_session: Session) -> None:tenant_id = _stable_uuid("tenant:unpublished-draft")agent_id = _stable_uuid("agent:unpublished-draft")snapshot_id = _stable_uuid("snapshot:unpublished-draft")@@ -1014,7 +1014,7 @@ def test_published_agent_app_parameters_allows_unpublished_draft_with_active_sna@pytest.mark.parametrize("sqlite_session", [(Agent, AgentConfigSnapshot, AgentConfigRevision)], indirect=True)-def test_published_agent_app_parameters_rejects_seeded_unpublished_snapshot(sqlite_session: Session):+def test_published_agent_app_parameters_rejects_seeded_unpublished_snapshot(sqlite_session: Session) -> None:tenant_id = _stable_uuid("tenant:never-published")agent_id = _stable_uuid("agent:never-published")snapshot_id = _stable_uuid("snapshot:never-published")@@ -1041,7 +1041,7 @@ def test_published_agent_app_parameters_rejects_seeded_unpublished_snapshot(sqli@pytest.mark.parametrize("sqlite_session", [(Agent, AgentConfigSnapshot, AgentConfigRevision)], indirect=True)-def test_published_agent_app_parameters_requires_published_snapshot(sqlite_session: Session):+def test_published_agent_app_parameters_requires_published_snapshot(sqlite_session: Session) -> None:tenant_id = _stable_uuid("tenant:missing-snapshot")agent_id = _stable_uuid("agent:missing-snapshot")app_model = _app_model(tenant_id=tenant_id)@@ -1065,7 +1065,7 @@ def test_published_agent_app_parameters_requires_published_snapshot(sqlite_sessi@pytest.mark.parametrize("sqlite_session", [(Agent, AgentConfigSnapshot, AgentConfigRevision)], indirect=True)-def test_published_agent_app_parameters_allows_missing_legacy_app_model_config(sqlite_session: Session):+def test_published_agent_app_parameters_allows_missing_legacy_app_model_config(sqlite_session: Session) -> None:tenant_id = _stable_uuid("tenant:no-legacy-config")agent_id = _stable_uuid("agent:no-legacy-config")snapshot_id = _stable_uuid("snapshot:no-legacy-config")