Add support for workflow history propagation#1739
Conversation
|
@siri-varma this PR #1738 will fix the CI and also uses the 1.18.0 rc version. I think you need it to test this PR |
a1c39f5 to
5d732f3
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com> Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com> Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com> Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com> Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
5d732f3 to
66f5b53
Compare
Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
|
@javier-aliaga @dapr/maintainers-java-sdk Ready for reviews |
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <s_vegiraju@apple.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
durabletask-client/src/main/java/io/dapr/durabletask/PropagatedHistoryChunk.java:52
- This implementation only exposes parsed
HistoryEventobjects viagetEvents(). If downstream consumers are expected to perform chain-of-custody/signature verification on the original signed bytes (as implied by the Javadoc), there is no way to access the raw event bytes after parsing. Consider either exposing the raw event payloads onPropagatedHistoryChunk(e.g., asList<ByteString>/byte[]) or adjusting the documentation to remove the verification claim.
static PropagatedHistoryChunk fromProto(HistoryEvents.PropagatedHistoryChunk proto) {
List<HistoryEvents.HistoryEvent> parsed = new ArrayList<>(proto.getRawEventsCount());
for (int i = 0; i < proto.getRawEventsCount(); i++) {
try {
parsed.add(HistoryEvents.HistoryEvent.parseFrom(proto.getRawEvents(i)));
} catch (InvalidProtocolBufferException e) {
throw new IllegalArgumentException(
"Failed to parse raw event " + i + " in chunk for app " + proto.getAppId(), e);
}
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
| PropagatedHistory parsed = propagatedHistory != null | ||
| ? PropagatedHistory.fromProto(propagatedHistory) : null; | ||
| ContextImplTask context = new ContextImplTask(pastEvents, newEvents, parsed); |
There was a problem hiding this comment.
Should we movePropagatedHistory.fromProto into the try/catch block so we can fail the context in case of exception?
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1739 +/- ##
=========================================
Coverage 76.77% 76.78%
- Complexity 2259 2266 +7
=========================================
Files 241 241
Lines 7066 7076 +10
Branches 740 740
=========================================
+ Hits 5425 5433 +8
- Misses 1277 1280 +3
+ Partials 364 363 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| PropagatedHistory parsed = propagatedHistory != null | ||
| ? PropagatedHistory.fromProto(propagatedHistory) : null; |
There was a problem hiding this comment.
Can we have a custom exception here so it is clear that the propagated history is broken?
cicoyle
left a comment
There was a problem hiding this comment.
This is a great start 🎉 few things from me for parity and user experience
| PropagatedHistory history = historyOpt.get(); | ||
| logger.info("App2 received history (scope={}, chunks={}, apps={})", | ||
| history.getScope(), history.getWorkflows().size(), history.getAppIDs()); | ||
| for (PropagatedHistoryChunk chunk : history.getWorkflows()) { |
| history.getScope(), history.getWorkflows().size(), history.getAppIDs()); | ||
| for (PropagatedHistoryChunk chunk : history.getWorkflows()) { | ||
| logger.info(" chunk: app={} workflow={} instance={} events={}", | ||
| chunk.getAppId(), chunk.getWorkflowName(), chunk.getInstanceId(), |
There was a problem hiding this comment.
Can we add getActivityByName and getActivitiesByName? The goal was to use the chunks under the hood and expose this functionality using the history chunks. For ex, in the go-sdk we have:
...
merchantWf, err := history.GetWorkflowByName("MerchantCheckout")
card, err := processPaymentWf.GetActivityByName("ValidateCard")
...
Where a user can directly see the status of it with these exposed/user facing fields:
type ActivityResult struct {
Name string
Started bool
Completed bool
Failed bool
Input *wrapperspb.StringValue
Output *wrapperspb.StringValue
Error *protos.TaskFailureDetails
}
ActivityResult holds the status and data of a named activity.
| String input = ctx.getInput(String.class); | ||
| logger.info("=== App2 audit activity invoked with input: {} ===", input); | ||
|
|
||
| Optional<PropagatedHistory> historyOpt = ctx.getPropagatedHistory(); |
There was a problem hiding this comment.
Can we also add getChildWorkflowByName and getChildWorkflowsByName on the WorkflowResult?

Description
Please explain the changes you've made
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: