Repository navigation
refactor(models): pass session into WorkflowNodeExecutionModel accessors - #41968
Merged
asukaminato0721 merged 1 commit intoSep 8, 2026
Conversation
keith991001
requested review from
JohnJyong,
QuantumGhost and
laipz8200
as code owners
September 8, 2026 07:45
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-09-08 07:47:18.539855963 +0000
+++ /tmp/pyrefly_pr.txt 2026-09-08 07:47:08.930820776 +0000
@@ -3375,7 +3375,7 @@
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/controllers/console/app/test_model_config_api.py:256:36
ERROR Object of class `WorkflowRun` has no attribute `retry_index` [missing-attribute]
- --> tests/unit_tests/controllers/console/app/test_workflow_run_api.py:109:5
+ --> tests/unit_tests/controllers/console/app/test_workflow_run_api.py:110:5
ERROR Missing argument `app_model` in function `handler` [missing-argument]
--> tests/unit_tests/controllers/console/app/test_wraps.py:45:19
ERROR Unexpected keyword argument `app_id` in function `handler` [unexpected-keyword]
@@ -8337,23 +8337,23 @@
ERROR Class member `DummyRetrieval.get_type` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
--> tests/unit_tests/services/rag_pipeline/pipeline_template/test_pipeline_template_base.py:16:9
ERROR Argument `tuple[str, ...]` is not assignable to parameter `key` with type `tuple[str, str]` in function `dict.get` [bad-argument-type]
- --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:205:37
+ --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:206:37
ERROR Object of class `NoneType` has no attribute `marked_name` [missing-attribute]
- --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:489:12
-ERROR Object of class `NoneType` has no attribute `marked_comment` [missing-attribute]
--> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:490:12
+ERROR Object of class `NoneType` has no attribute `marked_comment` [missing-attribute]
+ --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:491:12
ERROR Object of class `NoneType` has no attribute `updated_by` [missing-attribute]
- --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:492:12
+ --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:493:12
ERROR Argument `dict[str, list[dict[str, dict[str, str | dict[str, str] | dict[str, int | str]]]]]` is not assignable to parameter `graph` with type `dict[str, object] | None` in function `_make_workflow` [bad-argument-type]
- --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:608:67
+ --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:609:67
ERROR Argument `() -> tuple[SimpleNamespace, Generator[NodeRunFailedEvent, Unknown]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
- --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1410:16
+ --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1411:16
ERROR Argument `() -> tuple[SimpleNamespace, Generator[object, Unknown]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
- --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1792:20
+ --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1793:20
ERROR Argument `() -> tuple[SimpleNamespace, Iterator[Any]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
- --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1812:16
+ --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1813:16
ERROR Argument `() -> tuple[SimpleNamespace, Iterator[Any]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
- --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1832:16
+ --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1833:16
ERROR No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, object]) [no-matching-overload]
--> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_transform_service.py:29:18
ERROR No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, object]) [no-matching-overload]
@@ -8643,15 +8643,15 @@
ERROR `SimpleNamespace` is not assignable to attribute `_node_execution_service_repo` with type `DifyAPIWorkflowNodeExecutionRepository` [bad-assignment]
--> tests/unit_tests/services/test_snippet_service.py:970:44
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
- --> tests/unit_tests/services/test_snippet_service.py:977:12
+ --> tests/unit_tests/services/test_snippet_service.py:979:12
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
- --> tests/unit_tests/services/test_snippet_service.py:980:9
+ --> tests/unit_tests/services/test_snippet_service.py:982:9
ERROR `SimpleNamespace` is not assignable to attribute `_node_execution_service_repo` with type `DifyAPIWorkflowNodeExecutionRepository` [bad-assignment]
- --> tests/unit_tests/services/test_snippet_service.py:1013:44
+ --> tests/unit_tests/services/test_snippet_service.py:1015:44
ERROR Object of class `FunctionType` has no attribute `assert_not_called` [missing-attribute]
- --> tests/unit_tests/services/test_snippet_service.py:1022:5
+ --> tests/unit_tests/services/test_snippet_service.py:1024:5
ERROR Object of class `NoneType` has no attribute `use_count` [missing-attribute]
- --> tests/unit_tests/services/test_snippet_service.py:1035:12
+ --> tests/unit_tests/services/test_snippet_service.py:1037:12
ERROR Could not find name `PendingRollbackError` [unknown-name]
--> tests/unit_tests/services/test_summary_index_service.py:432:19
ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
@@ -8731,21 +8731,21 @@
ERROR Argument `dict[str, str]` is not assignable to parameter `full_process_data` with type `dict[str, object] | None` in function `_repository` [bad-argument-type]
--> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:111:79
ERROR Argument `dict[str, list[dict[str, int] | dict[str, object]]]` is not assignable to parameter `process_data` with type `dict[str, object]` in function `_execution` [bad-argument-type]
- --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:128:66
+ --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:129:21
ERROR Argument `dict[str, list[dict[str, int] | dict[str, object]]]` is not assignable to parameter `full_process_data` with type `dict[str, object] | None` in function `_repository` [bad-argument-type]
- --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:128:94
+ --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:129:49
ERROR Argument `dict[str, list[dict[str, object]]]` is not assignable to parameter `process_data` with type `dict[str, object]` in function `_execution` [bad-argument-type]
- --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:137:66
+ --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:140:21
ERROR Argument `dict[str, list[dict[str, object]]]` is not assignable to parameter `full_process_data` with type `dict[str, object] | None` in function `_repository` [bad-argument-type]
- --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:137:94
+ --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:140:49
ERROR Argument `dict[str, list[dict[str, object]]]` is not assignable to parameter `process_data` with type `dict[str, object]` in function `_execution` [bad-argument-type]
- --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:145:28
+ --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:149:28
ERROR Object of class `FunctionType` has no attribute `side_effect` [missing-attribute]
- --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:147:5
+ --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:151:5
ERROR Argument `dict[str, list[dict[str, object]]]` is not assignable to parameter `process_data` with type `dict[str, object]` in function `_execution` [bad-argument-type]
- --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:156:66
+ --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:161:21
ERROR Argument `dict[str, list[dict[str, object]]]` is not assignable to parameter `full_process_data` with type `dict[str, object] | None` in function `_repository` [bad-argument-type]
- --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:156:94
+ --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:161:49
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.py:83:18
ERROR `Literal['2']` is not assignable to TypedDict key `limit` with type `int` [bad-assignment]
|
Contributor
Pyrefly Type Coverage
|
asukaminato0721
enabled auto-merge
September 8, 2026 09:26
asukaminato0721
approved these changes
Sep 8, 2026
3 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Summary
Part of #40372, follow-up to #41440 / #41911. This is the deep-water pair deliberately skipped in earlier slices.
Converts
WorkflowNodeExecutionModel.created_by_account/created_by_end_userfrom@propertyaccessors reaching for the globaldb.sessioninto methods takingsessionexplicitly, matching the already-mergedWorkflowAppLogpair in the same file. Because these two were read both implicitly and explicitly, the PR routes every consumer through an explicit session:from_attributes=True): added a session-carryingWorkflowNodeExecutionResponseSourceinfields/workflow_run_fields.py(theSegmentWithSummary/DatasetDetailResponseSourcepattern) and routed the sevenWorkflowRunNodeExecutionResponse.model_validate(...)sites across the console app / snippets / rag-pipeline controllers through it, each reusing the session the endpoint already touches.assemble_workflow_node_execution_tracesand its_retry_trace/_terminal_tracehelpers now takesession; the three service callers pass it from their own infrastructure (SnippetService._session_scope(),RagPipelineService._session, anddb.session()at the repository-onlyWorkflowRunServiceboundary).Tests
test_workflow_node_execution_accessors.py: both accessors exercised against the realsqlite_sessionfixture (role-based dispatch + None paths), plus the response source resolving through its wrapped session while proxying other attributes.dbmonkeypatch no longer carries the accessors), mock assertions in the snippet / workflow-run / rag-pipeline service tests include the new kwarg, the two controller contract tests wrap their raw ORM fixtures in the response source, and the container-integration tests call the methods with the test session.tests/unit_testsfull run: 18680 passed; the only failures are the pre-existingtest_check_no_new_getattrenvironment failures, which fail identically on a cleanmaincheckout on this machine.Screenshots
N/A (backend-only refactor).
Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint godsFrom Claude Code