feat(nexus): add async, cancellation, failure and parallel features - #871
feat(nexus): add async, cancellation, failure and parallel features#871xepozz wants to merge 2 commits into
Conversation
Four Nexus scenarios implemented in Go and Java: an async workflow-run operation, cancelling a running async operation, a sync operation that fails with an application error, and three parallel sync operations.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5d438ca6c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| return runner.Client.ExecuteWorkflow(ctx, opts, Workflow, runner.NexusEndpoint) | ||
| }, | ||
| CheckHistory: func(ctx context.Context, runner *harness.Runner, run client.WorkflowRun) error { |
There was a problem hiding this comment.
Preserve default replay in Go history checks
When this feature runs, assigning CheckHistory replaces the harness path that calls Runner.CheckHistoryDefault (harness/go/harness/runner.go lines 151-157), so neither the current executions—including the backing workflow—nor stored histories are replayed. Run the default checker after the event assertion; the same omission occurs in the other three newly added Go Nexus features.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| @Override | ||
| public void checkHistory(Runner runner, Run run) throws Exception { |
There was a problem hiding this comment.
Preserve default replay in Java history checks
Overriding checkHistory here bypasses the default implementation in Feature.java, which calls runner.checkCurrentAndPastHistories(run). Consequently this feature never replay-checks its caller or backing workflow and cannot detect compatibility regressions against saved histories; invoke the default replay helper after the custom assertion. The other three new Java Nexus features have the same omission.
Useful? React with 👍 / 👎.
| .getResult() | ||
| .handle( | ||
| (value, failure) -> { | ||
| resultHolder[0] = failure == null ? "completed" : "cancelled"; |
There was a problem hiding this comment.
Verify that the operation actually reports cancellation
When the operation result fails for any reason after scope.cancel()—for example a timeout or backing-workflow application failure—this callback labels it "cancelled", and the workflow plus history assertion still pass. Since the feature specifically promises to observe a cancellation error, inspect the failure chain for CanceledFailure rather than treating every non-null failure as cancellation.
Useful? React with 👍 / 👎.
The java handler threw a bare application failure, which the SDK reports as a handler error, so the two languages were asserting different contracts.
Four Nexus scenarios implemented in Go and Java: an async workflow-run operation, cancelling a running async operation, a sync operation that fails with an application error, and three parallel sync operations.
What was changed
Why?
Checklist
Closes
How was this tested: