temporalio / temporalio/sdk-java
Activity options merging logic is not correct
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 433
- Forks
- 249
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 26
Description
Expected Behavior
There are six potential sources for activity options:
- WorkflowImplementationOptions#defaultActivityOptions
- WorkflowImplementationOptions#activityOptions map
- Workflow.setDefaultActivityOptions
- Workflow.applyActivityOptions map
- options argument passed to WorkflowInternal#newActivityStub
- activityMethodOptions map argument passed to WorkflowInternal#newActivityStub
When all these options are specified for the given activity type, the logical behavior is to merge them in the same order as specified above.
Actual Behavior
The current logic is split between:
and
The short description is:
-
options = options argument passed to [WorkflowInternal#newActivityStub] ? WorkflowImplementationOptions#defaultActivityOptions // not that they are not merged if the argument is present.
-
WorkflowImplementationOptions#activityOptions map is overridden by options found in activityMethodOptions map argument passed to WorkflowInternal#newActivityStub
-
options (from step 1) are overridden by a value (with the key equal to the activity type) from the map generated by step (2)
I believe that we should fix the merging logic to match the intuitive behavior explained in the "Expected Behavior" section.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the referenced logic in temporal-sdk/src/main/java/io/temporal/internal/sync/WorkflowInternal.java and ActivityInvocationHandler.java, then trace the six activity-option sources listed in the issue. Compare their current precedence with the expected order and verify that the resulting merge preserves each layer’s overrides. Done means the implementation follows the specified order for options supplied to the activity stub.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100