Feat/expose advanced workflow management apis - #837
Open
javier-aliaga wants to merge 3 commits into
Open
javier-aliaga wants to merge 3 commits into
javier-aliaga wants to merge 3 commits into
Conversation
Add examples/workflow-management demonstrating the three advanced workflow management APIs reachable through client.NewWorkflowClient(): ListInstanceIDs (paginated instance listing), GetInstanceHistory and RerunWorkflowFromEvent. The example chains them the way a caller is expected to: list the instances, read one instance's history to locate a rerunnable event, then rerun from that event. Register it in the example validation matrix so CI exercises it. Relates to dapr#833 Signed-off-by: Javier Aliaga <javier@diagrid.io>
Add a "Managing workflows" section to the Go client guide covering ListInstanceIDs, GetInstanceHistory and RerunWorkflowFromEvent. All three were already reachable through client.NewWorkflowClient(), but none of them were documented. Cover the semantics that are not evident from the signatures: the pagination loop ends when the continuation token comes back nil, the page size is an upper bound rather than an exact count, and GetInstanceHistory reports NotFound once state is purged. For rerun, document that the source must be a terminal, non-child instance, that eventID is the event's own ID rather than its position in the history, and that only TaskScheduled, TimerCreated and ChildWorkflowInstanceCreated events are accepted. Spell out the replay semantics explicitly: work completed and recorded before the target event is replayed from history, but earlier work that had not completed is re-executed in the new instance, which matters for activities that are not idempotent. Relates to dapr#833 Signed-off-by: Javier Aliaga <javier@diagrid.io>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #837 +/- ##
==========================================
- Coverage 56.73% 56.71% -0.03%
==========================================
Files 52 52
Lines 3784 3784
==========================================
- Hits 2147 2146 -1
- Misses 1482 1483 +1
Partials 155 155 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The validate-examples job failed on the new example. Its expected line "worker started" is a substring of the sidecar's own log line `msg="worker started with backend dapr.actors/v1"`, which Dapr emits before the example prints anything. mechanical-markdown searches for each expected line from the start of the combined output and then requires the matched indices to ascend, so the generic phrase bound to the earlier sidecar log and the run was reported as out of order even though every line was present. Print "workflow worker started" instead, which does not appear in sidecar output, and update the assertion and sample output to match. Verified with `mm.py README.md` (exit 0, twice), the same tool and version CI installs. Relates to dapr#833 Signed-off-by: Javier Aliaga <javier@diagrid.io>
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.
Description
Closes the documentation and example gap for the advanced workflow management APIs. No SDK code was needed.
ListInstanceIDs,GetInstanceHistoryandRerunWorkflowFromEventare already reachable from the Go SDK:client.NewWorkflowClient()returns*durabletask-go/workflow.Clientdirectly, so the SDK inherits the full upstream surface. What was missing was any documentation or example for them. None of the three appeared in the Go client guide or inexamples/, and neither did 7 other management operations already available on the same client.This PR adds:
A new
examples/workflow-managementexample. It chains the three APIs the way a caller is expected to use them: list the instances, read one instance's history to locate a rerunnable event, then rerun from that event with a replacement input. Registered in thevalidate_examples.yamlmatrix so CI exercises it.A "Managing workflows" section in the Go client guide. Covers the three APIs plus the behaviour that is not evident from the signatures:
nil, and the page size is an upper bound rather than an exact count;GetInstanceHistoryreportsNotFoundonce state is purged;EventIdrather than its position in the history, and accepts onlyTaskScheduled,TimerCreatedandChildWorkflowInstanceCreatedevents;Listing requires a state store with actor support that can list keys; the Redis component in the example's
config/qualifies.Issue reference
Please reference the issue this PR will close: #833
The API list being audited comes from dapr/dapr#9729.
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: