temporalio 0.4.0-arm64-darwin → 0.6.0-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/lib/temporalio/activity/cancellation_details.rb +58 -0
- data/lib/temporalio/activity/context.rb +10 -1
- data/lib/temporalio/activity/definition.rb +41 -3
- data/lib/temporalio/activity/info.rb +25 -4
- data/lib/temporalio/activity.rb +2 -0
- data/lib/temporalio/api/activity/v1/message.rb +1 -1
- data/lib/temporalio/api/batch/v1/message.rb +7 -2
- data/lib/temporalio/api/cloud/account/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +22 -2
- data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +2 -2
- data/lib/temporalio/api/cloud/connectivityrule/v1/message.rb +29 -0
- data/lib/temporalio/api/cloud/identity/v1/message.rb +7 -2
- data/lib/temporalio/api/cloud/namespace/v1/message.rb +7 -2
- data/lib/temporalio/api/cloud/nexus/v1/message.rb +3 -2
- data/lib/temporalio/api/cloud/operation/v1/message.rb +2 -2
- data/lib/temporalio/api/cloud/region/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/resource/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/sink/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/usage/v1/message.rb +1 -1
- data/lib/temporalio/api/command/v1/message.rb +2 -2
- data/lib/temporalio/api/common/v1/grpc_status.rb +1 -1
- data/lib/temporalio/api/common/v1/message.rb +4 -2
- data/lib/temporalio/api/deployment/v1/message.rb +3 -2
- data/lib/temporalio/api/enums/v1/batch_operation.rb +2 -2
- data/lib/temporalio/api/enums/v1/command_type.rb +1 -1
- data/lib/temporalio/api/enums/v1/common.rb +5 -2
- data/lib/temporalio/api/enums/v1/deployment.rb +3 -2
- data/lib/temporalio/api/enums/v1/event_type.rb +2 -2
- data/lib/temporalio/api/enums/v1/failed_cause.rb +2 -2
- data/lib/temporalio/api/enums/v1/namespace.rb +1 -1
- data/lib/temporalio/api/enums/v1/nexus.rb +1 -1
- data/lib/temporalio/api/enums/v1/query.rb +1 -1
- data/lib/temporalio/api/enums/v1/reset.rb +1 -1
- data/lib/temporalio/api/enums/v1/schedule.rb +1 -1
- data/lib/temporalio/api/enums/v1/task_queue.rb +3 -2
- data/lib/temporalio/api/enums/v1/update.rb +1 -1
- data/lib/temporalio/api/enums/v1/workflow.rb +2 -2
- data/lib/temporalio/api/errordetails/v1/message.rb +1 -1
- data/lib/temporalio/api/export/v1/message.rb +1 -1
- data/lib/temporalio/api/failure/v1/message.rb +3 -2
- data/lib/temporalio/api/filter/v1/message.rb +1 -1
- data/lib/temporalio/api/history/v1/message.rb +4 -2
- data/lib/temporalio/api/namespace/v1/message.rb +1 -1
- data/lib/temporalio/api/nexus/v1/message.rb +2 -2
- data/lib/temporalio/api/operatorservice/v1/request_response.rb +1 -1
- data/lib/temporalio/api/operatorservice/v1/service.rb +1 -1
- data/lib/temporalio/api/payload_visitor.rb +106 -1
- data/lib/temporalio/api/protocol/v1/message.rb +1 -1
- data/lib/temporalio/api/query/v1/message.rb +1 -1
- data/lib/temporalio/api/replication/v1/message.rb +1 -1
- data/lib/temporalio/api/rules/v1/message.rb +27 -0
- data/lib/temporalio/api/schedule/v1/message.rb +2 -2
- data/lib/temporalio/api/sdk/v1/enhanced_stack_trace.rb +1 -1
- data/lib/temporalio/api/sdk/v1/task_complete_metadata.rb +1 -1
- data/lib/temporalio/api/sdk/v1/user_metadata.rb +1 -1
- data/lib/temporalio/api/sdk/v1/worker_config.rb +23 -0
- data/lib/temporalio/api/sdk/v1/workflow_metadata.rb +1 -1
- data/lib/temporalio/api/taskqueue/v1/message.rb +6 -2
- data/lib/temporalio/api/testservice/v1/request_response.rb +1 -1
- data/lib/temporalio/api/testservice/v1/service.rb +1 -1
- data/lib/temporalio/api/update/v1/message.rb +1 -1
- data/lib/temporalio/api/version/v1/message.rb +1 -1
- data/lib/temporalio/api/worker/v1/message.rb +31 -0
- data/lib/temporalio/api/workflow/v1/message.rb +14 -2
- data/lib/temporalio/api/workflowservice/v1/request_response.rb +28 -2
- data/lib/temporalio/api/workflowservice/v1/service.rb +2 -2
- data/lib/temporalio/cancellation.rb +16 -12
- data/lib/temporalio/client/async_activity_handle.rb +12 -4
- data/lib/temporalio/client/connection/cloud_service.rb +135 -0
- data/lib/temporalio/client/connection/workflow_service.rb +150 -0
- data/lib/temporalio/client/connection.rb +2 -1
- data/lib/temporalio/client/interceptor.rb +25 -7
- data/lib/temporalio/client/schedule.rb +10 -2
- data/lib/temporalio/client/with_start_workflow_operation.rb +9 -1
- data/lib/temporalio/client/workflow_handle.rb +50 -10
- data/lib/temporalio/client/workflow_update_handle.rb +9 -3
- data/lib/temporalio/client.rb +110 -6
- data/lib/temporalio/common_enums.rb +14 -0
- data/lib/temporalio/contrib/open_telemetry.rb +7 -7
- data/lib/temporalio/converters/data_converter.rb +18 -8
- data/lib/temporalio/converters/failure_converter.rb +6 -3
- data/lib/temporalio/converters/payload_converter/binary_null.rb +2 -2
- data/lib/temporalio/converters/payload_converter/binary_plain.rb +2 -2
- data/lib/temporalio/converters/payload_converter/binary_protobuf.rb +2 -2
- data/lib/temporalio/converters/payload_converter/composite.rb +6 -4
- data/lib/temporalio/converters/payload_converter/encoding.rb +4 -2
- data/lib/temporalio/converters/payload_converter/json_plain.rb +24 -7
- data/lib/temporalio/converters/payload_converter/json_protobuf.rb +2 -2
- data/lib/temporalio/converters/payload_converter.rb +16 -6
- data/lib/temporalio/error/failure.rb +19 -1
- data/lib/temporalio/error.rb +1 -1
- data/lib/temporalio/internal/bridge/3.2/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/3.3/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/3.4/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/api/activity_result/activity_result.rb +1 -1
- data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +3 -2
- data/lib/temporalio/internal/bridge/api/child_workflow/child_workflow.rb +1 -1
- data/lib/temporalio/internal/bridge/api/common/common.rb +1 -1
- data/lib/temporalio/internal/bridge/api/core_interface.rb +1 -1
- data/lib/temporalio/internal/bridge/api/external_data/external_data.rb +1 -1
- data/lib/temporalio/internal/bridge/api/nexus/nexus.rb +3 -2
- data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +2 -2
- data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +3 -2
- data/lib/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rb +1 -1
- data/lib/temporalio/internal/bridge/worker.rb +28 -4
- data/lib/temporalio/internal/bridge.rb +1 -1
- data/lib/temporalio/internal/client/implementation.rb +60 -52
- data/lib/temporalio/internal/proto_utils.rb +4 -4
- data/lib/temporalio/internal/worker/activity_worker.rb +93 -20
- data/lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb +8 -6
- data/lib/temporalio/internal/worker/workflow_instance/context.rb +66 -24
- data/lib/temporalio/internal/worker/workflow_instance/details.rb +5 -2
- data/lib/temporalio/internal/worker/workflow_instance/external_workflow_handle.rb +2 -2
- data/lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb +2 -0
- data/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb +64 -18
- data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +28 -14
- data/lib/temporalio/internal/worker/workflow_instance/replay_safe_logger.rb +5 -2
- data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +10 -4
- data/lib/temporalio/internal/worker/workflow_instance.rb +58 -23
- data/lib/temporalio/internal/worker/workflow_worker.rb +16 -6
- data/lib/temporalio/priority.rb +100 -0
- data/lib/temporalio/scoped_logger.rb +1 -1
- data/lib/temporalio/testing/activity_environment.rb +17 -2
- data/lib/temporalio/testing/workflow_environment.rb +3 -3
- data/lib/temporalio/version.rb +1 -1
- data/lib/temporalio/versioning_override.rb +56 -0
- data/lib/temporalio/worker/deployment_options.rb +45 -0
- data/lib/temporalio/worker/illegal_workflow_call_validator.rb +73 -0
- data/lib/temporalio/worker/interceptor.rb +13 -1
- data/lib/temporalio/worker/poller_behavior.rb +61 -0
- data/lib/temporalio/worker/thread_pool.rb +1 -1
- data/lib/temporalio/worker/workflow_executor/thread_pool.rb +2 -1
- data/lib/temporalio/worker/workflow_replayer.rb +12 -13
- data/lib/temporalio/worker.rb +73 -28
- data/lib/temporalio/worker_deployment_version.rb +67 -0
- data/lib/temporalio/workflow/child_workflow_handle.rb +10 -2
- data/lib/temporalio/workflow/definition.rb +187 -39
- data/lib/temporalio/workflow/external_workflow_handle.rb +3 -1
- data/lib/temporalio/workflow/info.rb +4 -1
- data/lib/temporalio/workflow.rb +134 -11
- data/lib/temporalio.rb +1 -0
- data/temporalio.gemspec +1 -0
- metadata +13 -2
| @@ -47,6 +47,21 @@ module Temporalio | |
| 47 47 | 
             
                      @workflow_raw_args = value
         | 
| 48 48 | 
             
                    end
         | 
| 49 49 |  | 
| 50 | 
            +
                    # Add workflow hints to be passed to converter for workflow args.
         | 
| 51 | 
            +
                    #
         | 
| 52 | 
            +
                    # @param hints [Array<Object>] Hints to add.
         | 
| 53 | 
            +
                    def workflow_arg_hint(*hints)
         | 
| 54 | 
            +
                      @workflow_arg_hints ||= []
         | 
| 55 | 
            +
                      @workflow_arg_hints.concat(hints)
         | 
| 56 | 
            +
                    end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                    # Set workflow result hint to be passed to converter for workflow result.
         | 
| 59 | 
            +
                    #
         | 
| 60 | 
            +
                    # @param hint [Object] Hint to set.
         | 
| 61 | 
            +
                    def workflow_result_hint(hint)
         | 
| 62 | 
            +
                      @workflow_result_hint = hint
         | 
| 63 | 
            +
                    end
         | 
| 64 | 
            +
             | 
| 50 65 | 
             
                    # Configure workflow failure exception types. This sets the types of exceptions that, if a
         | 
| 51 66 | 
             
                    # workflow-thrown exception extends, will cause the workflow/update to fail instead of suspending the workflow
         | 
| 52 67 | 
             
                    # via task failure. These are applied in addition to the worker option. If {::Exception} is set, it effectively
         | 
| @@ -55,7 +70,7 @@ module Temporalio | |
| 55 70 | 
             
                    # @param types [Array<Class<Exception>>] Exception types to turn into workflow failures.
         | 
| 56 71 | 
             
                    def workflow_failure_exception_type(*types)
         | 
| 57 72 | 
             
                      types.each do |t|
         | 
| 58 | 
            -
                        raise ArgumentError, 'All types must classes inheriting Exception' unless t.is_a?(Class) && t  | 
| 73 | 
            +
                        raise ArgumentError, 'All types must classes inheriting Exception' unless t.is_a?(Class) && t <= Exception
         | 
| 59 74 | 
             
                      end
         | 
| 60 75 | 
             
                      @workflow_failure_exception_types ||= []
         | 
| 61 76 | 
             
                      @workflow_failure_exception_types.concat(types)
         | 
| @@ -91,6 +106,15 @@ module Temporalio | |
| 91 106 | 
             
                      end
         | 
| 92 107 | 
             
                    end
         | 
| 93 108 |  | 
| 109 | 
            +
                    # Set the versioning behavior of this workflow.
         | 
| 110 | 
            +
                    #
         | 
| 111 | 
            +
                    # WARNING: This method is experimental and may change in future versions.
         | 
| 112 | 
            +
                    #
         | 
| 113 | 
            +
                    # @param behavior [VersioningBehavior] The versioning behavior.
         | 
| 114 | 
            +
                    def workflow_versioning_behavior(behavior)
         | 
| 115 | 
            +
                      @versioning_behavior = behavior
         | 
| 116 | 
            +
                    end
         | 
| 117 | 
            +
             | 
| 94 118 | 
             
                    # Mark an `initialize` as needing the workflow start arguments. Otherwise, `initialize` must accept no required
         | 
| 95 119 | 
             
                    # arguments. This must be placed above the `initialize` method or it will fail.
         | 
| 96 120 | 
             
                    #
         | 
| @@ -112,16 +136,20 @@ module Temporalio | |
| 112 136 | 
             
                    #   {Converters::RawValue} which is a raw payload wrapper, convertible with {Workflow.payload_converter}.
         | 
| 113 137 | 
             
                    # @param unfinished_policy [HandlerUnfinishedPolicy] How to treat unfinished handlers if they are still running
         | 
| 114 138 | 
             
                    #   when the workflow ends. The default warns, but this can be disabled.
         | 
| 139 | 
            +
                    # @param arg_hints [Array<Object>, nil] Argument hint(s) for the signal.
         | 
| 115 140 | 
             
                    def workflow_signal(
         | 
| 116 141 | 
             
                      name: nil,
         | 
| 117 142 | 
             
                      description: nil,
         | 
| 118 143 | 
             
                      dynamic: false,
         | 
| 119 144 | 
             
                      raw_args: false,
         | 
| 120 | 
            -
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON
         | 
| 145 | 
            +
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON,
         | 
| 146 | 
            +
                      arg_hints: nil
         | 
| 121 147 | 
             
                    )
         | 
| 122 148 | 
             
                      raise 'Cannot provide name if dynamic is true' if name && dynamic
         | 
| 123 149 |  | 
| 124 | 
            -
                      self.pending_handler_details = | 
| 150 | 
            +
                      self.pending_handler_details =
         | 
| 151 | 
            +
                        { type: :signal, name:, description:, dynamic:, raw_args:, unfinished_policy:,
         | 
| 152 | 
            +
                          arg_hints: Array(arg_hints) }
         | 
| 125 153 | 
             
                    end
         | 
| 126 154 |  | 
| 127 155 | 
             
                    # Mark the next method as a workflow query with a default name as the name of the method. Queries can not have
         | 
| @@ -135,15 +163,20 @@ module Temporalio | |
| 135 163 | 
             
                    #   it is useful to have the second parameter be `*args` and `raw_args` be true.
         | 
| 136 164 | 
             
                    # @param raw_args [Boolean] If true, does not convert arguments, but instead provides each argument as
         | 
| 137 165 | 
             
                    #   {Converters::RawValue} which is a raw payload wrapper, convertible with {Workflow.payload_converter}.
         | 
| 166 | 
            +
                    # @param arg_hints [Object, Array<Object>, nil] Argument hint(s) for the query.
         | 
| 167 | 
            +
                    # @param result_hint [Object, nil] Result hint for the query.
         | 
| 138 168 | 
             
                    def workflow_query(
         | 
| 139 169 | 
             
                      name: nil,
         | 
| 140 170 | 
             
                      description: nil,
         | 
| 141 171 | 
             
                      dynamic: false,
         | 
| 142 | 
            -
                      raw_args: false
         | 
| 172 | 
            +
                      raw_args: false,
         | 
| 173 | 
            +
                      arg_hints: nil,
         | 
| 174 | 
            +
                      result_hint: nil
         | 
| 143 175 | 
             
                    )
         | 
| 144 176 | 
             
                      raise 'Cannot provide name if dynamic is true' if name && dynamic
         | 
| 145 177 |  | 
| 146 | 
            -
                      self.pending_handler_details = { type: :query, name:, description:, dynamic:, raw_args | 
| 178 | 
            +
                      self.pending_handler_details = { type: :query, name:, description:, dynamic:, raw_args:,
         | 
| 179 | 
            +
                                                       arg_hints: Array(arg_hints), result_hint: }
         | 
| 147 180 | 
             
                    end
         | 
| 148 181 |  | 
| 149 182 | 
             
                    # Mark the next method as a workflow update with a default name as the name of the method. Updates can return
         | 
| @@ -159,16 +192,21 @@ module Temporalio | |
| 159 192 | 
             
                    #   {Converters::RawValue} which is a raw payload wrapper, convertible with {Workflow.payload_converter}.
         | 
| 160 193 | 
             
                    # @param unfinished_policy [HandlerUnfinishedPolicy] How to treat unfinished handlers if they are still running
         | 
| 161 194 | 
             
                    #   when the workflow ends. The default warns, but this can be disabled.
         | 
| 195 | 
            +
                    # @param arg_hints [Object, Array<Object>, nil] Argument hint(s) for the update.
         | 
| 196 | 
            +
                    # @param result_hint [Object, nil] Result hint for the update.
         | 
| 162 197 | 
             
                    def workflow_update(
         | 
| 163 198 | 
             
                      name: nil,
         | 
| 164 199 | 
             
                      description: nil,
         | 
| 165 200 | 
             
                      dynamic: false,
         | 
| 166 201 | 
             
                      raw_args: false,
         | 
| 167 | 
            -
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON
         | 
| 202 | 
            +
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON,
         | 
| 203 | 
            +
                      arg_hints: nil,
         | 
| 204 | 
            +
                      result_hint: nil
         | 
| 168 205 | 
             
                    )
         | 
| 169 206 | 
             
                      raise 'Cannot provide name if dynamic is true' if name && dynamic
         | 
| 170 207 |  | 
| 171 | 
            -
                      self.pending_handler_details = { type: :update, name:, description:, dynamic:, raw_args:, unfinished_policy | 
| 208 | 
            +
                      self.pending_handler_details = { type: :update, name:, description:, dynamic:, raw_args:, unfinished_policy:,
         | 
| 209 | 
            +
                                                       arg_hints: Array(arg_hints), result_hint: }
         | 
| 172 210 | 
             
                    end
         | 
| 173 211 |  | 
| 174 212 | 
             
                    # Mark the next method as a workflow update validator to the given update method. The validator is expected to
         | 
| @@ -181,6 +219,24 @@ module Temporalio | |
| 181 219 | 
             
                      self.pending_handler_details = { type: :update_validator, update_method: }
         | 
| 182 220 | 
             
                    end
         | 
| 183 221 |  | 
| 222 | 
            +
                    # Mark the next method as returning some dynamic configuraion.
         | 
| 223 | 
            +
                    #
         | 
| 224 | 
            +
                    # Because dynamic workflows may conceptually represent more than one workflow type, it may
         | 
| 225 | 
            +
                    # be desirable to have different settings for fields that would normally be passed to
         | 
| 226 | 
            +
                    # `workflow_xxx` setters, but vary based on the workflow type name or other information
         | 
| 227 | 
            +
                    # available in the workflow's context. This function will be called after the workflow's
         | 
| 228 | 
            +
                    # `initialize`, if it has one, but before the workflow's `execute` method.
         | 
| 229 | 
            +
                    #
         | 
| 230 | 
            +
                    # The method must only take self as a parameter, and any values set in the class it returns
         | 
| 231 | 
            +
                    # will override those provided to other `workflow_xxx` setters.
         | 
| 232 | 
            +
                    #
         | 
| 233 | 
            +
                    # Cannot be specified on non-dynamic workflows.
         | 
| 234 | 
            +
                    def workflow_dynamic_options
         | 
| 235 | 
            +
                      raise 'Dynamic options method can only be set on workflows using `workflow_dynamic`' unless @workflow_dynamic
         | 
| 236 | 
            +
             | 
| 237 | 
            +
                      self.pending_handler_details = { type: :dynamic_options }
         | 
| 238 | 
            +
                    end
         | 
| 239 | 
            +
             | 
| 184 240 | 
             
                    private
         | 
| 185 241 |  | 
| 186 242 | 
             
                    attr_reader :pending_handler_details
         | 
| @@ -208,6 +264,15 @@ module Temporalio | |
| 208 264 | 
             
                    # Reset details
         | 
| 209 265 | 
             
                    self.pending_handler_details = nil
         | 
| 210 266 |  | 
| 267 | 
            +
                    # Disallow kwargs in parameters
         | 
| 268 | 
            +
                    begin
         | 
| 269 | 
            +
                      if instance_method(method_name).parameters.any? { |t, _| t == :key || t == :keyreq }
         | 
| 270 | 
            +
                        raise "Workflow #{handler[:type]} cannot have keyword arguments"
         | 
| 271 | 
            +
                      end
         | 
| 272 | 
            +
                    rescue NameError
         | 
| 273 | 
            +
                      # Ignore name error
         | 
| 274 | 
            +
                    end
         | 
| 275 | 
            +
             | 
| 211 276 | 
             
                    # Initialize class variables if not done already
         | 
| 212 277 | 
             
                    @workflow_signals ||= {}
         | 
| 213 278 | 
             
                    @workflow_queries ||= {}
         | 
| @@ -215,7 +280,7 @@ module Temporalio | |
| 215 280 | 
             
                    @workflow_update_validators ||= {}
         | 
| 216 281 | 
             
                    @defined_methods ||= []
         | 
| 217 282 |  | 
| 218 | 
            -
                    defn, hash | 
| 283 | 
            +
                    defn, hash =
         | 
| 219 284 | 
             
                      case handler[:type]
         | 
| 220 285 | 
             
                      when :init
         | 
| 221 286 | 
             
                        raise "workflow_init was applied to #{method_name} instead of initialize" if method_name != :initialize
         | 
| @@ -239,23 +304,33 @@ module Temporalio | |
| 239 304 | 
             
                          to_invoke: method_name,
         | 
| 240 305 | 
             
                          description: handler[:description],
         | 
| 241 306 | 
             
                          raw_args: handler[:raw_args],
         | 
| 242 | 
            -
                          unfinished_policy: handler[:unfinished_policy]
         | 
| 243 | 
            -
             | 
| 307 | 
            +
                          unfinished_policy: handler[:unfinished_policy],
         | 
| 308 | 
            +
                          arg_hints: handler[:arg_hints]
         | 
| 309 | 
            +
                        ), @workflow_signals]
         | 
| 244 310 | 
             
                      when :query
         | 
| 245 311 | 
             
                        [Query.new(
         | 
| 246 312 | 
             
                          name: handler[:dynamic] ? nil : (handler[:name] || method_name).to_s,
         | 
| 247 313 | 
             
                          to_invoke: method_name,
         | 
| 248 314 | 
             
                          description: handler[:description],
         | 
| 249 | 
            -
                          raw_args: handler[:raw_args]
         | 
| 250 | 
            -
             | 
| 315 | 
            +
                          raw_args: handler[:raw_args],
         | 
| 316 | 
            +
                          arg_hints: handler[:arg_hints],
         | 
| 317 | 
            +
                          result_hint: handler[:result_hint]
         | 
| 318 | 
            +
                        ), @workflow_queries]
         | 
| 251 319 | 
             
                      when :update
         | 
| 252 320 | 
             
                        [Update.new(
         | 
| 253 321 | 
             
                          name: handler[:dynamic] ? nil : (handler[:name] || method_name).to_s,
         | 
| 254 322 | 
             
                          to_invoke: method_name,
         | 
| 255 323 | 
             
                          description: handler[:description],
         | 
| 256 324 | 
             
                          raw_args: handler[:raw_args],
         | 
| 257 | 
            -
                          unfinished_policy: handler[:unfinished_policy]
         | 
| 258 | 
            -
             | 
| 325 | 
            +
                          unfinished_policy: handler[:unfinished_policy],
         | 
| 326 | 
            +
                          arg_hints: handler[:arg_hints],
         | 
| 327 | 
            +
                          result_hint: handler[:result_hint]
         | 
| 328 | 
            +
                        ), @workflow_updates]
         | 
| 329 | 
            +
                      when :dynamic_options
         | 
| 330 | 
            +
                        raise 'Dynamic options method already set' if @dynamic_options_method
         | 
| 331 | 
            +
             | 
| 332 | 
            +
                        @dynamic_options_method = method_name
         | 
| 333 | 
            +
                        return
         | 
| 259 334 | 
             
                      else
         | 
| 260 335 | 
             
                        raise "Unrecognized handler type #{handler[:type]}"
         | 
| 261 336 | 
             
                      end
         | 
| @@ -266,8 +341,6 @@ module Temporalio | |
| 266 341 | 
             
                    if other && other.to_invoke != method_name
         | 
| 267 342 | 
             
                      raise "Workflow #{handler[:type].name} #{defn.name || '<dynamic>'} defined on " \
         | 
| 268 343 | 
             
                            "different methods #{other.to_invoke} and #{method_name}"
         | 
| 269 | 
            -
                    elsif defn.name && other_hashes.any? { |h| h.include?(defn.name) }
         | 
| 270 | 
            -
                      raise "Workflow signal #{defn.name} already defined as a different handler type"
         | 
| 271 344 | 
             
                    end
         | 
| 272 345 | 
             
                    hash[defn.name] = defn
         | 
| 273 346 |  | 
| @@ -293,7 +366,7 @@ module Temporalio | |
| 293 366 | 
             
                  end
         | 
| 294 367 |  | 
| 295 368 | 
             
                  # @!visibility private
         | 
| 296 | 
            -
                  def self. | 
| 369 | 
            +
                  def self._workflow_type_and_hints_from_workflow_parameter(workflow)
         | 
| 297 370 | 
             
                    case workflow
         | 
| 298 371 | 
             
                    when Class
         | 
| 299 372 | 
             
                      unless workflow < Definition
         | 
| @@ -301,11 +374,15 @@ module Temporalio | |
| 301 374 | 
             
                      end
         | 
| 302 375 |  | 
| 303 376 | 
             
                      info = Info.from_class(workflow)
         | 
| 304 | 
            -
                       | 
| 377 | 
            +
                      raise(ArgumentError, 'Cannot pass dynamic workflow to start') unless info.name
         | 
| 378 | 
            +
             | 
| 379 | 
            +
                      [info.name.to_s, info.arg_hints, info.result_hint]
         | 
| 305 380 | 
             
                    when Info
         | 
| 306 | 
            -
                       | 
| 381 | 
            +
                      raise(ArgumentError, 'Cannot pass dynamic workflow to start') unless workflow.name
         | 
| 382 | 
            +
             | 
| 383 | 
            +
                      [workflow.name.to_s, nil, nil]
         | 
| 307 384 | 
             
                    when String, Symbol
         | 
| 308 | 
            -
                      workflow.to_s
         | 
| 385 | 
            +
                      [workflow.to_s, nil, nil]
         | 
| 309 386 | 
             
                    else
         | 
| 310 387 | 
             
                      raise ArgumentError, 'Workflow is not a workflow class or string/symbol'
         | 
| 311 388 | 
             
                    end
         | 
| @@ -318,6 +395,11 @@ module Temporalio | |
| 318 395 | 
             
                      raise "Leftover #{pending_handler_details&.[](:type)} handler not applied to a method"
         | 
| 319 396 | 
             
                    end
         | 
| 320 397 |  | 
| 398 | 
            +
                    # Disallow kwargs in execute parameters
         | 
| 399 | 
            +
                    if instance_method(:execute).parameters.any? { |t, _| t == :key || t == :keyreq }
         | 
| 400 | 
            +
                      raise 'Workflow execute cannot have keyword arguments'
         | 
| 401 | 
            +
                    end
         | 
| 402 | 
            +
             | 
| 321 403 | 
             
                    # Apply all update validators before merging with super
         | 
| 322 404 | 
             
                    updates = @workflow_updates&.dup || {}
         | 
| 323 405 | 
             
                    @workflow_update_validators&.each_value do |validator|
         | 
| @@ -387,6 +469,10 @@ module Temporalio | |
| 387 469 |  | 
| 388 470 | 
             
                    raise 'Workflow cannot be given a name and be dynamic' if dynamic && override_name
         | 
| 389 471 |  | 
| 472 | 
            +
                    if !dynamic && !@dynamic_options_method.nil?
         | 
| 473 | 
            +
                      raise 'Workflow cannot have a dynamic_options_method unless it is dynamic'
         | 
| 474 | 
            +
                    end
         | 
| 475 | 
            +
             | 
| 390 476 | 
             
                    Info.new(
         | 
| 391 477 | 
             
                      workflow_class: self,
         | 
| 392 478 | 
             
                      override_name:,
         | 
| @@ -396,7 +482,11 @@ module Temporalio | |
| 396 482 | 
             
                      failure_exception_types: @workflow_failure_exception_types || [],
         | 
| 397 483 | 
             
                      signals:,
         | 
| 398 484 | 
             
                      queries:,
         | 
| 399 | 
            -
                      updates | 
| 485 | 
            +
                      updates:,
         | 
| 486 | 
            +
                      versioning_behavior: @versioning_behavior || VersioningBehavior::UNSPECIFIED,
         | 
| 487 | 
            +
                      dynamic_options_method: @dynamic_options_method,
         | 
| 488 | 
            +
                      arg_hints: @workflow_arg_hints,
         | 
| 489 | 
            +
                      result_hint: @workflow_result_hint
         | 
| 400 490 | 
             
                    )
         | 
| 401 491 | 
             
                  end
         | 
| 402 492 |  | 
| @@ -409,7 +499,8 @@ module Temporalio | |
| 409 499 | 
             
                  # Information about the workflow definition. This is usually not used directly.
         | 
| 410 500 | 
             
                  class Info
         | 
| 411 501 | 
             
                    attr_reader :workflow_class, :override_name, :dynamic, :init, :raw_args,
         | 
| 412 | 
            -
                                :failure_exception_types, :signals, :queries, :updates
         | 
| 502 | 
            +
                                :failure_exception_types, :signals, :queries, :updates, :versioning_behavior,
         | 
| 503 | 
            +
                                :dynamic_options_method, :arg_hints, :result_hint
         | 
| 413 504 |  | 
| 414 505 | 
             
                    # Derive the workflow definition info from the class.
         | 
| 415 506 | 
             
                    #
         | 
| @@ -434,7 +525,11 @@ module Temporalio | |
| 434 525 | 
             
                      failure_exception_types: [],
         | 
| 435 526 | 
             
                      signals: {},
         | 
| 436 527 | 
             
                      queries: {},
         | 
| 437 | 
            -
                      updates: {}
         | 
| 528 | 
            +
                      updates: {},
         | 
| 529 | 
            +
                      versioning_behavior: VersioningBehavior::UNSPECIFIED,
         | 
| 530 | 
            +
                      dynamic_options_method: nil,
         | 
| 531 | 
            +
                      arg_hints: nil,
         | 
| 532 | 
            +
                      result_hint: nil
         | 
| 438 533 | 
             
                    )
         | 
| 439 534 | 
             
                      @workflow_class = workflow_class
         | 
| 440 535 | 
             
                      @override_name = override_name
         | 
| @@ -445,6 +540,10 @@ module Temporalio | |
| 445 540 | 
             
                      @signals = signals.dup.freeze
         | 
| 446 541 | 
             
                      @queries = queries.dup.freeze
         | 
| 447 542 | 
             
                      @updates = updates.dup.freeze
         | 
| 543 | 
            +
                      @versioning_behavior = versioning_behavior
         | 
| 544 | 
            +
                      @dynamic_options_method = dynamic_options_method
         | 
| 545 | 
            +
                      @arg_hints = arg_hints
         | 
| 546 | 
            +
                      @result_hint = result_hint
         | 
| 448 547 | 
             
                      Internal::ProtoUtils.assert_non_reserved_name(name)
         | 
| 449 548 | 
             
                    end
         | 
| 450 549 |  | 
| @@ -457,15 +556,17 @@ module Temporalio | |
| 457 556 | 
             
                  # A signal definition. This is usually built as a result of a {Definition.workflow_signal} method, but can be
         | 
| 458 557 | 
             
                  # manually created to set at runtime on {Workflow.signal_handlers}.
         | 
| 459 558 | 
             
                  class Signal
         | 
| 460 | 
            -
                    attr_reader :name, :to_invoke, :description, :raw_args, :unfinished_policy
         | 
| 559 | 
            +
                    attr_reader :name, :to_invoke, :description, :raw_args, :unfinished_policy, :arg_hints
         | 
| 461 560 |  | 
| 462 561 | 
             
                    # @!visibility private
         | 
| 463 | 
            -
                    def self. | 
| 562 | 
            +
                    def self._name_and_hints_from_parameter(signal)
         | 
| 464 563 | 
             
                      case signal
         | 
| 465 564 | 
             
                      when Workflow::Definition::Signal
         | 
| 466 | 
            -
                         | 
| 565 | 
            +
                        raise(ArgumentError, 'Cannot call dynamic signal directly') unless signal.name
         | 
| 566 | 
            +
             | 
| 567 | 
            +
                        [signal.name, signal.arg_hints]
         | 
| 467 568 | 
             
                      when String, Symbol
         | 
| 468 | 
            -
                        signal.to_s
         | 
| 569 | 
            +
                        [signal.to_s, nil]
         | 
| 469 570 | 
             
                      else
         | 
| 470 571 | 
             
                        raise ArgumentError, 'Signal is not a definition or string/symbol'
         | 
| 471 572 | 
             
                      end
         | 
| @@ -481,18 +582,21 @@ module Temporalio | |
| 481 582 | 
             
                    # @param raw_args [Boolean] Whether the parameters should be raw values.
         | 
| 482 583 | 
             
                    # @param unfinished_policy [HandlerUnfinishedPolicy] How the workflow reacts when this handler is still running
         | 
| 483 584 | 
             
                    #   on workflow completion.
         | 
| 585 | 
            +
                    # @param arg_hints [Array<Object>, nil] Argument hints for the signal.
         | 
| 484 586 | 
             
                    def initialize(
         | 
| 485 587 | 
             
                      name:,
         | 
| 486 588 | 
             
                      to_invoke:,
         | 
| 487 589 | 
             
                      description: nil,
         | 
| 488 590 | 
             
                      raw_args: false,
         | 
| 489 | 
            -
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON
         | 
| 591 | 
            +
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON,
         | 
| 592 | 
            +
                      arg_hints: nil
         | 
| 490 593 | 
             
                    )
         | 
| 491 594 | 
             
                      @name = name
         | 
| 492 595 | 
             
                      @to_invoke = to_invoke
         | 
| 493 596 | 
             
                      @description = description
         | 
| 494 597 | 
             
                      @raw_args = raw_args
         | 
| 495 598 | 
             
                      @unfinished_policy = unfinished_policy
         | 
| 599 | 
            +
                      @arg_hints = arg_hints
         | 
| 496 600 | 
             
                      Internal::ProtoUtils.assert_non_reserved_name(name)
         | 
| 497 601 | 
             
                    end
         | 
| 498 602 | 
             
                  end
         | 
| @@ -500,15 +604,17 @@ module Temporalio | |
| 500 604 | 
             
                  # A query definition. This is usually built as a result of a {Definition.workflow_query} method, but can be
         | 
| 501 605 | 
             
                  # manually created to set at runtime on {Workflow.query_handlers}.
         | 
| 502 606 | 
             
                  class Query
         | 
| 503 | 
            -
                    attr_reader :name, :to_invoke, :description, :raw_args
         | 
| 607 | 
            +
                    attr_reader :name, :to_invoke, :description, :raw_args, :arg_hints, :result_hint
         | 
| 504 608 |  | 
| 505 609 | 
             
                    # @!visibility private
         | 
| 506 | 
            -
                    def self. | 
| 610 | 
            +
                    def self._name_and_hints_from_parameter(query)
         | 
| 507 611 | 
             
                      case query
         | 
| 508 612 | 
             
                      when Workflow::Definition::Query
         | 
| 509 | 
            -
                         | 
| 613 | 
            +
                        raise(ArgumentError, 'Cannot call dynamic query directly') unless query.name
         | 
| 614 | 
            +
             | 
| 615 | 
            +
                        [query.name, query.arg_hints, query.result_hint]
         | 
| 510 616 | 
             
                      when String, Symbol
         | 
| 511 | 
            -
                        query.to_s
         | 
| 617 | 
            +
                        [query.to_s, nil, nil]
         | 
| 512 618 | 
             
                      else
         | 
| 513 619 | 
             
                        raise ArgumentError, 'Query is not a definition or string/symbol'
         | 
| 514 620 | 
             
                      end
         | 
| @@ -522,16 +628,22 @@ module Temporalio | |
| 522 628 | 
             
                    # @param description [String, nil] Description for this handler that may appear in CLI/UI. This is currently
         | 
| 523 629 | 
             
                    #   experimental.
         | 
| 524 630 | 
             
                    # @param raw_args [Boolean] Whether the parameters should be raw values.
         | 
| 631 | 
            +
                    # @param arg_hints [Array<Object>, nil] Argument hints for the query.
         | 
| 632 | 
            +
                    # @param result_hint [Object, nil] Result hints for the query.
         | 
| 525 633 | 
             
                    def initialize(
         | 
| 526 634 | 
             
                      name:,
         | 
| 527 635 | 
             
                      to_invoke:,
         | 
| 528 636 | 
             
                      description: nil,
         | 
| 529 | 
            -
                      raw_args: false
         | 
| 637 | 
            +
                      raw_args: false,
         | 
| 638 | 
            +
                      arg_hints: nil,
         | 
| 639 | 
            +
                      result_hint: nil
         | 
| 530 640 | 
             
                    )
         | 
| 531 641 | 
             
                      @name = name
         | 
| 532 642 | 
             
                      @to_invoke = to_invoke
         | 
| 533 643 | 
             
                      @description = description
         | 
| 534 644 | 
             
                      @raw_args = raw_args
         | 
| 645 | 
            +
                      @arg_hints = arg_hints
         | 
| 646 | 
            +
                      @result_hint = result_hint
         | 
| 535 647 | 
             
                      Internal::ProtoUtils.assert_non_reserved_name(name)
         | 
| 536 648 | 
             
                    end
         | 
| 537 649 | 
             
                  end
         | 
| @@ -539,15 +651,18 @@ module Temporalio | |
| 539 651 | 
             
                  # An update definition. This is usually built as a result of a {Definition.workflow_update} method, but can be
         | 
| 540 652 | 
             
                  # manually created to set at runtime on {Workflow.update_handlers}.
         | 
| 541 653 | 
             
                  class Update
         | 
| 542 | 
            -
                    attr_reader :name, :to_invoke, :description, :raw_args, :unfinished_policy, :validator_to_invoke
         | 
| 654 | 
            +
                    attr_reader :name, :to_invoke, :description, :raw_args, :unfinished_policy, :validator_to_invoke,
         | 
| 655 | 
            +
                                :arg_hints, :result_hint
         | 
| 543 656 |  | 
| 544 657 | 
             
                    # @!visibility private
         | 
| 545 | 
            -
                    def self. | 
| 658 | 
            +
                    def self._name_and_hints_from_parameter(update)
         | 
| 546 659 | 
             
                      case update
         | 
| 547 660 | 
             
                      when Workflow::Definition::Update
         | 
| 548 | 
            -
                         | 
| 661 | 
            +
                        raise(ArgumentError, 'Cannot call dynamic update directly') unless update.name
         | 
| 662 | 
            +
             | 
| 663 | 
            +
                        [update.name, update.arg_hints, update.result_hint]
         | 
| 549 664 | 
             
                      when String, Symbol
         | 
| 550 | 
            -
                        update.to_s
         | 
| 665 | 
            +
                        [update.to_s, nil, nil]
         | 
| 551 666 | 
             
                      else
         | 
| 552 667 | 
             
                        raise ArgumentError, 'Update is not a definition or string/symbol'
         | 
| 553 668 | 
             
                      end
         | 
| @@ -564,13 +679,17 @@ module Temporalio | |
| 564 679 | 
             
                    # @param unfinished_policy [HandlerUnfinishedPolicy] How the workflow reacts when this handler is still running
         | 
| 565 680 | 
             
                    #   on workflow completion.
         | 
| 566 681 | 
             
                    # @param validator_to_invoke [Symbol, Proc, nil] Method name or proc validator to invoke.
         | 
| 682 | 
            +
                    # @param arg_hints [Array<Object>, nil] Argument hints for the update.
         | 
| 683 | 
            +
                    # @param result_hint [Object, nil] Result hints for the update.
         | 
| 567 684 | 
             
                    def initialize(
         | 
| 568 685 | 
             
                      name:,
         | 
| 569 686 | 
             
                      to_invoke:,
         | 
| 570 687 | 
             
                      description: nil,
         | 
| 571 688 | 
             
                      raw_args: false,
         | 
| 572 689 | 
             
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON,
         | 
| 573 | 
            -
                      validator_to_invoke: nil
         | 
| 690 | 
            +
                      validator_to_invoke: nil,
         | 
| 691 | 
            +
                      arg_hints: nil,
         | 
| 692 | 
            +
                      result_hint: nil
         | 
| 574 693 | 
             
                    )
         | 
| 575 694 | 
             
                      @name = name
         | 
| 576 695 | 
             
                      @to_invoke = to_invoke
         | 
| @@ -578,6 +697,8 @@ module Temporalio | |
| 578 697 | 
             
                      @raw_args = raw_args
         | 
| 579 698 | 
             
                      @unfinished_policy = unfinished_policy
         | 
| 580 699 | 
             
                      @validator_to_invoke = validator_to_invoke
         | 
| 700 | 
            +
                      @arg_hints = arg_hints
         | 
| 701 | 
            +
                      @result_hint = result_hint
         | 
| 581 702 | 
             
                      Internal::ProtoUtils.assert_non_reserved_name(name)
         | 
| 582 703 | 
             
                    end
         | 
| 583 704 |  | 
| @@ -589,10 +710,37 @@ module Temporalio | |
| 589 710 | 
             
                        description:,
         | 
| 590 711 | 
             
                        raw_args:,
         | 
| 591 712 | 
             
                        unfinished_policy:,
         | 
| 592 | 
            -
                        validator_to_invoke | 
| 713 | 
            +
                        validator_to_invoke:,
         | 
| 714 | 
            +
                        arg_hints:,
         | 
| 715 | 
            +
                        result_hint:
         | 
| 593 716 | 
             
                      )
         | 
| 594 717 | 
             
                    end
         | 
| 595 718 | 
             
                  end
         | 
| 596 719 | 
             
                end
         | 
| 720 | 
            +
             | 
| 721 | 
            +
                DefinitionOptions = Struct.new(
         | 
| 722 | 
            +
                  :failure_exception_types,
         | 
| 723 | 
            +
                  :versioning_behavior
         | 
| 724 | 
            +
                )
         | 
| 725 | 
            +
                # @!attribute failure_exception_types
         | 
| 726 | 
            +
                #   Dynamic equivalent of {Definition.workflow_failure_exception_type}.
         | 
| 727 | 
            +
                #   Will override any types set there if set, including if set to an empty array.
         | 
| 728 | 
            +
                #   @return [Array<Class<Exception>>, nil] The failure exception types
         | 
| 729 | 
            +
                #
         | 
| 730 | 
            +
                # @!attribute versioning_behavior
         | 
| 731 | 
            +
                #   Dynamic equivalent of {Definition.workflow_versioning_behavior}.
         | 
| 732 | 
            +
                #   Will override any behavior set there if set.
         | 
| 733 | 
            +
                #   WARNING: Deployment-based versioning is experimental and APIs may change.
         | 
| 734 | 
            +
                #   @return [VersioningBehavior, nil] The versioning behavior
         | 
| 735 | 
            +
                #
         | 
| 736 | 
            +
                # @return [VersioningBehavior, nil] The versioning behavior
         | 
| 737 | 
            +
                class DefinitionOptions
         | 
| 738 | 
            +
                  def initialize(
         | 
| 739 | 
            +
                    failure_exception_types: nil,
         | 
| 740 | 
            +
                    versioning_behavior: nil
         | 
| 741 | 
            +
                  )
         | 
| 742 | 
            +
                    super
         | 
| 743 | 
            +
                  end
         | 
| 744 | 
            +
                end
         | 
| 597 745 | 
             
              end
         | 
| 598 746 | 
             
            end
         | 
| @@ -28,7 +28,9 @@ module Temporalio | |
| 28 28 | 
             
                  # @param signal [Workflow::Definition::Signal, Symbol, String] Signal definition or name.
         | 
| 29 29 | 
             
                  # @param args [Array<Object>] Signal args.
         | 
| 30 30 | 
             
                  # @param cancellation [Cancellation] Cancellation for canceling the signalling.
         | 
| 31 | 
            -
                   | 
| 31 | 
            +
                  # @param arg_hints [Array<Object>, nil] Overrides converter hints for arguments if any. If unset/nil and the
         | 
| 32 | 
            +
                  #   signal definition has arg hints, those are used by default.
         | 
| 33 | 
            +
                  def signal(signal, *args, cancellation: Workflow.cancellation, arg_hints: nil)
         | 
| 32 34 | 
             
                    raise NotImplementedError
         | 
| 33 35 | 
             
                  end
         | 
| 34 36 |  | 
| @@ -12,6 +12,7 @@ module Temporalio | |
| 12 12 | 
             
                  :last_result,
         | 
| 13 13 | 
             
                  :namespace,
         | 
| 14 14 | 
             
                  :parent,
         | 
| 15 | 
            +
                  :priority,
         | 
| 15 16 | 
             
                  :retry_policy,
         | 
| 16 17 | 
             
                  :root,
         | 
| 17 18 | 
             
                  :run_id,
         | 
| @@ -44,6 +45,8 @@ module Temporalio | |
| 44 45 | 
             
                #   @return [String] Namespace for the workflow.
         | 
| 45 46 | 
             
                # @!attribute parent
         | 
| 46 47 | 
             
                #   @return [ParentInfo, nil] Parent information for the workflow if this is a child.
         | 
| 48 | 
            +
                # @!attribute priority
         | 
| 49 | 
            +
                #   @return [Priority] The priority of this workflow.
         | 
| 47 50 | 
             
                # @!attribute retry_policy
         | 
| 48 51 | 
             
                #   @return [RetryPolicy, nil] Retry policy for the workflow.
         | 
| 49 52 | 
             
                # @!attribute root
         | 
| @@ -54,7 +57,7 @@ module Temporalio | |
| 54 57 | 
             
                # @!attribute run_timeout
         | 
| 55 58 | 
             
                #   @return [Float, nil] Run timeout for the workflow.
         | 
| 56 59 | 
             
                # @!attribute start_time
         | 
| 57 | 
            -
                #   @return [Time] Time when the workflow started.
         | 
| 60 | 
            +
                #   @return [Time] Time when the workflow started on the server.
         | 
| 58 61 | 
             
                # @!attribute task_queue
         | 
| 59 62 | 
             
                #   @return [String] Task queue for the workflow.
         | 
| 60 63 | 
             
                # @!attribute task_timeout
         |