Skip to content

fix: add missing @TemporalDsl receiver annotation to setRetryOptions extensions#2915

Open
vikas0686 wants to merge 1 commit into
temporalio:masterfrom
vikas0686:f/vikas/temporal-kotlin/missing-temporal-dsl
Open

fix: add missing @TemporalDsl receiver annotation to setRetryOptions extensions#2915
vikas0686 wants to merge 1 commit into
temporalio:masterfrom
vikas0686:f/vikas/temporal-kotlin/missing-temporal-dsl

Conversation

@vikas0686

Copy link
Copy Markdown
Contributor

Problem

Three setRetryOptions extension functions were missing @TemporalDsl on the receiver type:

// Before (missing annotation on receiver)
inline fun ActivityOptions.Builder.setRetryOptions(
  retryOptions: @TemporalDsl RetryOptions.Builder.() -> Unit
)

LocalActivityOptionsExt already had the correct pattern:

// Correct (receiver is annotated)
inline fun @TemporalDsl LocalActivityOptions.Builder.setRetryOptions(
  retryOptions: @TemporalDsl RetryOptions.Builder.() -> Unit
)

Without @TemporalDsl on the receiver, Kotlin's @DslMarker mechanism cannot enforce scope isolation. Inside a setRetryOptions { } block, the outer ActivityOptions.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 @TemporalDsl is designed to prevent.

Fix

Added @TemporalDsl to the receiver of setRetryOptions in:

  • activity/ActivityOptionsExt.kt
  • workflow/ChildWorkflowOptionsExt.kt
  • client/WorkflowOptionsExt.kt

Tests

Added a standalone test in each of the three corresponding test classes that calls setRetryOptions directly 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 {
}


Thanks for review and feedback

@vikas0686 vikas0686 requested a review from a team as a code owner June 13, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant