Skip to content

refactor(test): replace SimpleNamespace with real model instances in test_snippet.py#37679

Open
lavkeshdwivedi wants to merge 8 commits into
langgenius:mainfrom
lavkeshdwivedi:refactor/test-snippet-real-model-instances
Open

refactor(test): replace SimpleNamespace with real model instances in test_snippet.py#37679
lavkeshdwivedi wants to merge 8 commits into
langgenius:mainfrom
lavkeshdwivedi:refactor/test-snippet-real-model-instances

Conversation

@lavkeshdwivedi

Copy link
Copy Markdown

Summary

Addresses #37604.

test_snippet.py used SimpleNamespace to stand in for Workflow, Account, and Tag model instances. pyrefly flags these as type errors because SimpleNamespace does not satisfy the model's type annotations.

Changes

  • Workflow(graph=...) replaces SimpleNamespace(graph=...)
  • Account() with .id / .name set replaces SimpleNamespace(id=..., name=...)
  • Tag() with .id set replaces SimpleNamespace(id=...)
  • Mock(...) replaces SimpleNamespace(...) for session stubs (consistent with the rest of the test suite)

Why real instances, not Mock(spec=...)

Per maintainer guidance in #37604: real class instances, not mocks. Real instances let pyrefly verify that the attributes being accessed (.graph, .name, .id) are actual declared fields on the model.

Test plan

  • uv run pytest api/tests/unit_tests/models/test_snippet.py passes
  • uv run pyrefly check api/tests/unit_tests/models/test_snippet.py reports no SimpleNamespace-related errors

SQLAlchemy's CursorResult.rowcount can return None for some DBAPI
drivers/operations. Five bulk-delete methods used result.rowcount
directly in += or as a return value, causing:

  TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'

Apply the `result.rowcount or 0` pattern already used in sibling
methods (delete_by_runs, count_by_runs) across all five affected sites:

- sqlalchemy_api_workflow_node_execution_repository.py
  - delete_expired_executions
  - delete_executions_by_app
  - delete_executions_by_ids
- sqlalchemy_api_workflow_run_repository.py
  - delete_runs_by_ids
  - delete_runs_by_app

Fixes langgenius#37643
Covers all five affected methods to guard against regression:
- delete_expired_executions, delete_executions_by_app,
  delete_executions_by_ids (node execution repository)
- delete_runs_by_ids, delete_runs_by_app (run repository)

Each test mocks the DBAPI session to return rowcount=None and asserts
the method returns 0 instead of raising TypeError.
…test_snippet.py

Fixes the pyrefly type errors reported in langgenius#37604.

SimpleNamespace objects passed where Workflow, Account, and Tag are
expected do not satisfy the type checker. Replace with real ORM
instances so pyrefly can verify the fields being accessed actually
exist on the model.

Also replace SimpleNamespace session stubs with unittest.mock.Mock,
which is the standard pattern in the rest of the test suite.

Refs langgenius#37604
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. refactor labels Jun 20, 2026
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-06-28 14:42:09.504122130 +0000
+++ /tmp/pyrefly_pr.txt	2026-06-28 14:41:54.421002153 +0000
@@ -457,9 +457,9 @@
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_weaviate.weaviate_vector.WeaviateVector.get_collection_name` [bad-argument-type]
    --> providers/vdb/vdb-weaviate/tests/unit_tests/test_weaviate_vector.py:177:43
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_weaviate.weaviate_vector.WeaviateVectorFactory.init_vector` [bad-argument-type]
-   --> providers/vdb/vdb-weaviate/tests/unit_tests/test_weaviate_vector.py:891:42
+   --> providers/vdb/vdb-weaviate/tests/unit_tests/test_weaviate_vector.py:887:42
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_weaviate.weaviate_vector.WeaviateVectorFactory.init_vector` [bad-argument-type]
-   --> providers/vdb/vdb-weaviate/tests/unit_tests/test_weaviate_vector.py:920:42
+   --> providers/vdb/vdb-weaviate/tests/unit_tests/test_weaviate_vector.py:916:42
 ERROR Object of class `FromClause` has no attribute `metadata` [missing-attribute]
   --> tests/helpers/legacy_model_type_migration.py:64:16
 ERROR Object of class `FromClause` has no attribute `metadata` [missing-attribute]
@@ -558,10 +558,6 @@
    --> tests/integration_tests/model_runtime/__mock/plugin_model.py:235:9
 ERROR `unpatch` may be uninitialized [unbound-name]
   --> tests/integration_tests/plugin/__mock/http.py:67:9
-ERROR Argument `FakeArchiveStorage` is not assignable to parameter `storage` with type `ArchiveStorage | None` in function `services.retention.workflow_run.archive_paid_plan_workflow_run.WorkflowRunArchiver._archive_bundle` [bad-argument-type]
-   --> tests/integration_tests/services/retention/test_workflow_run_archiver.py:412:56
-ERROR Argument `FakeArchiveStorage` is not assignable to parameter `storage` with type `ArchiveStorage | None` in function `services.retention.workflow_run.archive_paid_plan_workflow_run.WorkflowRunArchiver._archive_bundle` [bad-argument-type]
-   --> tests/integration_tests/services/retention/test_workflow_run_archiver.py:437:60
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
    --> tests/integration_tests/services/test_node_output_inspector_service.py:231:59
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
@@ -611,7 +607,7 @@
 ERROR Object of class `object` has no attribute `strip` [missing-attribute]
   --> tests/integration_tests/workflow/test_response_stream_filter_integration.py:75:37
 ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
-   --> tests/test_containers_integration_tests/controllers/console/app/test_app_apis.py:667:51
+   --> tests/test_containers_integration_tests/controllers/console/app/test_app_apis.py:658:51
 ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
    --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:247:9
 ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
@@ -625,7 +621,7 @@
 ERROR Class member `SessionMatcher.__eq__` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
   --> tests/test_containers_integration_tests/controllers/service_api/dataset/test_dataset.py:28:9
 ERROR `in` is not supported between `Literal['webapp-logo']` and `None` [not-iterable]
-   --> tests/test_containers_integration_tests/controllers/web/test_site.py:136:16
+   --> tests/test_containers_integration_tests/controllers/web/test_site.py:133:16
 ERROR Argument `SimpleNamespace` is not assignable to parameter `webapp_settings` with type `WebAppSettings | None` in function `controllers.web.wraps._validate_user_accessibility` [bad-argument-type]
   --> tests/test_containers_integration_tests/controllers/web/test_wraps.py:75:33
 ERROR Argument `SimpleNamespace` is not assignable to parameter `webapp_settings` with type `WebAppSettings | None` in function `controllers.web.wraps._validate_user_accessibility` [bad-argument-type]
@@ -665,65 +661,65 @@
 ERROR Object of class `AdvancedChatAppGenerateEntity` has no attribute `workflow_execution_id` [missing-attribute]
    --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:535:16
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:38:23
+  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:37:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:53:27
+  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:52:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:73:60
+  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:72:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:78:39
+  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:77:39
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:99:23
+  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:97:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:111:27
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:109:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:130:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:128:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:153:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:150:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:165:27
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:162:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:184:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:181:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:207:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:203:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:219:27
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:215:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:238:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:234:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:271:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:266:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:282:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:277:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:321:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:310:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:332:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:321:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:363:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:352:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:368:39
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:357:39
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:390:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:378:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:416:27
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:403:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:428:27
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:415:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:448:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:435:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:475:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:461:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:486:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:472:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:504:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:490:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:545:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:530:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:555:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:540:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:593:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:577:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:603:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:587:23
 ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_execution_repository.SQLAlchemyWorkflowExecutionRepository.__init__` [bad-argument-type]
    --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:265:29
 ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_node_execution_repository.SQLAlchemyWorkflowNodeExecutionRepository.__init__` [bad-argument-type]
@@ -785,27 +781,113 @@
 ERROR Object of class `NoneType` has no attribute `version` [missing-attribute]
   --> tests/test_containers_integration_tests/services/plugin/test_plugin_service.py:71:16
 ERROR Object of class `NoneType` has no attribute `open_id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_account_service.py:558:16
+   --> tests/test_containers_integration_tests/services/test_account_service.py:530:16
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1279:77
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1320:62
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1324:66
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1352:78
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1356:78
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1387:62
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1388:62
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1424:61
 ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:1501:16
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1434:16
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1489:62
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1490:62
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1591:67
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1592:67
 ERROR Argument `list[str]` is not assignable to parameter `roles` with type `list[TenantAccountRole]` in function `services.account_service.TenantService.has_roles` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:1698:45
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1625:45
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1651:61
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1693:67
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1694:68
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1726:61
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1758:61
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1799:67
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1800:68
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1879:61
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1920:67
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1959:67
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1960:68
 ERROR Object of class `NoneType` has no attribute `role` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2070:16
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1973:16
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2008:67
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2009:68
 ERROR Object of class `NoneType` has no attribute `role` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2128:16
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2027:16
 ERROR Object of class `NoneType` has no attribute `role` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2129:16
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2283:16
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2028:16
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2065:67
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2066:68
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2163:70
+ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2174:16
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2246:67
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2247:67
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2248:68
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2312:67
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2314:47
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2316:68
 ERROR Argument `dict[str, str | dict[str, bool]]` is not assignable to parameter `value` with type `TenantCustomConfigDict` in function `models.account.Tenant.custom_config_dict` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2461:37
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2343:37
 ERROR TypedDict `TenantCustomConfigDict` does not have key `theme` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2469:33
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2351:33
 ERROR TypedDict `TenantCustomConfigDict` does not have key `language` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2470:33
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2352:33
 ERROR TypedDict `TenantCustomConfigDict` does not have key `feature_flags` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2471:33
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2353:33
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2747:61
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2813:61
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2882:61
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2896:70
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2972:61
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2986:70
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:3198:61
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:3318:61
+ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.account_service.TenantService.create_tenant_member` [bad-argument-type]
+    --> tests/test_containers_integration_tests/services/test_account_service.py:3368:61
 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:718: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]
@@ -813,267 +895,255 @@
 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:894:63
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_agent_service.py:135:38
+   --> tests/test_containers_integration_tests/services/test_agent_service.py:134:38
 ERROR Argument `str | None` is not assignable to parameter `created_by` with type `SQLCoreOperations[str] | str` in function `models.model.MessageAgentThought.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_agent_service.py:566:24
+   --> tests/test_containers_integration_tests/services/test_agent_service.py:565:24
 ERROR Argument `str | None` is not assignable to parameter `created_by` with type `SQLCoreOperations[str] | str` in function `models.model.MessageAgentThought.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_agent_service.py:801:24
+   --> tests/test_containers_integration_tests/services/test_agent_service.py:800:24
 ERROR Argument `str | None` is not assignable to parameter `created_by` with type `SQLCoreOperations[str] | str` in function `models.model.MessageAgentThought.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_agent_service.py:965:24
+   --> tests/test_containers_integration_tests/services/test_agent_service.py:964:24
 ERROR Argument `str | None` is not assignable to parameter `created_by` with type `SQLCoreOperations[str] | str` in function `models.model.MessageAgentThought.__init__` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_agent_service.py:1006:24
+    --> tests/test_containers_integration_tests/services/test_agent_service.py:1005:24
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:103:38
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:102:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:106:81
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:105:81
 ERROR Argument `dict[str, str | Unknown | None]` is not assignable to parameter `args` with type `InsertAnnotationArgs` in function `services.annotation_service.AppAnnotationService.insert_app_annotation_directly` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:239:65
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.update_app_annotation_directly` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:285:50
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.delete_app_annotation` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:573:75
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.delete_app_annotation` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:601:92
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.delete_app_annotation` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:615:92
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:238:65
 ERROR Object of class `str` has no attribute `decode` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:693:33
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:690:33
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:910:27
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:907:27
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:956:27
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:953:27
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `id` [bad-typed-dict-key]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:998:23
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:995:23
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `score_threshold` [bad-typed-dict-key]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:999:23
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:996:23
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `embedding_model` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1000:23
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:997:23
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `embedding_model` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1001:23
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.update_app_annotation_directly` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1232:50
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.delete_app_annotation` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1303:75
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:998:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:226:45
+   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:225:45
 ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:424:39
+   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:423:39
 ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:431:34
+   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:430:34
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:448:100
+   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:447:100
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:534:85
+   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:533:85
 ERROR Argument `Literal['app']` is not assignable to parameter `value` with type `ApiTokenType | SQLCoreOperations[ApiTokenType]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_api_token_service.py:28:26
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:165:42
+   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:162:42
 ERROR Argument `Literal['simple']` is not assignable to parameter `prompt_type` with type `PromptType | SQLCoreOperations[PromptType]` in function `models.model.AppModelConfig.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:929:25
+   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:926:25
 ERROR Argument `Literal['workflow']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:952:20
+   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:949:20
 ERROR Argument `Literal['workflow']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:987:20
+   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:984:20
 ERROR Argument `Literal['workflow']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1028:20
+    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1025:20
 ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `dsl_dependencies` with type `list[PluginDependency]` in function `services.app_dsl_service.AppDslService.get_leaked_dependencies` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1314:73
+    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1311:73
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:190:38
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:189:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:449:23
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:448:23
 ERROR Argument `Literal['invalid_mode']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:518:20
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:517:20
 ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `services.app_generate_service.AppGenerateService.generate_single_loop` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:736:64
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:735:64
 ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `services.app_generate_service.AppGenerateService.generate_single_loop` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:763:64
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:762:64
 ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `services.app_generate_service.AppGenerateService.generate_single_loop` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:789:68
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:788:68
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:834:23
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:833:23
 ERROR Argument `Literal['agent-chat']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:960:20
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:959:20
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/services/test_app_service.py:87:38
+  --> tests/test_containers_integration_tests/services/test_app_service.py:86:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/services/test_app_service.py:96:33
+  --> tests/test_containers_integration_tests/services/test_app_service.py:95:33
 ERROR Argument `str` is not assignable to parameter `mode` with type `Literal['advanced-chat', 'agent', 'agent-chat', 'chat', 'completion', 'workflow']` in function `services.app_service.CreateAppParams.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:141:22
+   --> tests/test_containers_integration_tests/services/test_app_service.py:139:22
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:147:42
+   --> tests/test_containers_integration_tests/services/test_app_service.py:145:42
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:152:37
+   --> tests/test_containers_integration_tests/services/test_app_service.py:150:37
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:186:46
+   --> tests/test_containers_integration_tests/services/test_app_service.py:183:46
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:237:36
+   --> tests/test_containers_integration_tests/services/test_app_service.py:233:36
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:242:68
+   --> tests/test_containers_integration_tests/services/test_app_service.py:238:68
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:242:87
+   --> tests/test_containers_integration_tests/services/test_app_service.py:238:87
+ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
+   --> tests/test_containers_integration_tests/services/test_app_service.py:248:37
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:252:37
+   --> tests/test_containers_integration_tests/services/test_app_service.py:272:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_app_service.py:277:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_app_service.py:282:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:287:13
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:304:25
+   --> tests/test_containers_integration_tests/services/test_app_service.py:299:25
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:304:82
+   --> tests/test_containers_integration_tests/services/test_app_service.py:299:82
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:315:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:310:13
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:317:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:312:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:328:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:323:13
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:330:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:325:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:362:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:356:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:367:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:361:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:382:25
+   --> tests/test_containers_integration_tests/services/test_app_service.py:376:25
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:382:82
+   --> tests/test_containers_integration_tests/services/test_app_service.py:376:82
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:393:25
+   --> tests/test_containers_integration_tests/services/test_app_service.py:387:25
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:393:82
+   --> tests/test_containers_integration_tests/services/test_app_service.py:387:82
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:422:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:415:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:427:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:420:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:432:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:425:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:437:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:430:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:459:25
+   --> tests/test_containers_integration_tests/services/test_app_service.py:452:25
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_starred_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:459:89
+   --> tests/test_containers_integration_tests/services/test_app_service.py:452:89
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:472:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:465:13
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_starred_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:474:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:467:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:485:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:478:13
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_starred_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:487:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:480:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:538:43
+   --> tests/test_containers_integration_tests/services/test_app_service.py:530:43
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:539:49
+   --> tests/test_containers_integration_tests/services/test_app_service.py:531:49
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:543:25
+   --> tests/test_containers_integration_tests/services/test_app_service.py:535:25
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:543:82
+   --> tests/test_containers_integration_tests/services/test_app_service.py:535:82
 ERROR Object of class `NoneType` has no attribute `items` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:545:20
+   --> tests/test_containers_integration_tests/services/test_app_service.py:537:20
 ERROR Cannot index into `object` [bad-index]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:546:16
+   --> tests/test_containers_integration_tests/services/test_app_service.py:538:16
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:550:25
+   --> tests/test_containers_integration_tests/services/test_app_service.py:542:25
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:550:95
+   --> tests/test_containers_integration_tests/services/test_app_service.py:542:95
 ERROR Object of class `NoneType` has no attribute `items` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:552:20
+   --> tests/test_containers_integration_tests/services/test_app_service.py:544:20
 ERROR Cannot index into `object` [bad-index]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:553:26
+   --> tests/test_containers_integration_tests/services/test_app_service.py:545:26
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:558:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:550:13
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:560:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:552:13
 ERROR Object of class `NoneType` has no attribute `items` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:562:20
+   --> tests/test_containers_integration_tests/services/test_app_service.py:554:20
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:602:32
+   --> tests/test_containers_integration_tests/services/test_app_service.py:590:32
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:611:32
+   --> tests/test_containers_integration_tests/services/test_app_service.py:599:32
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:615:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:603:13
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:617:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:605:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:657:38
+   --> tests/test_containers_integration_tests/services/test_app_service.py:644:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:666:72
+   --> tests/test_containers_integration_tests/services/test_app_service.py:653:72
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:666:91
+   --> tests/test_containers_integration_tests/services/test_app_service.py:653:91
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:670:24
+   --> tests/test_containers_integration_tests/services/test_app_service.py:657:24
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:684:72
+   --> tests/test_containers_integration_tests/services/test_app_service.py:671:72
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:684:91
+   --> tests/test_containers_integration_tests/services/test_app_service.py:671:91
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:720:38
+   --> tests/test_containers_integration_tests/services/test_app_service.py:706:38
 ERROR Argument `dict[str, bool | str]` is not assignable to parameter `args` with type `AppService.ArgsDict` in function `services.app_service.AppService.update_app` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:744:55
+   --> tests/test_containers_integration_tests/services/test_app_service.py:730:55
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:781:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:766:13
 ERROR Missing required key `max_active_requests` for TypedDict `ArgsDict` [bad-typed-dict-key]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:800:17
+   --> tests/test_containers_integration_tests/services/test_app_service.py:785:17
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:834:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:818:13
 ERROR Missing required key `max_active_requests` for TypedDict `ArgsDict` [bad-typed-dict-key]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:854:21
+   --> tests/test_containers_integration_tests/services/test_app_service.py:838:21
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:895:38
+   --> tests/test_containers_integration_tests/services/test_app_service.py:878:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:949:38
+   --> tests/test_containers_integration_tests/services/test_app_service.py:931:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1010:38
+   --> tests/test_containers_integration_tests/services/test_app_service.py:991:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1070:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1050:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1130:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1109:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1181:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1159:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1194:70
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1172:70
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1233:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1210:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1256:70
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1233:70
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1293:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1269:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1332:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1307:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1372:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1346:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1453:13
+    --> tests/test_containers_integration_tests/services/test_app_service.p\n\n... (truncated) ...

@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 51.48% 50.89% -0.59%
Strict coverage 51.00% 50.40% -0.60%
Typed symbols 30,824 30,101 -723
Untyped symbols 29,325 29,331 +6
Modules 2931 2921 -10

@lavkeshdwivedi

Copy link
Copy Markdown
Author

Heads up on overlap with #37678 and #37680

This PR shares 4 files with two other open PRs:

File #37678 #37679 #37680
sqlalchemy_api_workflow_node_execution_repository.py
sqlalchemy_api_workflow_run_repository.py
test_sqlalchemy_api_workflow_node_execution_repository.py
test_sqlalchemy_api_workflow_run_repository.py

Whichever of the three merges first, the others will need a rebase. #37678 is a bug fix (None rowcount crash) with no Pyrefly regressions, so merging that one first would give this PR and #37680 a clean base to rebase onto.

Also noting: the Pyrefly diff for this PR introduces two new bad-instantiation errors in the repository test files that aren't present in the base — worth confirming those are expected or addressing before merge.

@lavkeshdwivedi

Copy link
Copy Markdown
Author

Fixed the two bad-instantiation pyrefly errors in a new commit (same fix as #37678 — these branches share the repository test files).

Root cause: DifyAPISQLAlchemyWorkflowNodeExecutionRepository and DifyAPISQLAlchemyWorkflowRunRepository inherit abstract methods (save, save_execution_data, get_by_workflow_execution) from their Protocol base classes that aren't implemented in the concrete service-layer classes. Pyrefly correctly flags direct instantiation.

Fix: added _ConcreteNodeRepo and _ConcreteRunRepo stub subclasses in the test files.

@lavkeshdwivedi

Copy link
Copy Markdown
Author

Friendly bump - happy to address any review feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant