Skip to content

feat(workflow): add ordering to schedule_new_workflow - #1391

Open
JoshVanL wants to merge 2 commits into
dapr:mainfrom
JoshVanL:workflow-ordering-key
Open

JoshVanL wants to merge 2 commits into
dapr:mainfrom
JoshVanL:workflow-ordering-key

Conversation

@JoshVanL

@JoshVanL JoshVanL commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

schedule_new_workflow and schedule_new_workflow_with_result, sync and
aio, take ordering=WorkflowOrdering(key, on_predecessor_failure) to queue
the workflow behind the other workflows of its app started with the same
key. OrderingFailurePolicy (CONTINUE, BLOCK, CANCEL) sets what the
workflow does when the workflow before it did not complete successfully.
Both are exported from dapr.ext.workflow. The request carries an ordering
only when one is given.

Regenerates the durabletask stubs from durabletask-protobuf v0.8.0, the
first release with WorkflowOrdering, and records its commit in
PROTO_SOURCE_COMMIT_HASH. The release also carries the workflow schedule
service (workflow_schedule_pb2 and the *WorkflowSchedule RPCs) and the
other proto additions since the last regeneration, which had not been
generated here yet.

schedule_new_workflow and schedule_new_workflow_with_result, sync and
aio, take ordering=WorkflowOrdering(key, on_predecessor_failure) to queue
the workflow behind the other workflows of its app started with the same
key. OrderingFailurePolicy (CONTINUE, BLOCK, CANCEL) sets what the
workflow does when the workflow before it did not complete successfully.
Both are exported from dapr.ext.workflow. The request carries an ordering
only when one is given.

Regenerates the durabletask stubs from durabletask-protobuf 9a0ac7b, the
merge of WorkflowOrdering, and records it in PROTO_SOURCE_COMMIT_HASH.
That commit also carries the workflow schedule service
(workflow_schedule_pb2 and the *WorkflowSchedule RPCs), which had not
been generated here yet.

Signed-off-by: joshvanl <me@joshvanl.dev>
@JoshVanL
JoshVanL requested review from a team as code owners December 2, 2026 16:01
Copilot AI balanced review requested due to automatic review settings December 2, 2026 16:01
@CasperGN CasperGN self-assigned this Dec 2, 2026
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 21.75573% with 205 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.40%. Comparing base (0e26721) to head (2e02035).

Files with missing lines Patch % Lines
.../_durabletask/internal/orchestrator_service_pb2.py 2.94% 66 Missing ⚠️
...rkflow/_durabletask/internal/history_events_pb2.py 1.78% 55 Missing ⚠️
...orkflow/_durabletask/internal/orchestration_pb2.py 2.85% 34 Missing ⚠️
...low/_durabletask/internal/workflow_schedule_pb2.py 33.33% 30 Missing ⚠️
...abletask/internal/orchestrator_service_pb2_grpc.py 51.21% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1391      +/-   ##
==========================================
- Coverage   88.72%   88.40%   -0.33%     
==========================================
  Files         166      168       +2     
  Lines       13632    13744     +112     
==========================================
+ Hits        12095    12150      +55     
- Misses       1537     1594      +57     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The ordering tests omit the sync and async schedule_new_workflow_with_result paths, leaving request key, failure policy, and returned instance ID and staged flag behavior unverified.

1 open issue
5 files not reviewed
  • dapr/ext/workflow/_durabletask/internal/backend_service_pb2.py: Generated file
  • dapr/ext/workflow/_durabletask/internal/history_events_pb2.py: Generated file
  • dapr/ext/workflow/_durabletask/internal/orchestration_pb2.py: Generated file
  • dapr/ext/workflow/_durabletask/internal/orchestrator_service_pb2.py: Generated file
  • dapr/ext/workflow/_durabletask/internal/workflow_schedule_pb2.py: Generated file
What changed in this PR

Adds optional keyed workflow ordering to the Dapr Python SDK’s synchronous and asynchronous scheduling APIs.

Changes:

  • Exports WorkflowOrdering and failure policies, forwarding ordering through both scheduling variants.
  • Regenerates durabletask bindings for ordering and workflow schedule services.
  • Adds ordering-forwarding and request-presence tests.
File Description
tests/​ext/​workflow/​test_workflow_client.py Tests synchronous ordering forwarding.
tests/​ext/​workflow/​test_workflow_client_aio.py Tests asynchronous ordering forwarding.
tests/​ext/​workflow/​durabletask/​test_client_routing.py Checks ordering in start requests.
dapr/​ext/​workflow/​workflow_ordering.py Defines ordering options and failure policies.
dapr/​ext/​workflow/​dapr_workflow_client.py Adds ordering to synchronous scheduling APIs.
dapr/​ext/​workflow/​aio/​dapr_workflow_client.py Adds ordering to asynchronous scheduling APIs.
dapr/​ext/​workflow/​_durabletask/​internal/​workflow_schedule_pb2.pyi Adds schedule message type stubs.
dapr/​ext/​workflow/​_durabletask/​internal/​workflow_schedule_pb2.py Adds generated schedule messages.
dapr/​ext/​workflow/​_durabletask/​internal/​workflow_schedule_pb2_grpc.py Adds generated gRPC compatibility checks.
dapr/​ext/​workflow/​_durabletask/​internal/​PROTO_SOURCE_COMMIT_HASH Records the updated protobuf source revision.
dapr/​ext/​workflow/​_durabletask/​internal/​orchestrator_service_pb2.pyi Types ordering and instance-prefix fields.
dapr/​ext/​workflow/​_durabletask/​internal/​orchestrator_service_pb2.py Updates request and service descriptors.
dapr/​ext/​workflow/​_durabletask/​internal/​orchestrator_service_pb2_grpc.py Adds workflow schedule RPC bindings.
dapr/​ext/​workflow/​_durabletask/​internal/​orchestration_pb2.pyi Types ordering messages and policies.
dapr/​ext/​workflow/​_durabletask/​internal/​orchestration_pb2.py Generates ordering messages and policies.
dapr/​ext/​workflow/​_durabletask/​internal/​history_events_pb2.pyi Types ordering on execution-start events.
dapr/​ext/​workflow/​_durabletask/​internal/​history_events_pb2.py Adds ordering to execution-start descriptors.
dapr/​ext/​workflow/​_durabletask/​internal/​backend_service_pb2.pyi Types backend ordering metadata.
dapr/​ext/​workflow/​_durabletask/​internal/​backend_service_pb2.py Generates backend ordering metadata.
dapr/​ext/​workflow/​_durabletask/​client.py Forwards ordering into synchronous start requests.
dapr/​ext/​workflow/​_durabletask/​aio/​client.py Forwards ordering into asynchronous start requests.
dapr/​ext/​workflow/​__init__.py Exports public ordering types.

Review effort: Balanced

instance_id=instance_id,
start_at=start_at,
app_id=app_id,
ordering=ordering.to_proto() if ordering is not None else None,
v0.8.0 is the first release with WorkflowOrdering. PROTO_SOURCE_COMMIT_HASH
records its commit. The release also carries the proto additions after
the ordering merge: workflow priority, history propagation scope, the
activity completion worker capability and the name and version of a
detached instance.

Signed-off-by: joshvanl <me@joshvanl.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants