temporalio 0.1.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (628) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -0
  3. data/Cargo.lock +4324 -0
  4. data/Cargo.toml +25 -0
  5. data/Gemfile +20 -0
  6. data/LICENSE +16 -15
  7. data/README.md +985 -183
  8. data/Rakefile +101 -0
  9. data/ext/Cargo.toml +26 -0
  10. data/lib/temporalio/activity/complete_async_error.rb +11 -0
  11. data/lib/temporalio/activity/context.rb +86 -78
  12. data/lib/temporalio/activity/definition.rb +175 -0
  13. data/lib/temporalio/activity/info.rb +44 -47
  14. data/lib/temporalio/activity.rb +8 -81
  15. data/lib/temporalio/api/activity/v1/message.rb +25 -0
  16. data/lib/temporalio/api/batch/v1/message.rb +31 -0
  17. data/lib/temporalio/api/cloud/account/v1/message.rb +28 -0
  18. data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +126 -0
  19. data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +25 -0
  20. data/lib/temporalio/api/cloud/cloudservice.rb +3 -0
  21. data/lib/temporalio/api/cloud/identity/v1/message.rb +41 -0
  22. data/lib/temporalio/api/cloud/namespace/v1/message.rb +42 -0
  23. data/lib/temporalio/api/cloud/nexus/v1/message.rb +31 -0
  24. data/lib/temporalio/api/cloud/operation/v1/message.rb +28 -0
  25. data/lib/temporalio/api/cloud/region/v1/message.rb +24 -0
  26. data/lib/temporalio/api/cloud/resource/v1/message.rb +23 -0
  27. data/lib/temporalio/api/cloud/sink/v1/message.rb +24 -0
  28. data/lib/temporalio/api/cloud/usage/v1/message.rb +31 -0
  29. data/lib/temporalio/api/command/v1/message.rb +46 -0
  30. data/lib/temporalio/api/common/v1/grpc_status.rb +23 -0
  31. data/lib/temporalio/api/common/v1/message.rb +47 -0
  32. data/lib/temporalio/api/enums/v1/batch_operation.rb +22 -0
  33. data/lib/temporalio/api/enums/v1/command_type.rb +21 -0
  34. data/lib/temporalio/api/enums/v1/common.rb +26 -0
  35. data/lib/temporalio/api/enums/v1/event_type.rb +21 -0
  36. data/lib/temporalio/api/enums/v1/failed_cause.rb +26 -0
  37. data/lib/temporalio/api/enums/v1/namespace.rb +23 -0
  38. data/lib/temporalio/api/enums/v1/query.rb +22 -0
  39. data/lib/temporalio/api/enums/v1/reset.rb +23 -0
  40. data/lib/temporalio/api/enums/v1/schedule.rb +21 -0
  41. data/lib/temporalio/api/enums/v1/task_queue.rb +25 -0
  42. data/lib/temporalio/api/enums/v1/update.rb +22 -0
  43. data/lib/temporalio/api/enums/v1/workflow.rb +30 -0
  44. data/lib/temporalio/api/errordetails/v1/message.rb +42 -0
  45. data/lib/temporalio/api/export/v1/message.rb +24 -0
  46. data/lib/temporalio/api/failure/v1/message.rb +35 -0
  47. data/lib/temporalio/api/filter/v1/message.rb +27 -0
  48. data/lib/temporalio/api/history/v1/message.rb +90 -0
  49. data/lib/temporalio/api/namespace/v1/message.rb +31 -0
  50. data/lib/temporalio/api/nexus/v1/message.rb +40 -0
  51. data/lib/temporalio/api/operatorservice/v1/request_response.rb +49 -0
  52. data/lib/temporalio/api/operatorservice/v1/service.rb +23 -0
  53. data/lib/temporalio/api/operatorservice.rb +3 -0
  54. data/lib/temporalio/api/payload_visitor.rb +1513 -0
  55. data/lib/temporalio/api/protocol/v1/message.rb +23 -0
  56. data/lib/temporalio/api/query/v1/message.rb +27 -0
  57. data/lib/temporalio/api/replication/v1/message.rb +26 -0
  58. data/lib/temporalio/api/schedule/v1/message.rb +43 -0
  59. data/lib/temporalio/api/sdk/v1/enhanced_stack_trace.rb +25 -0
  60. data/lib/temporalio/api/sdk/v1/task_complete_metadata.rb +21 -0
  61. data/lib/temporalio/api/sdk/v1/user_metadata.rb +23 -0
  62. data/lib/temporalio/api/sdk/v1/workflow_metadata.rb +23 -0
  63. data/lib/temporalio/api/taskqueue/v1/message.rb +45 -0
  64. data/lib/{gen/temporal/api/testservice/v1/request_response_pb.rb → temporalio/api/testservice/v1/request_response.rb} +6 -24
  65. data/lib/temporalio/api/testservice/v1/service.rb +23 -0
  66. data/lib/temporalio/api/update/v1/message.rb +33 -0
  67. data/lib/temporalio/api/version/v1/message.rb +26 -0
  68. data/lib/temporalio/api/workflow/v1/message.rb +43 -0
  69. data/lib/temporalio/api/workflowservice/v1/request_response.rb +204 -0
  70. data/lib/temporalio/api/workflowservice/v1/service.rb +23 -0
  71. data/lib/temporalio/api/workflowservice.rb +3 -0
  72. data/lib/temporalio/api.rb +14 -0
  73. data/lib/temporalio/cancellation.rb +170 -0
  74. data/lib/temporalio/client/activity_id_reference.rb +32 -0
  75. data/lib/temporalio/client/async_activity_handle.rb +85 -0
  76. data/lib/temporalio/client/connection/cloud_service.rb +726 -0
  77. data/lib/temporalio/client/connection/operator_service.rb +201 -0
  78. data/lib/temporalio/client/connection/service.rb +42 -0
  79. data/lib/temporalio/client/connection/test_service.rb +111 -0
  80. data/lib/temporalio/client/connection/workflow_service.rb +1041 -0
  81. data/lib/temporalio/client/connection.rb +316 -0
  82. data/lib/temporalio/client/interceptor.rb +416 -0
  83. data/lib/temporalio/client/schedule.rb +967 -0
  84. data/lib/temporalio/client/schedule_handle.rb +126 -0
  85. data/lib/temporalio/client/workflow_execution.rb +100 -0
  86. data/lib/temporalio/client/workflow_execution_count.rb +36 -0
  87. data/lib/temporalio/client/workflow_execution_status.rb +18 -0
  88. data/lib/temporalio/client/workflow_handle.rb +326 -180
  89. data/lib/temporalio/client/workflow_query_reject_condition.rb +14 -0
  90. data/lib/temporalio/client/workflow_update_handle.rb +65 -0
  91. data/lib/temporalio/client/workflow_update_wait_stage.rb +17 -0
  92. data/lib/temporalio/client.rb +447 -94
  93. data/lib/temporalio/common_enums.rb +41 -0
  94. data/lib/temporalio/converters/data_converter.rb +99 -0
  95. data/lib/temporalio/converters/failure_converter.rb +202 -0
  96. data/lib/temporalio/converters/payload_codec.rb +26 -0
  97. data/lib/temporalio/converters/payload_converter/binary_null.rb +34 -0
  98. data/lib/temporalio/converters/payload_converter/binary_plain.rb +35 -0
  99. data/lib/temporalio/converters/payload_converter/binary_protobuf.rb +42 -0
  100. data/lib/temporalio/converters/payload_converter/composite.rb +66 -0
  101. data/lib/temporalio/converters/payload_converter/encoding.rb +35 -0
  102. data/lib/temporalio/converters/payload_converter/json_plain.rb +44 -0
  103. data/lib/temporalio/converters/payload_converter/json_protobuf.rb +41 -0
  104. data/lib/temporalio/converters/payload_converter.rb +71 -0
  105. data/lib/temporalio/converters/raw_value.rb +20 -0
  106. data/lib/temporalio/converters.rb +9 -0
  107. data/lib/temporalio/error/failure.rb +119 -94
  108. data/lib/temporalio/error.rb +155 -0
  109. data/lib/temporalio/internal/bridge/api/activity_result/activity_result.rb +34 -0
  110. data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +31 -0
  111. data/lib/temporalio/internal/bridge/api/child_workflow/child_workflow.rb +33 -0
  112. data/lib/temporalio/internal/bridge/api/common/common.rb +26 -0
  113. data/lib/temporalio/internal/bridge/api/core_interface.rb +40 -0
  114. data/lib/temporalio/internal/bridge/api/external_data/external_data.rb +27 -0
  115. data/lib/temporalio/internal/bridge/api/nexus/nexus.rb +33 -0
  116. data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +56 -0
  117. data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +57 -0
  118. data/lib/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rb +30 -0
  119. data/lib/temporalio/internal/bridge/api.rb +3 -0
  120. data/lib/temporalio/internal/bridge/client.rb +95 -0
  121. data/lib/temporalio/internal/bridge/runtime.rb +53 -0
  122. data/lib/temporalio/internal/bridge/testing.rb +66 -0
  123. data/lib/temporalio/internal/bridge/worker.rb +85 -0
  124. data/lib/temporalio/internal/bridge.rb +36 -0
  125. data/lib/temporalio/internal/client/implementation.rb +700 -0
  126. data/lib/temporalio/internal/metric.rb +122 -0
  127. data/lib/temporalio/internal/proto_utils.rb +133 -0
  128. data/lib/temporalio/internal/worker/activity_worker.rb +373 -0
  129. data/lib/temporalio/internal/worker/multi_runner.rb +213 -0
  130. data/lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb +54 -0
  131. data/lib/temporalio/internal/worker/workflow_instance/context.rb +329 -0
  132. data/lib/temporalio/internal/worker/workflow_instance/details.rb +44 -0
  133. data/lib/temporalio/internal/worker/workflow_instance/external_workflow_handle.rb +32 -0
  134. data/lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb +22 -0
  135. data/lib/temporalio/internal/worker/workflow_instance/handler_execution.rb +25 -0
  136. data/lib/temporalio/internal/worker/workflow_instance/handler_hash.rb +41 -0
  137. data/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb +97 -0
  138. data/lib/temporalio/internal/worker/workflow_instance/inbound_implementation.rb +62 -0
  139. data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +415 -0
  140. data/lib/temporalio/internal/worker/workflow_instance/replay_safe_logger.rb +37 -0
  141. data/lib/temporalio/internal/worker/workflow_instance/replay_safe_metric.rb +40 -0
  142. data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +163 -0
  143. data/lib/temporalio/internal/worker/workflow_instance.rb +730 -0
  144. data/lib/temporalio/internal/worker/workflow_worker.rb +196 -0
  145. data/lib/temporalio/internal.rb +7 -0
  146. data/lib/temporalio/metric.rb +109 -0
  147. data/lib/temporalio/retry_policy.rb +55 -73
  148. data/lib/temporalio/runtime.rb +302 -13
  149. data/lib/temporalio/scoped_logger.rb +96 -0
  150. data/lib/temporalio/search_attributes.rb +343 -0
  151. data/lib/temporalio/testing/activity_environment.rb +132 -0
  152. data/lib/temporalio/testing/workflow_environment.rb +345 -74
  153. data/lib/temporalio/testing.rb +4 -169
  154. data/lib/temporalio/version.rb +3 -1
  155. data/lib/temporalio/worker/activity_executor/fiber.rb +49 -0
  156. data/lib/temporalio/worker/activity_executor/thread_pool.rb +46 -0
  157. data/lib/temporalio/worker/activity_executor.rb +55 -0
  158. data/lib/temporalio/worker/interceptor.rb +362 -0
  159. data/lib/temporalio/worker/thread_pool.rb +237 -0
  160. data/lib/temporalio/worker/tuner.rb +151 -0
  161. data/lib/temporalio/worker/workflow_executor/thread_pool.rb +230 -0
  162. data/lib/temporalio/worker/workflow_executor.rb +26 -0
  163. data/lib/temporalio/worker.rb +554 -161
  164. data/lib/temporalio/workflow/activity_cancellation_type.rb +20 -0
  165. data/lib/temporalio/workflow/child_workflow_cancellation_type.rb +21 -0
  166. data/lib/temporalio/workflow/child_workflow_handle.rb +43 -0
  167. data/lib/temporalio/workflow/definition.rb +566 -0
  168. data/lib/temporalio/workflow/external_workflow_handle.rb +41 -0
  169. data/lib/temporalio/workflow/future.rb +117 -104
  170. data/lib/temporalio/workflow/handler_unfinished_policy.rb +13 -0
  171. data/lib/temporalio/workflow/info.rb +63 -57
  172. data/lib/temporalio/workflow/parent_close_policy.rb +19 -0
  173. data/lib/temporalio/workflow/update_info.rb +20 -0
  174. data/lib/temporalio/workflow.rb +523 -0
  175. data/lib/temporalio/workflow_history.rb +22 -0
  176. data/lib/temporalio.rb +6 -7
  177. data/temporalio.gemspec +20 -39
  178. metadata +171 -710
  179. data/bridge/Cargo.lock +0 -2997
  180. data/bridge/Cargo.toml +0 -29
  181. data/bridge/sdk-core/ARCHITECTURE.md +0 -76
  182. data/bridge/sdk-core/Cargo.toml +0 -2
  183. data/bridge/sdk-core/LICENSE.txt +0 -23
  184. data/bridge/sdk-core/README.md +0 -117
  185. data/bridge/sdk-core/arch_docs/diagrams/README.md +0 -10
  186. data/bridge/sdk-core/arch_docs/diagrams/sticky_queues.puml +0 -40
  187. data/bridge/sdk-core/arch_docs/diagrams/workflow_internals.svg +0 -1
  188. data/bridge/sdk-core/arch_docs/sticky_queues.md +0 -51
  189. data/bridge/sdk-core/client/Cargo.toml +0 -40
  190. data/bridge/sdk-core/client/LICENSE.txt +0 -23
  191. data/bridge/sdk-core/client/src/lib.rs +0 -1462
  192. data/bridge/sdk-core/client/src/metrics.rs +0 -174
  193. data/bridge/sdk-core/client/src/raw.rs +0 -932
  194. data/bridge/sdk-core/client/src/retry.rs +0 -763
  195. data/bridge/sdk-core/client/src/workflow_handle/mod.rs +0 -185
  196. data/bridge/sdk-core/core/Cargo.toml +0 -129
  197. data/bridge/sdk-core/core/LICENSE.txt +0 -23
  198. data/bridge/sdk-core/core/benches/workflow_replay.rs +0 -76
  199. data/bridge/sdk-core/core/src/abstractions.rs +0 -355
  200. data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +0 -1049
  201. data/bridge/sdk-core/core/src/core_tests/child_workflows.rs +0 -221
  202. data/bridge/sdk-core/core/src/core_tests/determinism.rs +0 -270
  203. data/bridge/sdk-core/core/src/core_tests/local_activities.rs +0 -1046
  204. data/bridge/sdk-core/core/src/core_tests/mod.rs +0 -100
  205. data/bridge/sdk-core/core/src/core_tests/queries.rs +0 -893
  206. data/bridge/sdk-core/core/src/core_tests/replay_flag.rs +0 -65
  207. data/bridge/sdk-core/core/src/core_tests/workers.rs +0 -257
  208. data/bridge/sdk-core/core/src/core_tests/workflow_cancels.rs +0 -124
  209. data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +0 -2433
  210. data/bridge/sdk-core/core/src/ephemeral_server/mod.rs +0 -609
  211. data/bridge/sdk-core/core/src/internal_flags.rs +0 -136
  212. data/bridge/sdk-core/core/src/lib.rs +0 -289
  213. data/bridge/sdk-core/core/src/pollers/mod.rs +0 -54
  214. data/bridge/sdk-core/core/src/pollers/poll_buffer.rs +0 -297
  215. data/bridge/sdk-core/core/src/protosext/mod.rs +0 -428
  216. data/bridge/sdk-core/core/src/replay/mod.rs +0 -215
  217. data/bridge/sdk-core/core/src/retry_logic.rs +0 -202
  218. data/bridge/sdk-core/core/src/telemetry/log_export.rs +0 -190
  219. data/bridge/sdk-core/core/src/telemetry/metrics.rs +0 -462
  220. data/bridge/sdk-core/core/src/telemetry/mod.rs +0 -423
  221. data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +0 -83
  222. data/bridge/sdk-core/core/src/test_help/mod.rs +0 -939
  223. data/bridge/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +0 -536
  224. data/bridge/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +0 -89
  225. data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +0 -1278
  226. data/bridge/sdk-core/core/src/worker/activities.rs +0 -557
  227. data/bridge/sdk-core/core/src/worker/client/mocks.rs +0 -107
  228. data/bridge/sdk-core/core/src/worker/client.rs +0 -389
  229. data/bridge/sdk-core/core/src/worker/mod.rs +0 -677
  230. data/bridge/sdk-core/core/src/worker/workflow/bridge.rs +0 -35
  231. data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +0 -99
  232. data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +0 -1111
  233. data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +0 -964
  234. data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +0 -294
  235. data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +0 -168
  236. data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +0 -918
  237. data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +0 -137
  238. data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +0 -158
  239. data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +0 -130
  240. data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +0 -1525
  241. data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +0 -324
  242. data/bridge/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +0 -179
  243. data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +0 -659
  244. data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +0 -439
  245. data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +0 -435
  246. data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +0 -175
  247. data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +0 -249
  248. data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +0 -85
  249. data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +0 -1280
  250. data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +0 -269
  251. data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +0 -213
  252. data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +0 -1305
  253. data/bridge/sdk-core/core/src/worker/workflow/mod.rs +0 -1276
  254. data/bridge/sdk-core/core/src/worker/workflow/run_cache.rs +0 -128
  255. data/bridge/sdk-core/core/src/worker/workflow/wft_extraction.rs +0 -125
  256. data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +0 -85
  257. data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +0 -117
  258. data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +0 -24
  259. data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +0 -715
  260. data/bridge/sdk-core/core-api/Cargo.toml +0 -33
  261. data/bridge/sdk-core/core-api/LICENSE.txt +0 -23
  262. data/bridge/sdk-core/core-api/src/errors.rs +0 -62
  263. data/bridge/sdk-core/core-api/src/lib.rs +0 -113
  264. data/bridge/sdk-core/core-api/src/telemetry.rs +0 -141
  265. data/bridge/sdk-core/core-api/src/worker.rs +0 -161
  266. data/bridge/sdk-core/etc/deps.svg +0 -162
  267. data/bridge/sdk-core/etc/dynamic-config.yaml +0 -2
  268. data/bridge/sdk-core/etc/otel-collector-config.yaml +0 -36
  269. data/bridge/sdk-core/etc/prometheus.yaml +0 -6
  270. data/bridge/sdk-core/etc/regen-depgraph.sh +0 -5
  271. data/bridge/sdk-core/fsm/Cargo.toml +0 -18
  272. data/bridge/sdk-core/fsm/LICENSE.txt +0 -23
  273. data/bridge/sdk-core/fsm/README.md +0 -3
  274. data/bridge/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +0 -27
  275. data/bridge/sdk-core/fsm/rustfsm_procmacro/LICENSE.txt +0 -23
  276. data/bridge/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +0 -650
  277. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/progress.rs +0 -8
  278. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.rs +0 -18
  279. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +0 -12
  280. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dynamic_dest_pass.rs +0 -41
  281. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/forgot_name_fail.rs +0 -14
  282. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/forgot_name_fail.stderr +0 -11
  283. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/handler_arg_pass.rs +0 -32
  284. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/handler_pass.rs +0 -31
  285. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/medium_complex_pass.rs +0 -46
  286. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.rs +0 -29
  287. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +0 -12
  288. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/simple_pass.rs +0 -32
  289. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.rs +0 -18
  290. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.stderr +0 -5
  291. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.rs +0 -11
  292. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.stderr +0 -5
  293. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.rs +0 -11
  294. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.stderr +0 -5
  295. data/bridge/sdk-core/fsm/rustfsm_trait/Cargo.toml +0 -14
  296. data/bridge/sdk-core/fsm/rustfsm_trait/LICENSE.txt +0 -23
  297. data/bridge/sdk-core/fsm/rustfsm_trait/src/lib.rs +0 -254
  298. data/bridge/sdk-core/fsm/src/lib.rs +0 -2
  299. data/bridge/sdk-core/histories/evict_while_la_running_no_interference-16_history.bin +0 -0
  300. data/bridge/sdk-core/histories/evict_while_la_running_no_interference-23_history.bin +0 -0
  301. data/bridge/sdk-core/histories/evict_while_la_running_no_interference-85_history.bin +0 -0
  302. data/bridge/sdk-core/histories/fail_wf_task.bin +0 -0
  303. data/bridge/sdk-core/histories/timer_workflow_history.bin +0 -0
  304. data/bridge/sdk-core/integ-with-otel.sh +0 -7
  305. data/bridge/sdk-core/protos/api_upstream/README.md +0 -9
  306. data/bridge/sdk-core/protos/api_upstream/api-linter.yaml +0 -40
  307. data/bridge/sdk-core/protos/api_upstream/buf.yaml +0 -9
  308. data/bridge/sdk-core/protos/api_upstream/build/go.mod +0 -7
  309. data/bridge/sdk-core/protos/api_upstream/build/go.sum +0 -5
  310. data/bridge/sdk-core/protos/api_upstream/build/tools.go +0 -29
  311. data/bridge/sdk-core/protos/api_upstream/dependencies/gogoproto/gogo.proto +0 -141
  312. data/bridge/sdk-core/protos/api_upstream/go.mod +0 -6
  313. data/bridge/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +0 -89
  314. data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +0 -248
  315. data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +0 -123
  316. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -47
  317. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +0 -52
  318. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +0 -56
  319. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +0 -170
  320. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +0 -123
  321. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +0 -51
  322. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +0 -50
  323. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +0 -41
  324. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +0 -60
  325. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -59
  326. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +0 -56
  327. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +0 -122
  328. data/bridge/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +0 -108
  329. data/bridge/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +0 -114
  330. data/bridge/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +0 -56
  331. data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +0 -787
  332. data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +0 -99
  333. data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +0 -124
  334. data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +0 -80
  335. data/bridge/sdk-core/protos/api_upstream/temporal/api/protocol/v1/message.proto +0 -57
  336. data/bridge/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +0 -61
  337. data/bridge/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +0 -55
  338. data/bridge/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +0 -379
  339. data/bridge/sdk-core/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +0 -63
  340. data/bridge/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +0 -108
  341. data/bridge/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +0 -111
  342. data/bridge/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +0 -59
  343. data/bridge/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +0 -146
  344. data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +0 -1199
  345. data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +0 -415
  346. data/bridge/sdk-core/protos/grpc/health/v1/health.proto +0 -63
  347. data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +0 -79
  348. data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +0 -80
  349. data/bridge/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -78
  350. data/bridge/sdk-core/protos/local/temporal/sdk/core/common/common.proto +0 -16
  351. data/bridge/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +0 -31
  352. data/bridge/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +0 -31
  353. data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +0 -270
  354. data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +0 -305
  355. data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -35
  356. data/bridge/sdk-core/protos/testsrv_upstream/api-linter.yaml +0 -38
  357. data/bridge/sdk-core/protos/testsrv_upstream/buf.yaml +0 -13
  358. data/bridge/sdk-core/protos/testsrv_upstream/dependencies/gogoproto/gogo.proto +0 -141
  359. data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -63
  360. data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -90
  361. data/bridge/sdk-core/rustfmt.toml +0 -1
  362. data/bridge/sdk-core/sdk/Cargo.toml +0 -48
  363. data/bridge/sdk-core/sdk/LICENSE.txt +0 -23
  364. data/bridge/sdk-core/sdk/src/activity_context.rs +0 -230
  365. data/bridge/sdk-core/sdk/src/app_data.rs +0 -37
  366. data/bridge/sdk-core/sdk/src/interceptors.rs +0 -50
  367. data/bridge/sdk-core/sdk/src/lib.rs +0 -861
  368. data/bridge/sdk-core/sdk/src/payload_converter.rs +0 -11
  369. data/bridge/sdk-core/sdk/src/workflow_context/options.rs +0 -295
  370. data/bridge/sdk-core/sdk/src/workflow_context.rs +0 -694
  371. data/bridge/sdk-core/sdk/src/workflow_future.rs +0 -500
  372. data/bridge/sdk-core/sdk-core-protos/Cargo.toml +0 -33
  373. data/bridge/sdk-core/sdk-core-protos/LICENSE.txt +0 -23
  374. data/bridge/sdk-core/sdk-core-protos/build.rs +0 -142
  375. data/bridge/sdk-core/sdk-core-protos/src/constants.rs +0 -7
  376. data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +0 -557
  377. data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +0 -234
  378. data/bridge/sdk-core/sdk-core-protos/src/lib.rs +0 -2088
  379. data/bridge/sdk-core/sdk-core-protos/src/task_token.rs +0 -48
  380. data/bridge/sdk-core/sdk-core-protos/src/utilities.rs +0 -14
  381. data/bridge/sdk-core/test-utils/Cargo.toml +0 -38
  382. data/bridge/sdk-core/test-utils/src/canned_histories.rs +0 -1389
  383. data/bridge/sdk-core/test-utils/src/histfetch.rs +0 -28
  384. data/bridge/sdk-core/test-utils/src/lib.rs +0 -709
  385. data/bridge/sdk-core/test-utils/src/wf_input_saver.rs +0 -50
  386. data/bridge/sdk-core/test-utils/src/workflows.rs +0 -29
  387. data/bridge/sdk-core/tests/fuzzy_workflow.rs +0 -130
  388. data/bridge/sdk-core/tests/heavy_tests.rs +0 -265
  389. data/bridge/sdk-core/tests/integ_tests/client_tests.rs +0 -36
  390. data/bridge/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +0 -150
  391. data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +0 -223
  392. data/bridge/sdk-core/tests/integ_tests/metrics_tests.rs +0 -239
  393. data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +0 -90
  394. data/bridge/sdk-core/tests/integ_tests/queries_tests.rs +0 -314
  395. data/bridge/sdk-core/tests/integ_tests/visibility_tests.rs +0 -151
  396. data/bridge/sdk-core/tests/integ_tests/workflow_tests/activities.rs +0 -902
  397. data/bridge/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +0 -61
  398. data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +0 -60
  399. data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +0 -51
  400. data/bridge/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +0 -51
  401. data/bridge/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +0 -64
  402. data/bridge/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +0 -47
  403. data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +0 -669
  404. data/bridge/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +0 -54
  405. data/bridge/sdk-core/tests/integ_tests/workflow_tests/patches.rs +0 -92
  406. data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +0 -228
  407. data/bridge/sdk-core/tests/integ_tests/workflow_tests/resets.rs +0 -94
  408. data/bridge/sdk-core/tests/integ_tests/workflow_tests/signals.rs +0 -171
  409. data/bridge/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +0 -85
  410. data/bridge/sdk-core/tests/integ_tests/workflow_tests/timers.rs +0 -120
  411. data/bridge/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +0 -77
  412. data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +0 -596
  413. data/bridge/sdk-core/tests/main.rs +0 -103
  414. data/bridge/sdk-core/tests/runner.rs +0 -132
  415. data/bridge/sdk-core/tests/wf_input_replay.rs +0 -32
  416. data/bridge/src/connection.rs +0 -202
  417. data/bridge/src/lib.rs +0 -494
  418. data/bridge/src/runtime.rs +0 -54
  419. data/bridge/src/test_server.rs +0 -153
  420. data/bridge/src/worker.rs +0 -197
  421. data/ext/Rakefile +0 -9
  422. data/lib/gen/dependencies/gogoproto/gogo_pb.rb +0 -14
  423. data/lib/gen/temporal/api/batch/v1/message_pb.rb +0 -50
  424. data/lib/gen/temporal/api/command/v1/message_pb.rb +0 -160
  425. data/lib/gen/temporal/api/common/v1/message_pb.rb +0 -73
  426. data/lib/gen/temporal/api/enums/v1/batch_operation_pb.rb +0 -33
  427. data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +0 -37
  428. data/lib/gen/temporal/api/enums/v1/common_pb.rb +0 -42
  429. data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +0 -68
  430. data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +0 -79
  431. data/lib/gen/temporal/api/enums/v1/namespace_pb.rb +0 -37
  432. data/lib/gen/temporal/api/enums/v1/query_pb.rb +0 -31
  433. data/lib/gen/temporal/api/enums/v1/reset_pb.rb +0 -24
  434. data/lib/gen/temporal/api/enums/v1/schedule_pb.rb +0 -28
  435. data/lib/gen/temporal/api/enums/v1/task_queue_pb.rb +0 -30
  436. data/lib/gen/temporal/api/enums/v1/update_pb.rb +0 -25
  437. data/lib/gen/temporal/api/enums/v1/workflow_pb.rb +0 -89
  438. data/lib/gen/temporal/api/errordetails/v1/message_pb.rb +0 -84
  439. data/lib/gen/temporal/api/failure/v1/message_pb.rb +0 -83
  440. data/lib/gen/temporal/api/filter/v1/message_pb.rb +0 -40
  441. data/lib/gen/temporal/api/history/v1/message_pb.rb +0 -498
  442. data/lib/gen/temporal/api/namespace/v1/message_pb.rb +0 -64
  443. data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +0 -88
  444. data/lib/gen/temporal/api/operatorservice/v1/service_pb.rb +0 -20
  445. data/lib/gen/temporal/api/protocol/v1/message_pb.rb +0 -30
  446. data/lib/gen/temporal/api/query/v1/message_pb.rb +0 -38
  447. data/lib/gen/temporal/api/replication/v1/message_pb.rb +0 -37
  448. data/lib/gen/temporal/api/schedule/v1/message_pb.rb +0 -149
  449. data/lib/gen/temporal/api/sdk/v1/task_complete_metadata_pb.rb +0 -23
  450. data/lib/gen/temporal/api/taskqueue/v1/message_pb.rb +0 -73
  451. data/lib/gen/temporal/api/testservice/v1/service_pb.rb +0 -21
  452. data/lib/gen/temporal/api/update/v1/message_pb.rb +0 -72
  453. data/lib/gen/temporal/api/version/v1/message_pb.rb +0 -41
  454. data/lib/gen/temporal/api/workflow/v1/message_pb.rb +0 -111
  455. data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +0 -798
  456. data/lib/gen/temporal/api/workflowservice/v1/service_pb.rb +0 -20
  457. data/lib/gen/temporal/sdk/core/activity_result/activity_result_pb.rb +0 -62
  458. data/lib/gen/temporal/sdk/core/activity_task/activity_task_pb.rb +0 -61
  459. data/lib/gen/temporal/sdk/core/child_workflow/child_workflow_pb.rb +0 -61
  460. data/lib/gen/temporal/sdk/core/common/common_pb.rb +0 -26
  461. data/lib/gen/temporal/sdk/core/core_interface_pb.rb +0 -40
  462. data/lib/gen/temporal/sdk/core/external_data/external_data_pb.rb +0 -31
  463. data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +0 -171
  464. data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +0 -200
  465. data/lib/gen/temporal/sdk/core/workflow_completion/workflow_completion_pb.rb +0 -41
  466. data/lib/temporalio/bridge/connect_options.rb +0 -15
  467. data/lib/temporalio/bridge/error.rb +0 -8
  468. data/lib/temporalio/bridge/retry_config.rb +0 -24
  469. data/lib/temporalio/bridge/tls_options.rb +0 -19
  470. data/lib/temporalio/bridge.rb +0 -14
  471. data/lib/temporalio/client/implementation.rb +0 -340
  472. data/lib/temporalio/connection/retry_config.rb +0 -44
  473. data/lib/temporalio/connection/service.rb +0 -20
  474. data/lib/temporalio/connection/test_service.rb +0 -92
  475. data/lib/temporalio/connection/tls_options.rb +0 -51
  476. data/lib/temporalio/connection/workflow_service.rb +0 -731
  477. data/lib/temporalio/connection.rb +0 -86
  478. data/lib/temporalio/data_converter.rb +0 -191
  479. data/lib/temporalio/error/workflow_failure.rb +0 -19
  480. data/lib/temporalio/errors.rb +0 -40
  481. data/lib/temporalio/failure_converter/base.rb +0 -26
  482. data/lib/temporalio/failure_converter/basic.rb +0 -319
  483. data/lib/temporalio/failure_converter.rb +0 -7
  484. data/lib/temporalio/interceptor/activity_inbound.rb +0 -22
  485. data/lib/temporalio/interceptor/activity_outbound.rb +0 -24
  486. data/lib/temporalio/interceptor/chain.rb +0 -28
  487. data/lib/temporalio/interceptor/client.rb +0 -127
  488. data/lib/temporalio/interceptor.rb +0 -22
  489. data/lib/temporalio/payload_codec/base.rb +0 -32
  490. data/lib/temporalio/payload_converter/base.rb +0 -24
  491. data/lib/temporalio/payload_converter/bytes.rb +0 -27
  492. data/lib/temporalio/payload_converter/composite.rb +0 -49
  493. data/lib/temporalio/payload_converter/encoding_base.rb +0 -35
  494. data/lib/temporalio/payload_converter/json.rb +0 -26
  495. data/lib/temporalio/payload_converter/nil.rb +0 -26
  496. data/lib/temporalio/payload_converter.rb +0 -14
  497. data/lib/temporalio/retry_state.rb +0 -35
  498. data/lib/temporalio/testing/time_skipping_handle.rb +0 -32
  499. data/lib/temporalio/testing/time_skipping_interceptor.rb +0 -23
  500. data/lib/temporalio/timeout_type.rb +0 -29
  501. data/lib/temporalio/worker/activity_runner.rb +0 -114
  502. data/lib/temporalio/worker/activity_worker.rb +0 -164
  503. data/lib/temporalio/worker/reactor.rb +0 -46
  504. data/lib/temporalio/worker/runner.rb +0 -63
  505. data/lib/temporalio/worker/sync_worker.rb +0 -124
  506. data/lib/temporalio/worker/thread_pool_executor.rb +0 -51
  507. data/lib/temporalio/workflow/async.rb +0 -46
  508. data/lib/temporalio/workflow/execution_info.rb +0 -54
  509. data/lib/temporalio/workflow/execution_status.rb +0 -36
  510. data/lib/temporalio/workflow/id_reuse_policy.rb +0 -36
  511. data/lib/temporalio/workflow/query_reject_condition.rb +0 -33
  512. data/lib/thermite_patch.rb +0 -33
  513. data/sig/async.rbs +0 -17
  514. data/sig/protobuf.rbs +0 -16
  515. data/sig/protos/dependencies/gogoproto/gogo.rbs +0 -914
  516. data/sig/protos/google/protobuf/any.rbs +0 -157
  517. data/sig/protos/google/protobuf/descriptor.rbs +0 -2825
  518. data/sig/protos/google/protobuf/duration.rbs +0 -114
  519. data/sig/protos/google/protobuf/empty.rbs +0 -36
  520. data/sig/protos/google/protobuf/timestamp.rbs +0 -145
  521. data/sig/protos/google/protobuf/wrappers.rbs +0 -358
  522. data/sig/protos/temporal/api/batch/v1/message.rbs +0 -300
  523. data/sig/protos/temporal/api/command/v1/message.rbs +0 -1399
  524. data/sig/protos/temporal/api/common/v1/message.rbs +0 -528
  525. data/sig/protos/temporal/api/enums/v1/batch_operation.rbs +0 -79
  526. data/sig/protos/temporal/api/enums/v1/command_type.rbs +0 -68
  527. data/sig/protos/temporal/api/enums/v1/common.rbs +0 -118
  528. data/sig/protos/temporal/api/enums/v1/event_type.rbs +0 -264
  529. data/sig/protos/temporal/api/enums/v1/failed_cause.rbs +0 -277
  530. data/sig/protos/temporal/api/enums/v1/namespace.rbs +0 -108
  531. data/sig/protos/temporal/api/enums/v1/query.rbs +0 -81
  532. data/sig/protos/temporal/api/enums/v1/reset.rbs +0 -44
  533. data/sig/protos/temporal/api/enums/v1/schedule.rbs +0 -72
  534. data/sig/protos/temporal/api/enums/v1/task_queue.rbs +0 -92
  535. data/sig/protos/temporal/api/enums/v1/update.rbs +0 -64
  536. data/sig/protos/temporal/api/enums/v1/workflow.rbs +0 -371
  537. data/sig/protos/temporal/api/errordetails/v1/message.rbs +0 -551
  538. data/sig/protos/temporal/api/failure/v1/message.rbs +0 -581
  539. data/sig/protos/temporal/api/filter/v1/message.rbs +0 -171
  540. data/sig/protos/temporal/api/history/v1/message.rbs +0 -4609
  541. data/sig/protos/temporal/api/namespace/v1/message.rbs +0 -410
  542. data/sig/protos/temporal/api/operatorservice/v1/request_response.rbs +0 -643
  543. data/sig/protos/temporal/api/operatorservice/v1/service.rbs +0 -17
  544. data/sig/protos/temporal/api/protocol/v1/message.rbs +0 -84
  545. data/sig/protos/temporal/api/query/v1/message.rbs +0 -182
  546. data/sig/protos/temporal/api/replication/v1/message.rbs +0 -148
  547. data/sig/protos/temporal/api/schedule/v1/message.rbs +0 -1488
  548. data/sig/protos/temporal/api/sdk/v1/task_complete_metadata.rbs +0 -110
  549. data/sig/protos/temporal/api/taskqueue/v1/message.rbs +0 -486
  550. data/sig/protos/temporal/api/testservice/v1/request_response.rbs +0 -249
  551. data/sig/protos/temporal/api/testservice/v1/service.rbs +0 -15
  552. data/sig/protos/temporal/api/update/v1/message.rbs +0 -489
  553. data/sig/protos/temporal/api/version/v1/message.rbs +0 -184
  554. data/sig/protos/temporal/api/workflow/v1/message.rbs +0 -824
  555. data/sig/protos/temporal/api/workflowservice/v1/request_response.rbs +0 -7250
  556. data/sig/protos/temporal/api/workflowservice/v1/service.rbs +0 -22
  557. data/sig/protos/temporal/sdk/core/activity_result/activity_result.rbs +0 -380
  558. data/sig/protos/temporal/sdk/core/activity_task/activity_task.rbs +0 -386
  559. data/sig/protos/temporal/sdk/core/child_workflow/child_workflow.rbs +0 -323
  560. data/sig/protos/temporal/sdk/core/common/common.rbs +0 -62
  561. data/sig/protos/temporal/sdk/core/core_interface.rbs +0 -101
  562. data/sig/protos/temporal/sdk/core/external_data/external_data.rbs +0 -119
  563. data/sig/protos/temporal/sdk/core/workflow_activation/workflow_activation.rbs +0 -1473
  564. data/sig/protos/temporal/sdk/core/workflow_commands/workflow_commands.rbs +0 -1784
  565. data/sig/protos/temporal/sdk/core/workflow_completion/workflow_completion.rbs +0 -180
  566. data/sig/ruby.rbs +0 -12
  567. data/sig/temporalio/activity/context.rbs +0 -29
  568. data/sig/temporalio/activity/info.rbs +0 -43
  569. data/sig/temporalio/activity.rbs +0 -19
  570. data/sig/temporalio/bridge/connect_options.rbs +0 -19
  571. data/sig/temporalio/bridge/error.rbs +0 -8
  572. data/sig/temporalio/bridge/retry_config.rbs +0 -21
  573. data/sig/temporalio/bridge/tls_options.rbs +0 -17
  574. data/sig/temporalio/bridge.rbs +0 -71
  575. data/sig/temporalio/client/implementation.rbs +0 -38
  576. data/sig/temporalio/client/workflow_handle.rbs +0 -41
  577. data/sig/temporalio/client.rbs +0 -35
  578. data/sig/temporalio/connection/retry_config.rbs +0 -37
  579. data/sig/temporalio/connection/service.rbs +0 -14
  580. data/sig/temporalio/connection/test_service.rbs +0 -13
  581. data/sig/temporalio/connection/tls_options.rbs +0 -43
  582. data/sig/temporalio/connection/workflow_service.rbs +0 -48
  583. data/sig/temporalio/connection.rbs +0 -30
  584. data/sig/temporalio/data_converter.rbs +0 -35
  585. data/sig/temporalio/error/failure.rbs +0 -121
  586. data/sig/temporalio/error/workflow_failure.rbs +0 -9
  587. data/sig/temporalio/errors.rbs +0 -36
  588. data/sig/temporalio/failure_converter/base.rbs +0 -12
  589. data/sig/temporalio/failure_converter/basic.rbs +0 -86
  590. data/sig/temporalio/failure_converter.rbs +0 -5
  591. data/sig/temporalio/interceptor/activity_inbound.rbs +0 -21
  592. data/sig/temporalio/interceptor/activity_outbound.rbs +0 -10
  593. data/sig/temporalio/interceptor/chain.rbs +0 -24
  594. data/sig/temporalio/interceptor/client.rbs +0 -148
  595. data/sig/temporalio/interceptor.rbs +0 -6
  596. data/sig/temporalio/payload_codec/base.rbs +0 -12
  597. data/sig/temporalio/payload_converter/base.rbs +0 -12
  598. data/sig/temporalio/payload_converter/bytes.rbs +0 -9
  599. data/sig/temporalio/payload_converter/composite.rbs +0 -19
  600. data/sig/temporalio/payload_converter/encoding_base.rbs +0 -14
  601. data/sig/temporalio/payload_converter/json.rbs +0 -9
  602. data/sig/temporalio/payload_converter/nil.rbs +0 -9
  603. data/sig/temporalio/payload_converter.rbs +0 -5
  604. data/sig/temporalio/retry_policy.rbs +0 -25
  605. data/sig/temporalio/retry_state.rbs +0 -20
  606. data/sig/temporalio/runtime.rbs +0 -12
  607. data/sig/temporalio/testing/time_skipping_handle.rbs +0 -15
  608. data/sig/temporalio/testing/time_skipping_interceptor.rbs +0 -13
  609. data/sig/temporalio/testing/workflow_environment.rbs +0 -22
  610. data/sig/temporalio/testing.rbs +0 -35
  611. data/sig/temporalio/timeout_type.rbs +0 -15
  612. data/sig/temporalio/version.rbs +0 -3
  613. data/sig/temporalio/worker/activity_runner.rbs +0 -35
  614. data/sig/temporalio/worker/activity_worker.rbs +0 -44
  615. data/sig/temporalio/worker/reactor.rbs +0 -22
  616. data/sig/temporalio/worker/runner.rbs +0 -21
  617. data/sig/temporalio/worker/sync_worker.rbs +0 -23
  618. data/sig/temporalio/worker/thread_pool_executor.rbs +0 -23
  619. data/sig/temporalio/worker.rbs +0 -46
  620. data/sig/temporalio/workflow/async.rbs +0 -9
  621. data/sig/temporalio/workflow/execution_info.rbs +0 -55
  622. data/sig/temporalio/workflow/execution_status.rbs +0 -21
  623. data/sig/temporalio/workflow/future.rbs +0 -40
  624. data/sig/temporalio/workflow/id_reuse_policy.rbs +0 -15
  625. data/sig/temporalio/workflow/info.rbs +0 -55
  626. data/sig/temporalio/workflow/query_reject_condition.rbs +0 -14
  627. data/sig/temporalio.rbs +0 -2
  628. data/sig/thermite_patch.rbs +0 -15
@@ -0,0 +1,730 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'temporalio'
5
+ require 'temporalio/activity/definition'
6
+ require 'temporalio/api'
7
+ require 'temporalio/converters/raw_value'
8
+ require 'temporalio/error'
9
+ require 'temporalio/internal/bridge/api'
10
+ require 'temporalio/internal/proto_utils'
11
+ require 'temporalio/internal/worker/workflow_instance/child_workflow_handle'
12
+ require 'temporalio/internal/worker/workflow_instance/context'
13
+ require 'temporalio/internal/worker/workflow_instance/details'
14
+ require 'temporalio/internal/worker/workflow_instance/externally_immutable_hash'
15
+ require 'temporalio/internal/worker/workflow_instance/handler_execution'
16
+ require 'temporalio/internal/worker/workflow_instance/handler_hash'
17
+ require 'temporalio/internal/worker/workflow_instance/illegal_call_tracer'
18
+ require 'temporalio/internal/worker/workflow_instance/inbound_implementation'
19
+ require 'temporalio/internal/worker/workflow_instance/outbound_implementation'
20
+ require 'temporalio/internal/worker/workflow_instance/replay_safe_logger'
21
+ require 'temporalio/internal/worker/workflow_instance/replay_safe_metric'
22
+ require 'temporalio/internal/worker/workflow_instance/scheduler'
23
+ require 'temporalio/retry_policy'
24
+ require 'temporalio/scoped_logger'
25
+ require 'temporalio/worker/interceptor'
26
+ require 'temporalio/workflow/info'
27
+ require 'temporalio/workflow/update_info'
28
+ require 'timeout'
29
+
30
+ module Temporalio
31
+ module Internal
32
+ module Worker
33
+ # Instance of a user workflow. This is the instance with all state needed to run the workflow and is expected to
34
+ # be cached by the worker for sticky execution.
35
+ class WorkflowInstance
36
+ def self.new_completion_with_failure(run_id:, error:, failure_converter:, payload_converter:)
37
+ Bridge::Api::WorkflowCompletion::WorkflowActivationCompletion.new(
38
+ run_id: run_id,
39
+ failed: Bridge::Api::WorkflowCompletion::Failure.new(
40
+ failure: begin
41
+ failure_converter.to_failure(error, payload_converter)
42
+ rescue Exception => e # rubocop:disable Lint/RescueException
43
+ Api::Failure::V1::Failure.new(
44
+ message: "Failed converting error to failure: #{e.message}, " \
45
+ "original error message: #{error.message}",
46
+ application_failure_info: Api::Failure::V1::ApplicationFailureInfo.new
47
+ )
48
+ end
49
+ )
50
+ )
51
+ end
52
+
53
+ attr_reader :context, :logger, :info, :scheduler, :disable_eager_activity_execution, :pending_activities,
54
+ :pending_timers, :pending_child_workflow_starts, :pending_child_workflows,
55
+ :pending_external_signals, :pending_external_cancels, :in_progress_handlers, :payload_converter,
56
+ :failure_converter, :cancellation, :continue_as_new_suggested, :current_history_length,
57
+ :current_history_size, :replaying, :random, :signal_handlers, :query_handlers, :update_handlers,
58
+ :context_frozen
59
+
60
+ def initialize(details)
61
+ # Initialize general state
62
+ @context = Context.new(self)
63
+ if details.illegal_calls && !details.illegal_calls.empty?
64
+ @tracer = IllegalCallTracer.new(details.illegal_calls)
65
+ end
66
+ @logger = ReplaySafeLogger.new(logger: details.logger, instance: self)
67
+ @logger.scoped_values_getter = proc { scoped_logger_info }
68
+ @runtime_metric_meter = details.metric_meter
69
+ @scheduler = Scheduler.new(self)
70
+ @payload_converter = details.payload_converter
71
+ @failure_converter = details.failure_converter
72
+ @disable_eager_activity_execution = details.disable_eager_activity_execution
73
+ @pending_activities = {} # Keyed by sequence, value is fiber to resume with proto result
74
+ @pending_timers = {} # Keyed by sequence, value is fiber to resume with proto result
75
+ @pending_child_workflow_starts = {} # Keyed by sequence, value is fiber to resume with proto result
76
+ @pending_child_workflows = {} # Keyed by sequence, value is ChildWorkflowHandle to resolve with proto result
77
+ @pending_external_signals = {} # Keyed by sequence, value is fiber to resume with proto result
78
+ @pending_external_cancels = {} # Keyed by sequence, value is fiber to resume with proto result
79
+ @buffered_signals = {} # Keyed by signal name, value is array of signal jobs
80
+ # TODO(cretz): Should these be sets instead? Both should be fairly low counts.
81
+ @in_progress_handlers = [] # Value is HandlerExecution
82
+ @patches_notified = []
83
+ @definition = details.definition
84
+ @interceptors = details.interceptors
85
+ @cancellation, @cancellation_proc = Cancellation.new
86
+ @continue_as_new_suggested = false
87
+ @current_history_length = 0
88
+ @current_history_size = 0
89
+ @replaying = false
90
+ @failure_exception_types = details.workflow_failure_exception_types + @definition.failure_exception_types
91
+ @signal_handlers = HandlerHash.new(
92
+ details.definition.signals,
93
+ Workflow::Definition::Signal
94
+ ) do |defn|
95
+ # New definition, drain buffer. If it's dynamic (i.e. no name) drain them all.
96
+ to_drain = if defn.name.nil?
97
+ all_signals = @buffered_signals.values.flatten
98
+ @buffered_signals.clear
99
+ all_signals
100
+ else
101
+ @buffered_signals.delete(defn.name)
102
+ end
103
+ to_drain&.each { |job| apply_signal(job) }
104
+ end
105
+ @query_handlers = HandlerHash.new(details.definition.queries, Workflow::Definition::Query)
106
+ @update_handlers = HandlerHash.new(details.definition.updates, Workflow::Definition::Update)
107
+
108
+ # Create all things needed from initial job
109
+ @init_job = details.initial_activation.jobs.find { |j| !j.initialize_workflow.nil? }&.initialize_workflow
110
+ raise 'Missing init job from first activation' unless @init_job
111
+
112
+ illegal_call_tracing_disabled do
113
+ @info = Workflow::Info.new(
114
+ attempt: @init_job.attempt,
115
+ continued_run_id: ProtoUtils.string_or(@init_job.continued_from_execution_run_id),
116
+ cron_schedule: ProtoUtils.string_or(@init_job.cron_schedule),
117
+ execution_timeout: ProtoUtils.duration_to_seconds(@init_job.workflow_execution_timeout),
118
+ last_failure: if @init_job.continued_failure
119
+ @failure_converter.from_failure(@init_job.continued_failure, @payload_converter)
120
+ end,
121
+ last_result: if @init_job.last_completion_result
122
+ @payload_converter.from_payloads(@init_job.last_completion_result).first
123
+ end,
124
+ namespace: details.namespace,
125
+ parent: if @init_job.parent_workflow_info
126
+ Workflow::Info::ParentInfo.new(
127
+ namespace: @init_job.parent_workflow_info.namespace,
128
+ run_id: @init_job.parent_workflow_info.run_id,
129
+ workflow_id: @init_job.parent_workflow_info.workflow_id
130
+ )
131
+ end,
132
+ retry_policy: (RetryPolicy._from_proto(@init_job.retry_policy) if @init_job.retry_policy),
133
+ run_id: details.initial_activation.run_id,
134
+ run_timeout: ProtoUtils.duration_to_seconds(@init_job.workflow_run_timeout),
135
+ start_time: ProtoUtils.timestamp_to_time(details.initial_activation.timestamp) || raise,
136
+ task_queue: details.task_queue,
137
+ task_timeout: ProtoUtils.duration_to_seconds(@init_job.workflow_task_timeout) || raise,
138
+ workflow_id: @init_job.workflow_id,
139
+ workflow_type: @init_job.workflow_type
140
+ ).freeze
141
+
142
+ @random = Random.new(@init_job.randomness_seed)
143
+ end
144
+ end
145
+
146
+ def activate(activation)
147
+ # Run inside of scheduler
148
+ run_in_scheduler { activate_internal(activation) }
149
+ end
150
+
151
+ def add_command(command)
152
+ raise Workflow::InvalidWorkflowStateError, 'Cannot add commands in this context' if @context_frozen
153
+
154
+ @commands << command
155
+ end
156
+
157
+ def instance
158
+ @instance or raise 'Instance accessed before created'
159
+ end
160
+
161
+ def search_attributes
162
+ # Lazy on first access
163
+ @search_attributes ||= SearchAttributes._from_proto(
164
+ @init_job.search_attributes, disable_mutations: true, never_nil: true
165
+ ) || raise
166
+ end
167
+
168
+ def memo
169
+ # Lazy on first access
170
+ @memo ||= ExternallyImmutableHash.new(ProtoUtils.memo_from_proto(@init_job.memo, payload_converter) || {})
171
+ end
172
+
173
+ def now
174
+ # Create each time
175
+ ProtoUtils.timestamp_to_time(@now_timestamp) or raise 'Time unexpectedly not present'
176
+ end
177
+
178
+ def illegal_call_tracing_disabled(&)
179
+ @tracer.disable(&)
180
+ end
181
+
182
+ def patch(patch_id:, deprecated:)
183
+ # Use memoized result if present. If this is being deprecated, we can still use memoized result and skip the
184
+ # command.
185
+ patch_id = patch_id.to_s
186
+ @patches_memoized ||= {}
187
+ @patches_memoized.fetch(patch_id) do
188
+ patched = !replaying || @patches_notified.include?(patch_id)
189
+ @patches_memoized[patch_id] = patched
190
+ if patched
191
+ add_command(
192
+ Bridge::Api::WorkflowCommands::WorkflowCommand.new(
193
+ set_patch_marker: Bridge::Api::WorkflowCommands::SetPatchMarker.new(patch_id:, deprecated:)
194
+ )
195
+ )
196
+ end
197
+ patched
198
+ end
199
+ end
200
+
201
+ def metric_meter
202
+ @metric_meter ||= ReplaySafeMetric::Meter.new(
203
+ @runtime_metric_meter.with_additional_attributes(
204
+ {
205
+ namespace: info.namespace,
206
+ task_queue: info.task_queue,
207
+ workflow_type: info.workflow_type
208
+ }
209
+ )
210
+ )
211
+ end
212
+
213
+ private
214
+
215
+ def run_in_scheduler(&)
216
+ Fiber.set_scheduler(@scheduler)
217
+ if @tracer
218
+ @tracer.enable(&)
219
+ else
220
+ yield
221
+ end
222
+ ensure
223
+ Fiber.set_scheduler(nil)
224
+ end
225
+
226
+ def activate_internal(activation)
227
+ # Reset some activation state
228
+ @commands = []
229
+ @current_activation_error = nil
230
+ @continue_as_new_suggested = activation.continue_as_new_suggested
231
+ @current_history_length = activation.history_length
232
+ @current_history_size = activation.history_size_bytes
233
+ @replaying = activation.is_replaying
234
+ @now_timestamp = activation.timestamp
235
+
236
+ # Apply jobs and run event loop
237
+ begin
238
+ # Create instance if it doesn't already exist
239
+ @instance ||= with_context_frozen { create_instance }
240
+
241
+ # Apply jobs
242
+ activation.jobs.each { |job| apply(job) }
243
+
244
+ # Schedule primary 'execute' if not already running (i.e. this is
245
+ # the first activation)
246
+ @primary_fiber ||= schedule(top_level: true) { run_workflow }
247
+
248
+ # Run the event loop
249
+ @scheduler.run_until_all_yielded
250
+ rescue Exception => e # rubocop:disable Lint/RescueException
251
+ on_top_level_exception(e)
252
+ end
253
+
254
+ # If we are not replaying and workflow is complete but not a
255
+ # failure (i.e. success, continue as new, or cancel), we warn for
256
+ # any unfinished handlers.
257
+ if !@replaying && @commands.any? do |c|
258
+ !c.complete_workflow_execution.nil? ||
259
+ !c.continue_as_new_workflow_execution.nil? ||
260
+ !c.cancel_workflow_execution.nil?
261
+ end
262
+ warn_on_any_unfinished_handlers
263
+ end
264
+
265
+ # Return success or failure
266
+ if @current_activation_error
267
+ @logger.replay_safety_disabled do
268
+ @logger.warn('Failed activation')
269
+ @logger.warn(@current_activation_error)
270
+ end
271
+ WorkflowInstance.new_completion_with_failure(
272
+ run_id: activation.run_id,
273
+ error: @current_activation_error,
274
+ failure_converter: @failure_converter,
275
+ payload_converter: @payload_converter
276
+ )
277
+ else
278
+ Bridge::Api::WorkflowCompletion::WorkflowActivationCompletion.new(
279
+ run_id: activation.run_id,
280
+ successful: Bridge::Api::WorkflowCompletion::Success.new(commands: @commands)
281
+ )
282
+ end
283
+ ensure
284
+ @commands = nil
285
+ @current_activation_error = nil
286
+ end
287
+
288
+ def create_instance
289
+ # Convert workflow arguments
290
+ @workflow_arguments = convert_args(payload_array: @init_job.arguments,
291
+ method_name: :execute,
292
+ raw_args: @definition.raw_args)
293
+
294
+ # Initialize interceptors
295
+ @inbound = @interceptors.reverse_each.reduce(InboundImplementation.new(self)) do |acc, int|
296
+ int.intercept_workflow(acc)
297
+ end
298
+ @inbound.init(OutboundImplementation.new(self))
299
+
300
+ # Create the user instance
301
+ if @definition.init
302
+ @definition.workflow_class.new(*@workflow_arguments)
303
+ else
304
+ @definition.workflow_class.new
305
+ end
306
+ end
307
+
308
+ def apply(job)
309
+ case job.variant
310
+ when :initialize_workflow
311
+ # Ignore
312
+ when :fire_timer
313
+ pending_timers.delete(job.fire_timer.seq)&.resume
314
+ when :update_random_seed
315
+ @random = illegal_call_tracing_disabled { Random.new(job.update_random_seed.randomness_seed) }
316
+ when :query_workflow
317
+ apply_query(job.query_workflow)
318
+ when :cancel_workflow
319
+ # TODO(cretz): Use the details somehow?
320
+ @cancellation_proc.call(reason: 'Workflow canceled')
321
+ when :signal_workflow
322
+ apply_signal(job.signal_workflow)
323
+ when :resolve_activity
324
+ pending_activities.delete(job.resolve_activity.seq)&.resume(job.resolve_activity.result)
325
+ when :notify_has_patch
326
+ @patches_notified << job.notify_has_patch.patch_id
327
+ when :resolve_child_workflow_execution_start
328
+ pending_child_workflow_starts.delete(job.resolve_child_workflow_execution_start.seq)&.resume(
329
+ job.resolve_child_workflow_execution_start
330
+ )
331
+ when :resolve_child_workflow_execution
332
+ pending_child_workflows.delete(job.resolve_child_workflow_execution.seq)&._resolve(
333
+ job.resolve_child_workflow_execution.result
334
+ )
335
+ when :resolve_signal_external_workflow
336
+ pending_external_signals.delete(job.resolve_signal_external_workflow.seq)&.resume(
337
+ job.resolve_signal_external_workflow
338
+ )
339
+ when :resolve_request_cancel_external_workflow
340
+ pending_external_cancels.delete(job.resolve_request_cancel_external_workflow.seq)&.resume(
341
+ job.resolve_request_cancel_external_workflow
342
+ )
343
+ when :do_update
344
+ apply_update(job.do_update)
345
+ else
346
+ raise "Unrecognized activation job variant: #{job.variant}"
347
+ end
348
+ end
349
+
350
+ def apply_signal(job)
351
+ defn = signal_handlers[job.signal_name] || signal_handlers[nil]
352
+ handler_exec =
353
+ if defn
354
+ HandlerExecution.new(name: job.signal_name, update_id: nil, unfinished_policy: defn.unfinished_policy)
355
+ end
356
+ # Process as a top level handler so that errors are treated as if in primary workflow method
357
+ schedule(top_level: true, handler_exec:) do
358
+ # Send to interceptor if there is a definition, buffer otherwise
359
+ if defn
360
+ @inbound.handle_signal(
361
+ Temporalio::Worker::Interceptor::Workflow::HandleSignalInput.new(
362
+ signal: job.signal_name,
363
+ args: begin
364
+ convert_handler_args(payload_array: job.input, defn:)
365
+ rescue StandardError => e
366
+ # Signals argument conversion failure must not fail task
367
+ @logger.error("Failed converting signal input arguments for #{job.signal_name}, dropping signal")
368
+ @logger.error(e)
369
+ next
370
+ end,
371
+ definition: defn,
372
+ headers: ProtoUtils.headers_from_proto_map(job.headers, @payload_converter) || {}
373
+ )
374
+ )
375
+ else
376
+ buffered = @buffered_signals[job.signal_name]
377
+ buffered = @buffered_signals[job.signal_name] = [] if buffered.nil?
378
+ buffered << job
379
+ end
380
+ end
381
+ end
382
+
383
+ def apply_query(job)
384
+ # TODO(cretz): __temporal_workflow_metadata
385
+ defn = case job.query_type
386
+ when '__stack_trace'
387
+ Workflow::Definition::Query.new(
388
+ name: '__stack_trace',
389
+ to_invoke: proc { scheduler.stack_trace }
390
+ )
391
+ else
392
+ query_handlers[job.query_type] || query_handlers[nil]
393
+ end
394
+ schedule do
395
+ unless defn
396
+ raise "Query handler for #{job.query_type} expected but not found, " \
397
+ "known queries: [#{query_handlers.keys.compact.sort.join(', ')}]"
398
+ end
399
+
400
+ result = with_context_frozen do
401
+ @inbound.handle_query(
402
+ Temporalio::Worker::Interceptor::Workflow::HandleQueryInput.new(
403
+ id: job.query_id,
404
+ query: job.query_type,
405
+ args: begin
406
+ convert_handler_args(payload_array: job.arguments, defn:)
407
+ rescue StandardError => e
408
+ raise "Failed converting query input arguments: #{e}"
409
+ end,
410
+ definition: defn,
411
+ headers: ProtoUtils.headers_from_proto_map(job.headers, @payload_converter) || {}
412
+ )
413
+ )
414
+ end
415
+ add_command(
416
+ Bridge::Api::WorkflowCommands::WorkflowCommand.new(
417
+ respond_to_query: Bridge::Api::WorkflowCommands::QueryResult.new(
418
+ query_id: job.query_id,
419
+ succeeded: Bridge::Api::WorkflowCommands::QuerySuccess.new(
420
+ response: @payload_converter.to_payload(result)
421
+ )
422
+ )
423
+ )
424
+ )
425
+ rescue Exception => e # rubocop:disable Lint/RescueException
426
+ add_command(
427
+ Bridge::Api::WorkflowCommands::WorkflowCommand.new(
428
+ respond_to_query: Bridge::Api::WorkflowCommands::QueryResult.new(
429
+ query_id: job.query_id,
430
+ failed: @failure_converter.to_failure(e, @payload_converter)
431
+ )
432
+ )
433
+ )
434
+ end
435
+ end
436
+
437
+ def apply_update(job)
438
+ defn = update_handlers[job.name] || update_handlers[nil]
439
+ handler_exec =
440
+ (HandlerExecution.new(name: job.name, update_id: job.id, unfinished_policy: defn.unfinished_policy) if defn)
441
+ schedule(handler_exec:) do
442
+ # Until this is accepted, all errors are rejections
443
+ accepted = false
444
+
445
+ # Set update info
446
+ Fiber[:__temporal_update_info] = Workflow::UpdateInfo.new(id: job.id, name: job.name).freeze
447
+
448
+ # Reject if not present
449
+ unless defn
450
+ raise "Update handler for #{job.name} expected but not found, " \
451
+ "known updates: [#{update_handlers.keys.compact.sort.join(', ')}]"
452
+ end
453
+
454
+ # To match other SDKs, we are only calling the validation interceptor if there is a validator. Also to match
455
+ # other SDKs, we are re-converting the args between validate and update to disallow user mutation in
456
+ # validator/interceptor.
457
+ if job.run_validator && defn.validator_to_invoke
458
+ with_context_frozen do
459
+ @inbound.validate_update(
460
+ Temporalio::Worker::Interceptor::Workflow::HandleUpdateInput.new(
461
+ id: job.id,
462
+ update: job.name,
463
+ args: begin
464
+ convert_handler_args(payload_array: job.input, defn:)
465
+ rescue StandardError => e
466
+ raise "Failed converting update input arguments: #{e}"
467
+ end,
468
+ definition: defn,
469
+ headers: ProtoUtils.headers_from_proto_map(job.headers, @payload_converter) || {}
470
+ )
471
+ )
472
+ end
473
+ end
474
+
475
+ # We build the input before marking accepted so the exception can reject instead of fail task
476
+ input = Temporalio::Worker::Interceptor::Workflow::HandleUpdateInput.new(
477
+ id: job.id,
478
+ update: job.name,
479
+ args: begin
480
+ convert_handler_args(payload_array: job.input, defn:)
481
+ rescue StandardError => e
482
+ raise "Failed converting update input arguments: #{e}"
483
+ end,
484
+ definition: defn,
485
+ headers: ProtoUtils.headers_from_proto_map(job.headers, @payload_converter) || {}
486
+ )
487
+
488
+ # Accept
489
+ add_command(
490
+ Bridge::Api::WorkflowCommands::WorkflowCommand.new(
491
+ update_response: Bridge::Api::WorkflowCommands::UpdateResponse.new(
492
+ protocol_instance_id: job.protocol_instance_id,
493
+ accepted: Google::Protobuf::Empty.new
494
+ )
495
+ )
496
+ )
497
+ accepted = true
498
+
499
+ # Issue update
500
+ result = @inbound.handle_update(input)
501
+
502
+ add_command(
503
+ Bridge::Api::WorkflowCommands::WorkflowCommand.new(
504
+ update_response: Bridge::Api::WorkflowCommands::UpdateResponse.new(
505
+ protocol_instance_id: job.protocol_instance_id,
506
+ completed: @payload_converter.to_payload(result)
507
+ )
508
+ )
509
+ )
510
+ rescue Exception => e # rubocop:disable Lint/RescueException
511
+ # Re-raise to cause task failure if this is accepted but this is not a failure exception
512
+ raise if accepted && !failure_exception?(e)
513
+
514
+ # Reject
515
+ add_command(
516
+ Bridge::Api::WorkflowCommands::WorkflowCommand.new(
517
+ update_response: Bridge::Api::WorkflowCommands::UpdateResponse.new(
518
+ protocol_instance_id: job.protocol_instance_id,
519
+ rejected: @failure_converter.to_failure(e, @payload_converter)
520
+ )
521
+ )
522
+ )
523
+ end
524
+ end
525
+
526
+ def run_workflow
527
+ result = @inbound.execute(
528
+ Temporalio::Worker::Interceptor::Workflow::ExecuteInput.new(
529
+ args: @workflow_arguments,
530
+ headers: ProtoUtils.headers_from_proto_map(@init_job.headers, @payload_converter) || {}
531
+ )
532
+ )
533
+ add_command(
534
+ Bridge::Api::WorkflowCommands::WorkflowCommand.new(
535
+ complete_workflow_execution: Bridge::Api::WorkflowCommands::CompleteWorkflowExecution.new(
536
+ result: @payload_converter.to_payload(result)
537
+ )
538
+ )
539
+ )
540
+ end
541
+
542
+ def schedule(
543
+ top_level: false,
544
+ handler_exec: nil,
545
+ &
546
+ )
547
+ in_progress_handlers << handler_exec if handler_exec
548
+ Fiber.schedule do
549
+ yield
550
+ rescue Exception => e # rubocop:disable Lint/RescueException
551
+ if top_level
552
+ on_top_level_exception(e)
553
+ else
554
+ @current_activation_error ||= e
555
+ end
556
+ ensure
557
+ in_progress_handlers.delete(handler_exec) if handler_exec
558
+ end
559
+ end
560
+
561
+ def on_top_level_exception(err)
562
+ if err.is_a?(Workflow::ContinueAsNewError)
563
+ @logger.debug('Workflow requested continue as new')
564
+ add_command(
565
+ Bridge::Api::WorkflowCommands::WorkflowCommand.new(
566
+ continue_as_new_workflow_execution: Bridge::Api::WorkflowCommands::ContinueAsNewWorkflowExecution.new(
567
+ workflow_type: if err.workflow
568
+ Workflow::Definition._workflow_type_from_workflow_parameter(err.workflow)
569
+ end,
570
+ task_queue: err.task_queue,
571
+ arguments: ProtoUtils.convert_to_payload_array(payload_converter, err.args),
572
+ workflow_run_timeout: ProtoUtils.seconds_to_duration(err.run_timeout),
573
+ workflow_task_timeout: ProtoUtils.seconds_to_duration(err.task_timeout),
574
+ memo: ProtoUtils.memo_to_proto_hash(err.memo, payload_converter),
575
+ headers: ProtoUtils.headers_to_proto_hash(err.headers, payload_converter),
576
+ search_attributes: err.search_attributes&._to_proto,
577
+ retry_policy: err.retry_policy&._to_proto
578
+ )
579
+ )
580
+ )
581
+ elsif @cancellation.canceled? && Error.canceled?(err)
582
+ # If cancel was ever requested and this is a cancellation or an activity/child cancellation, we add a
583
+ # cancel command. Technically this means that a swallowed cancel followed by, say, an activity cancel
584
+ # later on will show the workflow as cancelled. But this is a Temporal limitation in that cancellation is
585
+ # a state not an event.
586
+ @logger.debug('Workflow requested to cancel and properly raised cancel')
587
+ @logger.debug(err)
588
+ add_command(
589
+ Bridge::Api::WorkflowCommands::WorkflowCommand.new(
590
+ cancel_workflow_execution: Bridge::Api::WorkflowCommands::CancelWorkflowExecution.new
591
+ )
592
+ )
593
+ elsif failure_exception?(err)
594
+ @logger.debug('Workflow raised failure')
595
+ @logger.debug(err)
596
+ add_command(
597
+ Bridge::Api::WorkflowCommands::WorkflowCommand.new(
598
+ fail_workflow_execution: Bridge::Api::WorkflowCommands::FailWorkflowExecution.new(
599
+ failure: @failure_converter.to_failure(err, @payload_converter)
600
+ )
601
+ )
602
+ )
603
+ else
604
+ @current_activation_error ||= err
605
+ end
606
+ end
607
+
608
+ def failure_exception?(err)
609
+ err.is_a?(Error::Failure) || err.is_a?(Timeout::Error) || @failure_exception_types.any? do |cls|
610
+ err.is_a?(cls)
611
+ end
612
+ end
613
+
614
+ def with_context_frozen(&)
615
+ @context_frozen = true
616
+ yield
617
+ ensure
618
+ @context_frozen = false
619
+ end
620
+
621
+ def convert_handler_args(payload_array:, defn:)
622
+ convert_args(
623
+ payload_array:,
624
+ method_name: defn.to_invoke.is_a?(Symbol) ? defn.to_invoke : nil,
625
+ raw_args: defn.raw_args,
626
+ ignore_first_param: defn.name.nil? # Dynamic
627
+ )
628
+ end
629
+
630
+ def convert_args(payload_array:, method_name:, raw_args:, ignore_first_param: false)
631
+ # Just in case it is not an array
632
+ payload_array = payload_array.to_ary
633
+
634
+ # We want to discard extra arguments if we can. If there is a method
635
+ # name, try to look it up. Then, assuming there's no :rest, trim args
636
+ # to the amount of :req or :opt there are.
637
+ if method_name && @definition.workflow_class.method_defined?(method_name)
638
+ count = 0
639
+ req_count = 0
640
+ @definition.workflow_class.instance_method(method_name).parameters.each do |(type, _)|
641
+ if type == :rest
642
+ count = nil
643
+ break
644
+ elsif %i[req opt].include?(type)
645
+ count += 1
646
+ req_count += 1 if type == :req
647
+ end
648
+ end
649
+ # Fail if too few required param values, trim off excess if too many. If count is nil, it has a splat.
650
+ if count
651
+ if ignore_first_param
652
+ count -= 1
653
+ req_count -= 1
654
+ end
655
+ if req_count > payload_array.size
656
+ # We have to fail here instead of let Ruby fail the invocation because some handlers, such as signals,
657
+ # want to log and ignore invalid arguments instead of fail and if we used Ruby failure, we can't
658
+ # differentiate between too-few-param caused by us or somewhere else by a user.
659
+ raise ArgumentError, "wrong number of required arguments for #{method_name} " \
660
+ "(given #{payload_array.size}, expected #{req_count})"
661
+ end
662
+ payload_array = payload_array.take(count)
663
+ end
664
+ end
665
+
666
+ # Convert
667
+ if raw_args
668
+ payload_array.map { |p| Converters::RawValue.new(p) }
669
+ else
670
+ ProtoUtils.convert_from_payload_array(@payload_converter, payload_array)
671
+ end
672
+ end
673
+
674
+ def scoped_logger_info
675
+ @scoped_logger_info ||= {
676
+ attempt: info.attempt,
677
+ namespace: info.namespace,
678
+ run_id: info.run_id,
679
+ task_queue: info.task_queue,
680
+ workflow_id: info.workflow_id,
681
+ workflow_type: info.workflow_type
682
+ }
683
+ # Append update info if there is any
684
+ update_info = Fiber[:__temporal_update_info]
685
+ return @scoped_logger_info unless update_info
686
+
687
+ @scoped_logger_info.merge({ update_id: update_info.id, update_name: update_info.name })
688
+ end
689
+
690
+ def warn_on_any_unfinished_handlers
691
+ updates, signals = in_progress_handlers.select do |h|
692
+ h.unfinished_policy == Workflow::HandlerUnfinishedPolicy::WARN_AND_ABANDON
693
+ end.partition(&:update_id)
694
+
695
+ unless updates.empty?
696
+ updates_str = JSON.generate(updates.map { |u| { name: u.name, id: u.update_id } })
697
+ warn(
698
+ "[TMPRL1102] Workflow #{info.workflow_id} finished while update handlers are still running. This may " \
699
+ 'have interrupted work that the update handler was doing, and the client that sent the update will ' \
700
+ "receive a 'workflow execution already completed' RPCError instead of the update result. You can wait " \
701
+ 'for all update and signal handlers to complete by using ' \
702
+ '`Temporalio::Workflow.wait_condition { Temporalio::Workflow.handlers_finished? }`. ' \
703
+ 'Alternatively, if both you and the clients sending the update are okay with interrupting running ' \
704
+ 'handlers when the workflow finishes, and causing clients to receive errors, then you can disable this ' \
705
+ 'warning via the update handler definition: ' \
706
+ '`workflow_update unfinished_policy: Temporalio::Workflow::HandlerUnfinishedPolicy.ABANDON`. ' \
707
+ "The following updates were unfinished (and warnings were not disabled for their handler): #{updates_str}"
708
+ )
709
+ end
710
+
711
+ return if signals.empty?
712
+
713
+ signals_str = JSON.generate(signals.group_by(&:name)
714
+ .transform_values(&:size).sort_by { |_, v| -v }.map { |name, count| { name:, count: } })
715
+ warn(
716
+ "[TMPRL1102] Workflow #{info.workflow_id} finished while signal handlers are still running. This may " \
717
+ 'have interrupted work that the signal handler was doing. You can wait for all update and signal ' \
718
+ 'handlers to complete by using ' \
719
+ '`Temporalio::Workflow.wait_condition { Temporalio::Workflow.handlers_finished? }`. ' \
720
+ 'Alternatively, if both you and the clients sending the signal are okay with interrupting running ' \
721
+ 'handlers when the workflow finishes, then you can disable this warning via the signal handler ' \
722
+ 'definition: ' \
723
+ '`workflow_signal unfinished_policy: Temporalio::Workflow::HandlerUnfinishedPolicy.ABANDON`. ' \
724
+ "The following signals were unfinished (and warnings were not disabled for their handler): #{signals_str}"
725
+ )
726
+ end
727
+ end
728
+ end
729
+ end
730
+ end