temporalio 0.4.0-aarch64-linux → 0.6.0-aarch64-linux
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.so +0 -0
- data/lib/temporalio/internal/bridge/3.3/temporalio_bridge.so +0 -0
- data/lib/temporalio/internal/bridge/3.4/temporalio_bridge.so +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
| @@ -42,6 +42,10 @@ module Temporalio | |
| 42 42 | 
             
                        @instance.current_details = (details || '')
         | 
| 43 43 | 
             
                      end
         | 
| 44 44 |  | 
| 45 | 
            +
                      def current_deployment_version
         | 
| 46 | 
            +
                        @instance.current_deployment_version
         | 
| 47 | 
            +
                      end
         | 
| 48 | 
            +
             | 
| 45 49 | 
             
                      def current_history_length
         | 
| 46 50 | 
             
                        @instance.current_history_length
         | 
| 47 51 | 
             
                      end
         | 
| @@ -58,6 +62,17 @@ module Temporalio | |
| 58 62 | 
             
                        @instance.patch(patch_id:, deprecated: true)
         | 
| 59 63 | 
             
                      end
         | 
| 60 64 |  | 
| 65 | 
            +
                      def durable_scheduler_disabled(&)
         | 
| 66 | 
            +
                        prev = Fiber.scheduler
         | 
| 67 | 
            +
                        # Imply illegal call tracing disabled
         | 
| 68 | 
            +
                        illegal_call_tracing_disabled do
         | 
| 69 | 
            +
                          Fiber.set_scheduler(nil)
         | 
| 70 | 
            +
                          yield
         | 
| 71 | 
            +
                        ensure
         | 
| 72 | 
            +
                          Fiber.set_scheduler(prev)
         | 
| 73 | 
            +
                        end
         | 
| 74 | 
            +
                      end
         | 
| 75 | 
            +
             | 
| 61 76 | 
             
                      def execute_activity(
         | 
| 62 77 | 
             
                        activity,
         | 
| 63 78 | 
             
                        *args,
         | 
| @@ -71,16 +86,22 @@ module Temporalio | |
| 71 86 | 
             
                        cancellation:,
         | 
| 72 87 | 
             
                        cancellation_type:,
         | 
| 73 88 | 
             
                        activity_id:,
         | 
| 74 | 
            -
                        disable_eager_execution | 
| 89 | 
            +
                        disable_eager_execution:,
         | 
| 90 | 
            +
                        priority:,
         | 
| 91 | 
            +
                        arg_hints:,
         | 
| 92 | 
            +
                        result_hint:
         | 
| 75 93 | 
             
                      )
         | 
| 76 | 
            -
                        activity  | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 94 | 
            +
                        activity, defn_arg_hints, defn_result_hint =
         | 
| 95 | 
            +
                          case activity
         | 
| 96 | 
            +
                          when Class
         | 
| 97 | 
            +
                            defn = Activity::Definition::Info.from_activity(activity)
         | 
| 98 | 
            +
                            [defn.name&.to_s, defn.arg_hints, defn.result_hint]
         | 
| 99 | 
            +
                          when Symbol, String
         | 
| 100 | 
            +
                            [activity.to_s, nil, nil]
         | 
| 101 | 
            +
                          else
         | 
| 102 | 
            +
                            raise ArgumentError,
         | 
| 103 | 
            +
                                  'Activity must be a definition class, or a symbol/string'
         | 
| 104 | 
            +
                          end
         | 
| 84 105 | 
             
                        raise 'Cannot invoke dynamic activities' unless activity
         | 
| 85 106 |  | 
| 86 107 | 
             
                        @outbound.execute_activity(
         | 
| @@ -98,6 +119,9 @@ module Temporalio | |
| 98 119 | 
             
                            cancellation_type:,
         | 
| 99 120 | 
             
                            activity_id:,
         | 
| 100 121 | 
             
                            disable_eager_execution: disable_eager_execution || @instance.disable_eager_activity_execution,
         | 
| 122 | 
            +
                            priority:,
         | 
| 123 | 
            +
                            arg_hints: arg_hints || defn_arg_hints,
         | 
| 124 | 
            +
                            result_hint: result_hint || defn_result_hint,
         | 
| 101 125 | 
             
                            headers: {}
         | 
| 102 126 | 
             
                          )
         | 
| 103 127 | 
             
                        )
         | 
| @@ -113,16 +137,20 @@ module Temporalio | |
| 113 137 | 
             
                        local_retry_threshold:,
         | 
| 114 138 | 
             
                        cancellation:,
         | 
| 115 139 | 
             
                        cancellation_type:,
         | 
| 116 | 
            -
                        activity_id | 
| 140 | 
            +
                        activity_id:,
         | 
| 141 | 
            +
                        arg_hints:,
         | 
| 142 | 
            +
                        result_hint:
         | 
| 117 143 | 
             
                      )
         | 
| 118 | 
            -
                        activity  | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
             | 
| 125 | 
            -
             | 
| 144 | 
            +
                        activity, defn_arg_hints, defn_result_hint =
         | 
| 145 | 
            +
                          case activity
         | 
| 146 | 
            +
                          when Class
         | 
| 147 | 
            +
                            defn = Activity::Definition::Info.from_activity(activity)
         | 
| 148 | 
            +
                            [defn.name&.to_s, defn.arg_hints, defn.result_hint]
         | 
| 149 | 
            +
                          when Symbol, String
         | 
| 150 | 
            +
                            [activity.to_s, nil, nil]
         | 
| 151 | 
            +
                          else
         | 
| 152 | 
            +
                            raise ArgumentError, 'Activity must be a definition class, or a symbol/string'
         | 
| 153 | 
            +
                          end
         | 
| 126 154 | 
             
                        raise 'Cannot invoke dynamic activities' unless activity
         | 
| 127 155 |  | 
| 128 156 | 
             
                        @outbound.execute_local_activity(
         | 
| @@ -137,6 +165,8 @@ module Temporalio | |
| 137 165 | 
             
                            cancellation:,
         | 
| 138 166 | 
             
                            cancellation_type:,
         | 
| 139 167 | 
             
                            activity_id:,
         | 
| 168 | 
            +
                            arg_hints: arg_hints || defn_arg_hints,
         | 
| 169 | 
            +
                            result_hint: result_hint || defn_result_hint,
         | 
| 140 170 | 
             
                            headers: {}
         | 
| 141 171 | 
             
                          )
         | 
| 142 172 | 
             
                        )
         | 
| @@ -245,11 +275,16 @@ module Temporalio | |
| 245 275 | 
             
                        retry_policy:,
         | 
| 246 276 | 
             
                        cron_schedule:,
         | 
| 247 277 | 
             
                        memo:,
         | 
| 248 | 
            -
                        search_attributes | 
| 278 | 
            +
                        search_attributes:,
         | 
| 279 | 
            +
                        priority:,
         | 
| 280 | 
            +
                        arg_hints:,
         | 
| 281 | 
            +
                        result_hint:
         | 
| 249 282 | 
             
                      )
         | 
| 283 | 
            +
                        workflow, defn_arg_hints, defn_result_hint =
         | 
| 284 | 
            +
                          Workflow::Definition._workflow_type_and_hints_from_workflow_parameter(workflow)
         | 
| 250 285 | 
             
                        @outbound.start_child_workflow(
         | 
| 251 286 | 
             
                          Temporalio::Worker::Interceptor::Workflow::StartChildWorkflowInput.new(
         | 
| 252 | 
            -
                            workflow | 
| 287 | 
            +
                            workflow:,
         | 
| 253 288 | 
             
                            args:,
         | 
| 254 289 | 
             
                            id:,
         | 
| 255 290 | 
             
                            task_queue:,
         | 
| @@ -266,6 +301,9 @@ module Temporalio | |
| 266 301 | 
             
                            cron_schedule:,
         | 
| 267 302 | 
             
                            memo:,
         | 
| 268 303 | 
             
                            search_attributes:,
         | 
| 304 | 
            +
                            priority:,
         | 
| 305 | 
            +
                            arg_hints: arg_hints || defn_arg_hints,
         | 
| 306 | 
            +
                            result_hint: result_hint || defn_result_hint,
         | 
| 269 307 | 
             
                            headers: {}
         | 
| 270 308 | 
             
                          )
         | 
| 271 309 | 
             
                        )
         | 
| @@ -352,26 +390,30 @@ module Temporalio | |
| 352 390 | 
             
                        @outbound = outbound
         | 
| 353 391 | 
             
                      end
         | 
| 354 392 |  | 
| 355 | 
            -
                      def _signal_child_workflow(id:, signal:, args:, cancellation:)
         | 
| 393 | 
            +
                      def _signal_child_workflow(id:, signal:, args:, cancellation:, arg_hints:)
         | 
| 394 | 
            +
                        signal, defn_arg_hints = Workflow::Definition::Signal._name_and_hints_from_parameter(signal)
         | 
| 356 395 | 
             
                        @outbound.signal_child_workflow(
         | 
| 357 396 | 
             
                          Temporalio::Worker::Interceptor::Workflow::SignalChildWorkflowInput.new(
         | 
| 358 397 | 
             
                            id:,
         | 
| 359 | 
            -
                            signal | 
| 398 | 
            +
                            signal:,
         | 
| 360 399 | 
             
                            args:,
         | 
| 361 400 | 
             
                            cancellation:,
         | 
| 401 | 
            +
                            arg_hints: arg_hints || defn_arg_hints,
         | 
| 362 402 | 
             
                            headers: {}
         | 
| 363 403 | 
             
                          )
         | 
| 364 404 | 
             
                        )
         | 
| 365 405 | 
             
                      end
         | 
| 366 406 |  | 
| 367 | 
            -
                      def _signal_external_workflow(id:, run_id:, signal:, args:, cancellation:)
         | 
| 407 | 
            +
                      def _signal_external_workflow(id:, run_id:, signal:, args:, cancellation:, arg_hints:)
         | 
| 408 | 
            +
                        signal, defn_arg_hints = Workflow::Definition::Signal._name_and_hints_from_parameter(signal)
         | 
| 368 409 | 
             
                        @outbound.signal_external_workflow(
         | 
| 369 410 | 
             
                          Temporalio::Worker::Interceptor::Workflow::SignalExternalWorkflowInput.new(
         | 
| 370 411 | 
             
                            id:,
         | 
| 371 412 | 
             
                            run_id:,
         | 
| 372 | 
            -
                            signal | 
| 413 | 
            +
                            signal:,
         | 
| 373 414 | 
             
                            args:,
         | 
| 374 415 | 
             
                            cancellation:,
         | 
| 416 | 
            +
                            arg_hints: arg_hints || defn_arg_hints,
         | 
| 375 417 | 
             
                            headers: {}
         | 
| 376 418 | 
             
                          )
         | 
| 377 419 | 
             
                        )
         | 
| @@ -8,7 +8,8 @@ module Temporalio | |
| 8 8 | 
             
                    class Details
         | 
| 9 9 | 
             
                      attr_reader :namespace, :task_queue, :definition, :initial_activation, :logger, :metric_meter,
         | 
| 10 10 | 
             
                                  :payload_converter, :failure_converter, :interceptors, :disable_eager_activity_execution,
         | 
| 11 | 
            -
                                  :illegal_calls, :workflow_failure_exception_types, :unsafe_workflow_io_enabled
         | 
| 11 | 
            +
                                  :illegal_calls, :workflow_failure_exception_types, :unsafe_workflow_io_enabled,
         | 
| 12 | 
            +
                                  :assert_valid_local_activity
         | 
| 12 13 |  | 
| 13 14 | 
             
                      def initialize(
         | 
| 14 15 | 
             
                        namespace:,
         | 
| @@ -23,7 +24,8 @@ module Temporalio | |
| 23 24 | 
             
                        disable_eager_activity_execution:,
         | 
| 24 25 | 
             
                        illegal_calls:,
         | 
| 25 26 | 
             
                        workflow_failure_exception_types:,
         | 
| 26 | 
            -
                        unsafe_workflow_io_enabled | 
| 27 | 
            +
                        unsafe_workflow_io_enabled:,
         | 
| 28 | 
            +
                        assert_valid_local_activity:
         | 
| 27 29 | 
             
                      )
         | 
| 28 30 | 
             
                        @namespace = namespace
         | 
| 29 31 | 
             
                        @task_queue = task_queue
         | 
| @@ -38,6 +40,7 @@ module Temporalio | |
| 38 40 | 
             
                        @illegal_calls = illegal_calls
         | 
| 39 41 | 
             
                        @workflow_failure_exception_types = workflow_failure_exception_types
         | 
| 40 42 | 
             
                        @unsafe_workflow_io_enabled = unsafe_workflow_io_enabled
         | 
| 43 | 
            +
                        @assert_valid_local_activity = assert_valid_local_activity
         | 
| 41 44 | 
             
                      end
         | 
| 42 45 | 
             
                    end
         | 
| 43 46 | 
             
                  end
         | 
| @@ -18,8 +18,8 @@ module Temporalio | |
| 18 18 | 
             
                        @instance = instance
         | 
| 19 19 | 
             
                      end
         | 
| 20 20 |  | 
| 21 | 
            -
                      def signal(signal, *args, cancellation: Workflow.cancellation)
         | 
| 22 | 
            -
                        @instance.context._signal_external_workflow(id:, run_id:, signal:, args:, cancellation:)
         | 
| 21 | 
            +
                      def signal(signal, *args, cancellation: Workflow.cancellation, arg_hints: nil)
         | 
| 22 | 
            +
                        @instance.context._signal_external_workflow(id:, run_id:, signal:, args:, cancellation:, arg_hints:)
         | 
| 23 23 | 
             
                      end
         | 
| 24 24 |  | 
| 25 25 | 
             
                      def cancel
         | 
| @@ -1,5 +1,6 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            require 'temporalio/worker/illegal_workflow_call_validator'
         | 
| 3 4 | 
             
            require 'temporalio/workflow'
         | 
| 4 5 |  | 
| 5 6 | 
             
            module Temporalio
         | 
| @@ -12,16 +13,32 @@ module Temporalio | |
| 12 13 | 
             
                        illegal_calls.to_h do |key, val|
         | 
| 13 14 | 
             
                          raise TypeError, 'Invalid illegal call map, top-level key must be a String' unless key.is_a?(String)
         | 
| 14 15 |  | 
| 15 | 
            -
                          # @type var fixed_val: :all | Hash[Symbol,  | 
| 16 | 
            +
                          # @type var fixed_val: :all | Worker::IllegalWorkflowCallValidator | Hash[Symbol, TrueClass | Worker::IllegalWorkflowCallValidator] # rubocop:disable Layout/LineLength
         | 
| 16 17 | 
             
                          fixed_val = case val
         | 
| 18 | 
            +
                                      when Temporalio::Worker::IllegalWorkflowCallValidator
         | 
| 19 | 
            +
                                        if val.method_name
         | 
| 20 | 
            +
                                          raise ArgumentError,
         | 
| 21 | 
            +
                                                'Top level IllegalWorkflowCallValidator instances cannot have method name'
         | 
| 22 | 
            +
                                        end
         | 
| 23 | 
            +
                                        val
         | 
| 17 24 | 
             
                                      when Array
         | 
| 18 25 | 
             
                                        val.to_h do |sub_val|
         | 
| 19 | 
            -
                                           | 
| 26 | 
            +
                                          case sub_val
         | 
| 27 | 
            +
                                          when Symbol
         | 
| 28 | 
            +
                                            [sub_val, true]
         | 
| 29 | 
            +
                                          when Temporalio::Worker::IllegalWorkflowCallValidator
         | 
| 30 | 
            +
                                            unless sub_val.method_name
         | 
| 31 | 
            +
                                              raise ArgumentError,
         | 
| 32 | 
            +
                                                    'IllegalWorkflowCallValidator instances in array for ' \
         | 
| 33 | 
            +
                                                    "#{key} must have a method name"
         | 
| 34 | 
            +
                                            end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                                            [sub_val.method_name, sub_val]
         | 
| 37 | 
            +
                                          else
         | 
| 20 38 | 
             
                                            raise TypeError,
         | 
| 21 | 
            -
                                                  'Invalid illegal call  | 
| 39 | 
            +
                                                  'Invalid illegal call array entry for ' \
         | 
| 40 | 
            +
                                                  "#{key}, each value must be a Symbol or an IllegalWorkflowCallValidator"
         | 
| 22 41 | 
             
                                          end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                                          [sub_val, true]
         | 
| 25 42 | 
             
                                        end.freeze
         | 
| 26 43 | 
             
                                      when :all
         | 
| 27 44 | 
             
                                        :all
         | 
| @@ -47,25 +64,54 @@ module Temporalio | |
| 47 64 | 
             
                          # class of things like `Date` does not have `attached_object` so you have to fall back in these rare cases
         | 
| 48 65 | 
             
                          # to parsing the string output. Reaching the string parsing component is rare, so this should not have
         | 
| 49 66 | 
             
                          # significant performance impact.
         | 
| 50 | 
            -
                           | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 67 | 
            +
                          class_name = if cls.singleton_class?
         | 
| 68 | 
            +
                                         if cls.respond_to?(:attached_object)
         | 
| 69 | 
            +
                                           cls = cls.attached_object # steep:ignore
         | 
| 70 | 
            +
                                           next unless cls.is_a?(Module)
         | 
| 54 71 |  | 
| 55 | 
            -
             | 
| 72 | 
            +
                                           cls.name.to_s
         | 
| 73 | 
            +
                                         else
         | 
| 74 | 
            +
                                           cls.to_s.delete_prefix('#<Class:').delete_suffix('>')
         | 
| 75 | 
            +
                                         end
         | 
| 56 76 | 
             
                                       else
         | 
| 57 | 
            -
                                         cls.to_s | 
| 77 | 
            +
                                         cls.name.to_s
         | 
| 58 78 | 
             
                                       end
         | 
| 59 | 
            -
                                     else
         | 
| 60 | 
            -
                                       cls.name.to_s
         | 
| 61 | 
            -
                                     end
         | 
| 62 79 |  | 
| 63 80 | 
             
                          # Check if the call is considered illegal
         | 
| 64 | 
            -
                          vals = illegal_calls[ | 
| 65 | 
            -
                           | 
| 81 | 
            +
                          vals = illegal_calls[class_name]
         | 
| 82 | 
            +
                          invalid_suffix =
         | 
| 83 | 
            +
                            case vals
         | 
| 84 | 
            +
                            when :all
         | 
| 85 | 
            +
                              ''
         | 
| 86 | 
            +
                            when Temporalio::Worker::IllegalWorkflowCallValidator
         | 
| 87 | 
            +
                              disable do
         | 
| 88 | 
            +
                                vals.block.call(Temporalio::Worker::IllegalWorkflowCallValidator::CallInfo.new(
         | 
| 89 | 
            +
                                                  class_name:, method_name: tp.callee_id, trace_point: tp
         | 
| 90 | 
            +
                                                ))
         | 
| 91 | 
            +
                                nil
         | 
| 92 | 
            +
                              rescue Exception => e # rubocop:disable Lint/RescueException
         | 
| 93 | 
            +
                                ", reason: #{e}"
         | 
| 94 | 
            +
                              end
         | 
| 95 | 
            +
                            else
         | 
| 96 | 
            +
                              per_method = vals&.[](tp.callee_id)
         | 
| 97 | 
            +
                              case per_method
         | 
| 98 | 
            +
                              when true
         | 
| 99 | 
            +
                                ''
         | 
| 100 | 
            +
                              when Temporalio::Worker::IllegalWorkflowCallValidator
         | 
| 101 | 
            +
                                disable do
         | 
| 102 | 
            +
                                  per_method.block.call(Temporalio::Worker::IllegalWorkflowCallValidator::CallInfo.new(
         | 
| 103 | 
            +
                                                          class_name:, method_name: tp.callee_id, trace_point: tp
         | 
| 104 | 
            +
                                                        ))
         | 
| 105 | 
            +
                                  nil
         | 
| 106 | 
            +
                                rescue Exception => e # rubocop:disable Lint/RescueException
         | 
| 107 | 
            +
                                  ", reason: #{e}"
         | 
| 108 | 
            +
                                end
         | 
| 109 | 
            +
                              end
         | 
| 110 | 
            +
                            end
         | 
| 111 | 
            +
                          if invalid_suffix
         | 
| 66 112 | 
             
                            raise Workflow::NondeterminismError,
         | 
| 67 | 
            -
                                  "Cannot access #{ | 
| 68 | 
            -
                                   | 
| 113 | 
            +
                                  "Cannot access #{class_name} #{tp.callee_id} from inside a " \
         | 
| 114 | 
            +
                                  "workflow#{invalid_suffix}. If this is known to be safe, the code can be run in " \
         | 
| 69 115 | 
             
                                  'a Temporalio::Workflow::Unsafe.illegal_call_tracing_disabled block.'
         | 
| 70 116 | 
             
                          end
         | 
| 71 117 | 
             
                        end
         | 
| @@ -56,7 +56,8 @@ module Temporalio | |
| 56 56 | 
             
                          raise ArgumentError, 'Activity must have schedule_to_close_timeout or start_to_close_timeout'
         | 
| 57 57 | 
             
                        end
         | 
| 58 58 |  | 
| 59 | 
            -
                        execute_activity_with_local_backoffs(local: false, cancellation: input.cancellation | 
| 59 | 
            +
                        execute_activity_with_local_backoffs(local: false, cancellation: input.cancellation,
         | 
| 60 | 
            +
                                                             result_hint: input.result_hint) do
         | 
| 60 61 | 
             
                          seq = (@activity_counter += 1)
         | 
| 61 62 | 
             
                          @instance.add_command(
         | 
| 62 63 | 
             
                            Bridge::Api::WorkflowCommands::WorkflowCommand.new(
         | 
| @@ -66,14 +67,17 @@ module Temporalio | |
| 66 67 | 
             
                                activity_type: input.activity,
         | 
| 67 68 | 
             
                                task_queue: input.task_queue,
         | 
| 68 69 | 
             
                                headers: ProtoUtils.headers_to_proto_hash(input.headers, @instance.payload_converter),
         | 
| 69 | 
            -
                                arguments: ProtoUtils.convert_to_payload_array( | 
| 70 | 
            +
                                arguments: ProtoUtils.convert_to_payload_array(
         | 
| 71 | 
            +
                                  @instance.payload_converter, input.args, hints: input.arg_hints
         | 
| 72 | 
            +
                                ),
         | 
| 70 73 | 
             
                                schedule_to_close_timeout: ProtoUtils.seconds_to_duration(input.schedule_to_close_timeout),
         | 
| 71 74 | 
             
                                schedule_to_start_timeout: ProtoUtils.seconds_to_duration(input.schedule_to_start_timeout),
         | 
| 72 75 | 
             
                                start_to_close_timeout: ProtoUtils.seconds_to_duration(input.start_to_close_timeout),
         | 
| 73 76 | 
             
                                heartbeat_timeout: ProtoUtils.seconds_to_duration(input.heartbeat_timeout),
         | 
| 74 77 | 
             
                                retry_policy: input.retry_policy&._to_proto,
         | 
| 75 78 | 
             
                                cancellation_type: input.cancellation_type,
         | 
| 76 | 
            -
                                do_not_eagerly_execute: input.disable_eager_execution
         | 
| 79 | 
            +
                                do_not_eagerly_execute: input.disable_eager_execution,
         | 
| 80 | 
            +
                                priority: input.priority._to_proto
         | 
| 77 81 | 
             
                              ),
         | 
| 78 82 | 
             
                              user_metadata: ProtoUtils.to_user_metadata(input.summary, nil, @instance.payload_converter)
         | 
| 79 83 | 
             
                            )
         | 
| @@ -87,7 +91,10 @@ module Temporalio | |
| 87 91 | 
             
                          raise ArgumentError, 'Activity must have schedule_to_close_timeout or start_to_close_timeout'
         | 
| 88 92 | 
             
                        end
         | 
| 89 93 |  | 
| 90 | 
            -
                         | 
| 94 | 
            +
                        @instance.assert_valid_local_activity.call(input.activity)
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                        execute_activity_with_local_backoffs(local: true, cancellation: input.cancellation,
         | 
| 97 | 
            +
                                                             result_hint: input.result_hint) do |do_backoff|
         | 
| 91 98 | 
             
                          seq = (@activity_counter += 1)
         | 
| 92 99 | 
             
                          @instance.add_command(
         | 
| 93 100 | 
             
                            Bridge::Api::WorkflowCommands::WorkflowCommand.new(
         | 
| @@ -96,7 +103,9 @@ module Temporalio | |
| 96 103 | 
             
                                activity_id: input.activity_id || seq.to_s,
         | 
| 97 104 | 
             
                                activity_type: input.activity,
         | 
| 98 105 | 
             
                                headers: ProtoUtils.headers_to_proto_hash(input.headers, @instance.payload_converter),
         | 
| 99 | 
            -
                                arguments: ProtoUtils.convert_to_payload_array( | 
| 106 | 
            +
                                arguments: ProtoUtils.convert_to_payload_array(
         | 
| 107 | 
            +
                                  @instance.payload_converter, input.args, hints: input.arg_hints
         | 
| 108 | 
            +
                                ),
         | 
| 100 109 | 
             
                                schedule_to_close_timeout: ProtoUtils.seconds_to_duration(input.schedule_to_close_timeout),
         | 
| 101 110 | 
             
                                schedule_to_start_timeout: ProtoUtils.seconds_to_duration(input.schedule_to_start_timeout),
         | 
| 102 111 | 
             
                                start_to_close_timeout: ProtoUtils.seconds_to_duration(input.start_to_close_timeout),
         | 
| @@ -112,7 +121,7 @@ module Temporalio | |
| 112 121 | 
             
                        end
         | 
| 113 122 | 
             
                      end
         | 
| 114 123 |  | 
| 115 | 
            -
                      def execute_activity_with_local_backoffs(local:, cancellation:, &)
         | 
| 124 | 
            +
                      def execute_activity_with_local_backoffs(local:, cancellation:, result_hint:, &)
         | 
| 116 125 | 
             
                        # We do not even want to schedule if the cancellation is already cancelled. We choose to use canceled
         | 
| 117 126 | 
             
                        # failure instead of wrapping in activity failure which is similar to what other SDKs do, with the accepted
         | 
| 118 127 | 
             
                        # tradeoff that it makes rescue more difficult (hence the presence of Error.canceled? helper).
         | 
| @@ -121,7 +130,7 @@ module Temporalio | |
| 121 130 | 
             
                        # This has to be done in a loop for local activity backoff
         | 
| 122 131 | 
             
                        last_local_backoff = nil
         | 
| 123 132 | 
             
                        loop do
         | 
| 124 | 
            -
                          result = execute_activity_once(local:, cancellation:, last_local_backoff:, &)
         | 
| 133 | 
            +
                          result = execute_activity_once(local:, cancellation:, last_local_backoff:, result_hint:, &)
         | 
| 125 134 | 
             
                          return result unless result.is_a?(Bridge::Api::ActivityResult::DoBackoff)
         | 
| 126 135 |  | 
| 127 136 | 
             
                          # @type var result: untyped
         | 
| @@ -133,7 +142,7 @@ module Temporalio | |
| 133 142 | 
             
                      end
         | 
| 134 143 |  | 
| 135 144 | 
             
                      # If this doesn't raise, it returns success | DoBackoff
         | 
| 136 | 
            -
                      def execute_activity_once(local:, cancellation:, last_local_backoff:, &)
         | 
| 145 | 
            +
                      def execute_activity_once(local:, cancellation:, last_local_backoff:, result_hint:, &)
         | 
| 137 146 | 
             
                        # Add to pending activities (removed by the resolver)
         | 
| 138 147 | 
             
                        seq = yield last_local_backoff
         | 
| 139 148 | 
             
                        @instance.pending_activities[seq] = Fiber.current
         | 
| @@ -166,7 +175,7 @@ module Temporalio | |
| 166 175 |  | 
| 167 176 | 
             
                        case resolution.status
         | 
| 168 177 | 
             
                        when :completed
         | 
| 169 | 
            -
                          @instance.payload_converter.from_payload(resolution.completed.result)
         | 
| 178 | 
            +
                          @instance.payload_converter.from_payload(resolution.completed.result, hint: result_hint)
         | 
| 170 179 | 
             
                        when :failed
         | 
| 171 180 | 
             
                          raise @instance.failure_converter.from_failure(resolution.failed.failure, @instance.payload_converter)
         | 
| 172 181 | 
             
                        when :cancelled
         | 
| @@ -190,6 +199,7 @@ module Temporalio | |
| 190 199 | 
             
                          signal: input.signal,
         | 
| 191 200 | 
             
                          args: input.args,
         | 
| 192 201 | 
             
                          cancellation: input.cancellation,
         | 
| 202 | 
            +
                          arg_hints: input.arg_hints,
         | 
| 193 203 | 
             
                          headers: input.headers
         | 
| 194 204 | 
             
                        )
         | 
| 195 205 | 
             
                      end
         | 
| @@ -202,11 +212,12 @@ module Temporalio | |
| 202 212 | 
             
                          signal: input.signal,
         | 
| 203 213 | 
             
                          args: input.args,
         | 
| 204 214 | 
             
                          cancellation: input.cancellation,
         | 
| 215 | 
            +
                          arg_hints: input.arg_hints,
         | 
| 205 216 | 
             
                          headers: input.headers
         | 
| 206 217 | 
             
                        )
         | 
| 207 218 | 
             
                      end
         | 
| 208 219 |  | 
| 209 | 
            -
                      def _signal_external_workflow(id:, run_id:, child:, signal:, args:, cancellation:, headers:)
         | 
| 220 | 
            +
                      def _signal_external_workflow(id:, run_id:, child:, signal:, args:, cancellation:, arg_hints:, headers:)
         | 
| 210 221 | 
             
                        raise Error::CanceledError, 'Signal canceled before scheduled' if cancellation.canceled?
         | 
| 211 222 |  | 
| 212 223 | 
             
                        # Add command
         | 
| @@ -214,7 +225,7 @@ module Temporalio | |
| 214 225 | 
             
                        cmd = Bridge::Api::WorkflowCommands::SignalExternalWorkflowExecution.new(
         | 
| 215 226 | 
             
                          seq:,
         | 
| 216 227 | 
             
                          signal_name: signal,
         | 
| 217 | 
            -
                          args: ProtoUtils.convert_to_payload_array(@instance.payload_converter, args),
         | 
| 228 | 
            +
                          args: ProtoUtils.convert_to_payload_array(@instance.payload_converter, args, hints: arg_hints),
         | 
| 218 229 | 
             
                          headers: ProtoUtils.headers_to_proto_hash(headers, @instance.payload_converter)
         | 
| 219 230 | 
             
                        )
         | 
| 220 231 | 
             
                        if child
         | 
| @@ -324,7 +335,8 @@ module Temporalio | |
| 324 335 | 
             
                              workflow_id: input.id,
         | 
| 325 336 | 
             
                              workflow_type: input.workflow,
         | 
| 326 337 | 
             
                              task_queue: input.task_queue,
         | 
| 327 | 
            -
                              input: ProtoUtils.convert_to_payload_array(@instance.payload_converter, input.args | 
| 338 | 
            +
                              input: ProtoUtils.convert_to_payload_array(@instance.payload_converter, input.args,
         | 
| 339 | 
            +
                                                                         hints: input.arg_hints),
         | 
| 328 340 | 
             
                              workflow_execution_timeout: ProtoUtils.seconds_to_duration(input.execution_timeout),
         | 
| 329 341 | 
             
                              workflow_run_timeout: ProtoUtils.seconds_to_duration(input.run_timeout),
         | 
| 330 342 | 
             
                              workflow_task_timeout: ProtoUtils.seconds_to_duration(input.task_timeout),
         | 
| @@ -335,7 +347,8 @@ module Temporalio | |
| 335 347 | 
             
                              headers: ProtoUtils.headers_to_proto_hash(input.headers, @instance.payload_converter),
         | 
| 336 348 | 
             
                              memo: ProtoUtils.memo_to_proto_hash(input.memo, @instance.payload_converter),
         | 
| 337 349 | 
             
                              search_attributes: input.search_attributes&._to_proto_hash,
         | 
| 338 | 
            -
                              cancellation_type: input.cancellation_type
         | 
| 350 | 
            +
                              cancellation_type: input.cancellation_type,
         | 
| 351 | 
            +
                              priority: input.priority._to_proto
         | 
| 339 352 | 
             
                            ),
         | 
| 340 353 | 
             
                            user_metadata: ProtoUtils.to_user_metadata(
         | 
| 341 354 | 
             
                              input.static_summary, input.static_details, @instance.payload_converter
         | 
| @@ -370,7 +383,8 @@ module Temporalio | |
| 370 383 | 
             
                            first_execution_run_id: resolution.succeeded.run_id,
         | 
| 371 384 | 
             
                            instance: @instance,
         | 
| 372 385 | 
             
                            cancellation: input.cancellation,
         | 
| 373 | 
            -
                            cancel_callback_key | 
| 386 | 
            +
                            cancel_callback_key:,
         | 
| 387 | 
            +
                            result_hint: input.result_hint
         | 
| 374 388 | 
             
                          )
         | 
| 375 389 | 
             
                          @instance.pending_child_workflows[seq] = handle
         | 
| 376 390 | 
             
                          handle
         | 
| @@ -27,8 +27,11 @@ module Temporalio | |
| 27 27 | 
             
                          return true
         | 
| 28 28 | 
             
                        end
         | 
| 29 29 |  | 
| 30 | 
            -
                        # Disable  | 
| 31 | 
            -
                         | 
| 30 | 
            +
                        # Disable scheduler since logs technically have local mutexes in them that cannot be done durably or they
         | 
| 31 | 
            +
                        # will block workflows
         | 
| 32 | 
            +
                        @instance.context.durable_scheduler_disabled do
         | 
| 33 | 
            +
                          super
         | 
| 34 | 
            +
                        end
         | 
| 32 35 | 
             
                      end
         | 
| 33 36 | 
             
                    end
         | 
| 34 37 | 
             
                  end
         | 
| @@ -40,10 +40,15 @@ module Temporalio | |
| 40 40 | 
             
                          cond_fiber = nil
         | 
| 41 41 | 
             
                          cond_result = nil
         | 
| 42 42 | 
             
                          @wait_conditions.each do |seq, cond|
         | 
| 43 | 
            +
                            # Evaluate condition or skip if not true
         | 
| 43 44 | 
             
                            next unless (cond_result = cond.first.call)
         | 
| 44 45 |  | 
| 45 | 
            -
                             | 
| 46 | 
            -
                             | 
| 46 | 
            +
                            # There have been reports of this fiber being completed already, so we make sure not to process if it
         | 
| 47 | 
            +
                            # has, but we still delete it
         | 
| 48 | 
            +
                            deleted_cond = @wait_conditions.delete(seq)
         | 
| 49 | 
            +
                            next unless deleted_cond&.last&.alive?
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                            cond_fiber = deleted_cond.last
         | 
| 47 52 | 
             
                            break
         | 
| 48 53 | 
             
                          end
         | 
| 49 54 | 
             
                          return unless cond_fiber
         | 
| @@ -106,7 +111,7 @@ module Temporalio | |
| 106 111 | 
             
                        # We just yield because unblock will resume this. We will just wrap in timeout if needed.
         | 
| 107 112 | 
             
                        if timeout
         | 
| 108 113 | 
             
                          begin
         | 
| 109 | 
            -
                             | 
| 114 | 
            +
                            Workflow.timeout(timeout) { Fiber.yield }
         | 
| 110 115 | 
             
                            true
         | 
| 111 116 | 
             
                          rescue Timeout::Error
         | 
| 112 117 | 
             
                            false
         | 
| @@ -141,7 +146,8 @@ module Temporalio | |
| 141 146 | 
             
                        unless @instance.io_enabled
         | 
| 142 147 | 
             
                          raise Workflow::NondeterminismError,
         | 
| 143 148 | 
             
                                'Cannot perform IO from inside a workflow. If this is known to be safe, ' \
         | 
| 144 | 
            -
                                'the code can be run in a Temporalio::Workflow::Unsafe. | 
| 149 | 
            +
                                'the code can be run in a Temporalio::Workflow::Unsafe.durable_scheduler_disabled ' \
         | 
| 150 | 
            +
                                'or Temporalio::Workflow::Unsafe.io_enabled block.'
         | 
| 145 151 | 
             
                        end
         | 
| 146 152 |  | 
| 147 153 | 
             
                        # Use regular Ruby behavior of blocking this thread. There is no Ruby implementation of io_wait we can just
         |