Commit b3f6b23
authored
feat(workflow): align history propagation API with go-sdk
Cassie (durabletask-go author) flagged the .NET surface for cross-SDK
divergence post-merge of dotnet-sdk#1802 / #1818. This rewrites the
public history-propagation API to match the go-sdk shape — same one the
python-sdk just adopted (python-sdk#1047). Issue dotnet-sdk#1801 was
closed before her review; this PR delivers what the issue originally
described.
Three concrete gaps closed:
1. Activity-level opt-in (was missing entirely)
- PropagationScope moved from ChildWorkflowTaskOptions to base
WorkflowTaskOptions; ChildWorkflowTaskOptions inherits it.
- WithHistoryPropagation() extension method added on the base record.
- scheduleTaskAction.HistoryPropagationScope is now wired in
WorkflowOrchestrationContext.CallActivityInternalAsync so activities
can opt into propagation, matching CallChildWorkflowInternalAsync.
- Without this, the Go SDK's reference example (SettlePayment activity
using PropagateOwnHistory) literally cannot be ported to .NET.
2. Read API rewritten as high-level resolvers (was lossy FilterBy* + a
PropagatedHistoryEvent record that dropped input/output/failure
payloads)
- PropagatedHistory.FilterByAppId/InstanceId/WorkflowName removed.
- PropagatedHistory now exposes GetWorkflows(), GetWorkflowsByName(),
GetLastWorkflowByName(), GetAppIds(), GetWorkflowsByAppId(),
GetWorkflowsByInstanceId().
- New WorkflowResult class with InstanceId/AppId/Name plus
GetActivitiesByName(), GetLastActivityByName(),
GetChildWorkflowsByName(), GetLastChildWorkflowByName() — mirrors
durabletask-go's GetLastWorkflowByName / GetLastActivityByName /
GetLastChildWorkflowByName renames from durabletask-go#105.
- New ActivityResult record carries Name, Started, Completed, Failed,
Input, Output, FailureDetails — matching the Go/Python equivalents
so chain-of-custody patterns line up.
- New ChildWorkflowResult record with the equivalent shape.
3. Event payload preserved internally (was discarded by ConvertChunk)
- ConvertChunk in WorkflowOrchestrationContext now parses raw events,
walks them to resolve TaskScheduled <-> TaskCompleted/Failed and
ChildWorkflowInstanceCreated <-> ChildWorkflowInstanceCompleted/
Failed by scheduleId, and produces fully-populated ActivityResult /
ChildWorkflowResult instances. SDK retries reuse TaskExecutionId so
matching is on scheduleId (matching Go/Python semantics).
- Public API does not leak the proto HistoryEvent type — resolution
happens at construction time inside Dapr.Workflow.
Additional surface additions:
- PropagationNotFoundException for missing-name lookups (mirrors
Python's PropagationNotFoundError / Go's error returns).
- Static WorkflowHistory.PropagateLineage() / PropagateOwnHistory()
factory helpers for go-sdk call-site parity.
Removed (clean break — 1.18 unreleased): PropagatedHistoryEntry,
PropagatedHistoryEvent, HistoryEventKind, FilterByAppId,
FilterByInstanceId, FilterByWorkflowName.
Tests:
- WorkflowHistoryPropagationTests.cs rewritten end-to-end to cover the
new resolvers, query helpers, factory helpers, activity-level scope
wiring, and child-workflow-level scope wiring.
- HistoryPropagationWorkflowTests.cs (integration) updated to use
GetWorkflows().Count in place of Entries.Count.
Refs: #1801, dapr/durabletask-go#105, dapr/go-sdk#823,
dapr/python-sdk#1047
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-authored-by: nelson-parente <20144601+nelson-parente@users.noreply.github.com>1 parent 6789b6d commit b3f6b23
13 files changed
Lines changed: 803 additions & 356 deletions
File tree
- src
- Dapr.Workflow.Abstractions
- Exceptions
- Dapr.Workflow/Worker/Internal
- test
- Dapr.IntegrationTest.Workflow
- Dapr.Workflow.Test/Worker/Internal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
Lines changed: 18 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | | - | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | | - | |
| 37 | + | |
36 | 38 | | |
37 | | - | |
38 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | | - | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 48 | + | |
| 49 | + | |
47 | 50 | | |
48 | | - | |
| 51 | + | |
49 | 52 | | |
50 | 53 | | |
51 | | - | |
| 54 | + | |
52 | 55 | | |
53 | | - | |
54 | | - | |
55 | | - | |
| 56 | + | |
56 | 57 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
63 | | - | |
| 72 | + | |
| 73 | + | |
64 | 74 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
68 | 78 | | |
69 | | - | |
70 | | - | |
71 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
72 | 114 | | |
73 | 115 | | |
74 | 116 | | |
75 | | - | |
| 117 | + | |
| 118 | + | |
76 | 119 | | |
77 | | - | |
78 | | - | |
79 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
80 | 123 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
84 | 128 | | |
85 | 129 | | |
This file was deleted.
0 commit comments