workflow: report whether the sidecar staged an operation #1354
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 529 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.375
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1354"
general
weight: 0.35
sicoyle
Why
dapr/dapr#10909 and dapr/dapr#10910 add the
WorkflowsStagedOperationspreview. With it on, a sidecar with no workflow worker connected still accepts start, raise event, terminate, suspend, resume and rerun. It saves them and runs them once a worker connects. Today the caller gets the same OK as for an operation that ran, so it can't tell the two apart.dapr/durabletask-protobuf#60 (merged) adds
bool stagedto those six responses. dapr/durabletask-go#147 (merged) shows it to Go callers. This PR does the same for Python. The sidecar side that sets the field is dapr/dapr#11061.What
Protos. The vendored durabletask stubs are regenerated from durabletask-protobuf
caf5cc1d(the #60 merge commit) withtools/regen_durabletask_protos.shand the pinnedgrpcio-tools==1.81.1/mypy-protobuf==5.0.0. Regenerating at the old commit first gave byte-identical files, so the diff is only the proto change. The new recorded commit also carries dapr/durabletask-protobuf#58, which addsparentExecutionIdtobackend_service.proto. That shows up inbackend_service_pb2. The SDK does not use that service. I kept it so the stubs matchPROTO_SOURCE_COMMIT_HASH.Client. No existing method changes its signature or return value. Each of the six operations gets a
_with_resultvariant on both the sync and the asyncDaprWorkflowClient:| Method | Returns |
|---|---|
|
schedule_new_workflow_with_result|WorkflowScheduleResult(instance_id, staged)||
raise_workflow_event_with_result|WorkflowOperationResult(staged)||
terminate_workflow_with_result|WorkflowOperationResult(staged)||
pause_workflow_with_result|WorkflowOperationResult(staged)||
resume_workflow_with_result|WorkflowOperationResult(staged)||
rerun_workflow_from_event_with_result|WorkflowRerunResult(new_instance_id, staged)|The three result types are frozen dataclasses, exported from
dapr.ext.workflow.stagedis false when the operation ran at once, and on sidecars that never stage. Purge is never staged, so it has no variant.schedule_new_workflow_with_resultleaves out the deprecatedreuse_id_policy.The vendored engine clients (
TaskHubGrpcClient,AsyncTaskHubGrpcClient) get matching_with_resultmethods that return the response proto. The plain engine methods now call them and drop the flag, as in durabletask-go#147.Why separate methods. Four of the existing methods return
Noneand two return astr. Returning a result object from them would change their return types. A keyword flag that switches the return type needs@overloadon every method and is easy to misread. Separate methods keep old callers as they are and give new callers a typed result. The names follow Go's...WithResultmethods so the SDKs read alike.Docs:
dapr/ext/workflow/AGENTS.mdlists the new methods and types. No example is added, because none can showstaged=Trueuntil a released runtime sets it.Tests
tests/ext/workflow/test_workflow_staged.pystarts a fake sidecar on a real local gRPC server. It answers each of the six calls withstagedtrue, then false, and checks the result of every_with_resultmethod, for the sync and async clients. It also checks that the plain methods still return what they did, and that both kinds of method send the same request.Commands run, all on Python 3.12, after
uv sync --frozen --all-packages --group dev:uv run ruff check --fix && uv run ruff format: all checks passed, no changes left.uv run mypy: no issues found in 231 source files.uv run pytest tests -m "not e2e" --ignore=tests/integration --ignore=tests/examples --import-mode=importlib -o faulthandler_timeout=300(the CI test command, without coverage): 2247 passed, 41 deselected.uv run python -m unittest discover ./tests/ext/workflow: 252 tests, OK.I did not run
tests/examplesortests/integration. They need a Dapr runtime, and no released runtime setsstagedyet.🤖 Generated with Claude Code