fix: add missing @TemporalDsl receiver annotation to setRetryOptions extensions#2915
fix: add missing @TemporalDsl receiver annotation to setRetryOptions extensions#2915vikas0686 wants to merge 2 commits into
Conversation
|
Hi thanks for the contribution, I agree this is just an oversight when we added the DSL annotations we forgot to annotate the ActivityOptions {
setRetryOptions {
setInitialInterval(...) // RetryOptions.Builder — fine
setTaskQueue("q") // ActivityOptions.Builder — was silently allowed, will now fail to compile
}
}and now after we will not. Personally I think that is a reasonable break because it will be a compile time break, should be very trivial to fix (just move the function outside of |
|
@Quinn-With-Two-Ns Agreed, I think this change in behavior is fine. |
5af4ddd to
320608b
Compare
320608b to
54aedf8
Compare
|
Thanks for the review and the feedback! Just checking if there's anything else you'd like me to update or address in this PR before it's ready to merge. Happy to make any additional changes if needed. |
Problem
Three
setRetryOptionsextension functions were missing@TemporalDslon the receiver type:LocalActivityOptionsExtalready had the correct pattern:Without
@TemporalDslon the receiver, Kotlin's@DslMarkermechanism cannot enforce scope isolation. Inside asetRetryOptions { }block, the outerActivityOptions.Builder (or ChildWorkflowOptions.Builder / WorkflowOptions.Builder)remains an implicit receiver, so callers can accidentally invoke outer-scope builder methods inside the nested lambda — exactly the problem@TemporalDslis designed to prevent.FixAdded
@TemporalDslto the receiver ofsetRetryOptionsin:activity/ActivityOptionsExt.ktworkflow/ChildWorkflowOptionsExt.ktclient/WorkflowOptionsExt.ktTests
Added a standalone test in each of the three corresponding test classes that calls
setRetryOptionsdirectly on a builder instance (rather than only through the outer DSL), covering the extension function in isolation.Notes
This is a compile-time correctness fix — r Existing code that uses ```
setRetryOptions {
}