fix: add missing @TemporalDsl receiver annotation to setRetryOptions extensions#2915
Open
vikas0686 wants to merge 1 commit into
Open
Conversation
Contributor
|
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 |
Contributor
|
@Quinn-With-Two-Ns Agreed, I think this change in behavior is fine. |
5af4ddd to
320608b
Compare
320608b to
54aedf8
Compare
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.
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 {
}