@temporalio/core-bridge 1.13.2 → 1.14.0

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.
Files changed (388) hide show
  1. package/Cargo.lock +135 -100
  2. package/Cargo.toml +3 -2
  3. package/{sdk-core/fsm/rustfsm_trait/LICENSE.txt → LICENSE} +5 -5
  4. package/README.md +0 -1
  5. package/bridge-macros/Cargo.toml +16 -0
  6. package/bridge-macros/src/derive_js_function.rs +126 -0
  7. package/bridge-macros/src/derive_tryfromjs.rs +138 -0
  8. package/bridge-macros/src/derive_tryintojs.rs +151 -0
  9. package/bridge-macros/src/lib.rs +42 -0
  10. package/lib/native.d.ts +13 -6
  11. package/package.json +6 -5
  12. package/releases/aarch64-apple-darwin/index.node +0 -0
  13. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  14. package/releases/x86_64-apple-darwin/index.node +0 -0
  15. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  16. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  17. package/sdk-core/.cargo/config.toml +9 -3
  18. package/sdk-core/.github/workflows/per-pr.yml +42 -5
  19. package/sdk-core/AGENTS.md +17 -19
  20. package/sdk-core/Cargo.toml +6 -7
  21. package/sdk-core/README.md +12 -15
  22. package/sdk-core/arch_docs/diagrams/deps.svg +102 -0
  23. package/sdk-core/{client → crates/client}/Cargo.toml +7 -9
  24. package/sdk-core/{client → crates/client}/src/lib.rs +110 -159
  25. package/sdk-core/{client → crates/client}/src/metrics.rs +1 -1
  26. package/sdk-core/{client → crates/client}/src/raw.rs +73 -44
  27. package/sdk-core/crates/client/src/request_extensions.rs +40 -0
  28. package/sdk-core/{client → crates/client}/src/retry.rs +24 -17
  29. package/sdk-core/crates/client/src/worker/mod.rs +1468 -0
  30. package/sdk-core/{client → crates/client}/src/workflow_handle/mod.rs +4 -4
  31. package/sdk-core/{core-api → crates/common}/Cargo.toml +17 -8
  32. package/sdk-core/crates/common/protos/api_cloud_upstream/VERSION +1 -0
  33. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/account/v1/message.proto +18 -0
  34. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/request_response.proto +38 -11
  35. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto +21 -4
  36. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/operation/v1/message.proto +6 -6
  37. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/sink/v1/message.proto +22 -0
  38. package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/create-release.yml +5 -0
  39. package/sdk-core/{core-api → crates/common}/src/envconfig.rs +2 -2
  40. package/sdk-core/{core-api → crates/common}/src/errors.rs +8 -1
  41. package/sdk-core/{fsm/rustfsm_trait/src/lib.rs → crates/common/src/fsm_trait.rs} +1 -27
  42. package/sdk-core/{core-api → crates/common}/src/lib.rs +24 -9
  43. package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/canned_histories.rs +1 -1
  44. package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_builder.rs +1 -1
  45. package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_info.rs +2 -2
  46. package/sdk-core/{sdk-core-protos/src/lib.rs → crates/common/src/protos/mod.rs} +18 -17
  47. package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/test_utils.rs +1 -1
  48. package/sdk-core/{core-api → crates/common}/src/telemetry/metrics.rs +447 -50
  49. package/sdk-core/{core-api → crates/common}/src/telemetry.rs +3 -1
  50. package/sdk-core/{core-api → crates/common}/src/worker.rs +112 -18
  51. package/sdk-core/crates/common/tests/worker_task_types_test.rs +129 -0
  52. package/sdk-core/crates/macros/Cargo.toml +23 -0
  53. package/sdk-core/{fsm/rustfsm_procmacro → crates/macros}/src/lib.rs +6 -11
  54. package/sdk-core/{sdk → crates/sdk}/Cargo.toml +10 -10
  55. package/sdk-core/{sdk → crates/sdk}/src/activity_context.rs +8 -6
  56. package/sdk-core/{sdk → crates/sdk}/src/interceptors.rs +1 -1
  57. package/sdk-core/{sdk → crates/sdk}/src/lib.rs +42 -37
  58. package/sdk-core/{sdk → crates/sdk}/src/workflow_context/options.rs +2 -2
  59. package/sdk-core/{sdk → crates/sdk}/src/workflow_context.rs +21 -19
  60. package/sdk-core/{sdk → crates/sdk}/src/workflow_future.rs +1 -1
  61. package/sdk-core/{core → crates/sdk-core}/Cargo.toml +32 -25
  62. package/sdk-core/{tests → crates/sdk-core/benches}/workflow_replay_bench.rs +10 -10
  63. package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +32 -0
  64. package/sdk-core/crates/sdk-core/machine_coverage/CancelExternalMachine_Coverage.puml +9 -0
  65. package/sdk-core/crates/sdk-core/machine_coverage/CancelWorkflowMachine_Coverage.puml +6 -0
  66. package/sdk-core/crates/sdk-core/machine_coverage/ChildWorkflowMachine_Coverage.puml +27 -0
  67. package/sdk-core/crates/sdk-core/machine_coverage/CompleteWorkflowMachine_Coverage.puml +6 -0
  68. package/sdk-core/crates/sdk-core/machine_coverage/ContinueAsNewWorkflowMachine_Coverage.puml +6 -0
  69. package/sdk-core/crates/sdk-core/machine_coverage/FailWorkflowMachine_Coverage.puml +6 -0
  70. package/sdk-core/crates/sdk-core/machine_coverage/LocalActivityMachine_Coverage.puml +23 -0
  71. package/sdk-core/crates/sdk-core/machine_coverage/ModifyWorkflowPropertiesMachine_Coverage.puml +5 -0
  72. package/sdk-core/crates/sdk-core/machine_coverage/PatchMachine_Coverage.puml +8 -0
  73. package/sdk-core/crates/sdk-core/machine_coverage/SignalExternalMachine_Coverage.puml +12 -0
  74. package/sdk-core/crates/sdk-core/machine_coverage/TimerMachine_Coverage.puml +13 -0
  75. package/sdk-core/crates/sdk-core/machine_coverage/UpdateMachine_Coverage.puml +19 -0
  76. package/sdk-core/crates/sdk-core/machine_coverage/UpsertSearchAttributesMachine_Coverage.puml +5 -0
  77. package/sdk-core/crates/sdk-core/machine_coverage/WorkflowTaskMachine_Coverage.puml +11 -0
  78. package/sdk-core/{core → crates/sdk-core}/src/abstractions.rs +62 -6
  79. package/sdk-core/crates/sdk-core/src/antithesis.rs +60 -0
  80. package/sdk-core/{core → crates/sdk-core}/src/core_tests/activity_tasks.rs +36 -31
  81. package/sdk-core/{core → crates/sdk-core}/src/core_tests/mod.rs +12 -9
  82. package/sdk-core/{core → crates/sdk-core}/src/core_tests/queries.rs +24 -21
  83. package/sdk-core/{core → crates/sdk-core}/src/core_tests/replay_flag.rs +10 -8
  84. package/sdk-core/{core → crates/sdk-core}/src/core_tests/updates.rs +17 -15
  85. package/sdk-core/{core → crates/sdk-core}/src/core_tests/workers.rs +242 -17
  86. package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_cancels.rs +1 -1
  87. package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_tasks.rs +126 -39
  88. package/sdk-core/{core → crates/sdk-core}/src/debug_client.rs +1 -1
  89. package/sdk-core/{core → crates/sdk-core}/src/ephemeral_server/mod.rs +3 -3
  90. package/sdk-core/crates/sdk-core/src/histfetch.rs +33 -0
  91. package/sdk-core/{core → crates/sdk-core}/src/internal_flags.rs +4 -3
  92. package/sdk-core/{core → crates/sdk-core}/src/lib.rs +85 -43
  93. package/sdk-core/{core → crates/sdk-core}/src/pollers/mod.rs +8 -6
  94. package/sdk-core/{core → crates/sdk-core}/src/pollers/poll_buffer.rs +51 -16
  95. package/sdk-core/{core → crates/sdk-core}/src/protosext/mod.rs +1 -1
  96. package/sdk-core/{core → crates/sdk-core}/src/protosext/protocol_messages.rs +1 -1
  97. package/sdk-core/{core → crates/sdk-core}/src/replay/mod.rs +14 -11
  98. package/sdk-core/{core → crates/sdk-core}/src/retry_logic.rs +19 -1
  99. package/sdk-core/{core → crates/sdk-core}/src/telemetry/log_export.rs +2 -2
  100. package/sdk-core/{core → crates/sdk-core}/src/telemetry/metrics.rs +80 -34
  101. package/sdk-core/{core → crates/sdk-core}/src/telemetry/mod.rs +4 -4
  102. package/sdk-core/{core → crates/sdk-core}/src/telemetry/otel.rs +1 -1
  103. package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_meter.rs +13 -13
  104. package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_server.rs +2 -2
  105. package/sdk-core/{core → crates/sdk-core}/src/test_help/integ_helpers.rs +127 -40
  106. package/sdk-core/{core → crates/sdk-core}/src/test_help/unit_helpers.rs +13 -11
  107. package/sdk-core/{core → crates/sdk-core}/src/worker/activities/activity_heartbeat_manager.rs +2 -2
  108. package/sdk-core/{core → crates/sdk-core}/src/worker/activities/local_activities.rs +14 -12
  109. package/sdk-core/{core → crates/sdk-core}/src/worker/activities.rs +21 -12
  110. package/sdk-core/{core → crates/sdk-core}/src/worker/client/mocks.rs +25 -12
  111. package/sdk-core/{core → crates/sdk-core}/src/worker/client.rs +164 -71
  112. package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +246 -0
  113. package/sdk-core/crates/sdk-core/src/worker/mod.rs +1462 -0
  114. package/sdk-core/{core → crates/sdk-core}/src/worker/nexus.rs +15 -14
  115. package/sdk-core/{core → crates/sdk-core}/src/worker/slot_provider.rs +12 -13
  116. package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/fixed_size.rs +5 -1
  117. package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/resource_based.rs +453 -57
  118. package/sdk-core/{core → crates/sdk-core}/src/worker/tuner.rs +21 -4
  119. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/driven_workflow.rs +1 -1
  120. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/history_update.rs +2 -2
  121. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/activity_state_machine.rs +147 -37
  122. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_external_state_machine.rs +8 -9
  123. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_nexus_op_state_machine.rs +14 -12
  124. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_workflow_state_machine.rs +6 -7
  125. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/child_workflow_state_machine.rs +31 -37
  126. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/complete_workflow_state_machine.rs +13 -8
  127. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +6 -7
  128. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/fail_workflow_state_machine.rs +6 -7
  129. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/local_activity_state_machine.rs +33 -30
  130. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/mod.rs +22 -17
  131. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +4 -3
  132. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/nexus_operation_state_machine.rs +20 -22
  133. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/patch_state_machine.rs +12 -11
  134. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/signal_external_state_machine.rs +9 -12
  135. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/timer_state_machine.rs +26 -13
  136. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/transition_coverage.rs +1 -2
  137. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/update_state_machine.rs +19 -13
  138. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +20 -18
  139. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines/local_acts.rs +1 -1
  140. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines.rs +61 -70
  141. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_task_state_machine.rs +13 -15
  142. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/managed_run.rs +55 -37
  143. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/mod.rs +166 -60
  144. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/run_cache.rs +10 -7
  145. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_extraction.rs +4 -2
  146. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_poller.rs +15 -4
  147. package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/workflow_stream.rs +30 -16
  148. package/sdk-core/{tests → crates/sdk-core/tests}/c_bridge_smoke_test.c +1 -1
  149. package/sdk-core/{tests → crates/sdk-core/tests}/cloud_tests.rs +1 -1
  150. package/sdk-core/crates/sdk-core/tests/common/fake_grpc_server.rs +106 -0
  151. package/sdk-core/{tests → crates/sdk-core/tests}/common/http_proxy.rs +1 -1
  152. package/sdk-core/{tests → crates/sdk-core/tests}/common/mod.rs +93 -74
  153. package/sdk-core/{tests → crates/sdk-core/tests}/common/workflows.rs +4 -3
  154. package/sdk-core/crates/sdk-core/tests/fsm_procmacro.rs +6 -0
  155. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dupe_transitions_fail.rs +1 -3
  156. package/sdk-core/crates/sdk-core/tests/fsm_trybuild/dupe_transitions_fail.stderr +12 -0
  157. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dynamic_dest_pass.rs +2 -4
  158. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.rs +1 -3
  159. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.stderr +4 -4
  160. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_arg_pass.rs +2 -4
  161. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_pass.rs +2 -4
  162. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/medium_complex_pass.rs +2 -4
  163. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/no_handle_conversions_require_into_fail.rs +2 -4
  164. package/sdk-core/crates/sdk-core/tests/fsm_trybuild/no_handle_conversions_require_into_fail.stderr +15 -0
  165. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/simple_pass.rs +2 -4
  166. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/struct_event_variant_fail.rs +1 -3
  167. package/sdk-core/crates/sdk-core/tests/fsm_trybuild/struct_event_variant_fail.stderr +5 -0
  168. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_more_item_event_variant_fail.rs +1 -3
  169. package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_more_item_event_variant_fail.stderr +5 -0
  170. package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_zero_item_event_variant_fail.rs +1 -3
  171. package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_zero_item_event_variant_fail.stderr +5 -0
  172. package/sdk-core/{tests → crates/sdk-core/tests}/global_metric_tests.rs +14 -15
  173. package/sdk-core/{tests → crates/sdk-core/tests/heavy_tests}/fuzzy_workflow.rs +3 -3
  174. package/sdk-core/{tests → crates/sdk-core/tests}/heavy_tests.rs +19 -12
  175. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/activity_functions.rs +1 -1
  176. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/client_tests.rs +16 -111
  177. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/ephemeral_server_tests.rs +5 -6
  178. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/heartbeat_tests.rs +23 -19
  179. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/metrics_tests.rs +134 -60
  180. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/pagination_tests.rs +4 -4
  181. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/polling_tests.rs +37 -36
  182. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/queries_tests.rs +12 -10
  183. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/update_tests.rs +41 -29
  184. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/visibility_tests.rs +24 -19
  185. package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +1061 -0
  186. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_tests.rs +113 -51
  187. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_versioning_tests.rs +19 -17
  188. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/activities.rs +35 -30
  189. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/appdata_propagation.rs +3 -3
  190. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/cancel_external.rs +14 -9
  191. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/cancel_wf.rs +13 -8
  192. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/child_workflows.rs +48 -35
  193. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/continue_as_new.rs +14 -9
  194. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/determinism.rs +24 -15
  195. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/eager.rs +9 -4
  196. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/local_activities.rs +47 -47
  197. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/modify_wf_properties.rs +16 -11
  198. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/nexus.rs +51 -23
  199. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/patches.rs +22 -10
  200. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/replay.rs +19 -17
  201. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/resets.rs +14 -5
  202. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/signals.rs +24 -15
  203. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/stickyness.rs +8 -6
  204. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/timers.rs +28 -18
  205. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/upsert_search_attrs.rs +18 -13
  206. package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests.rs +46 -41
  207. package/sdk-core/{tests → crates/sdk-core/tests}/main.rs +15 -9
  208. package/sdk-core/{tests → crates/sdk-core/tests}/manual_tests.rs +20 -14
  209. package/sdk-core/{tests → crates/sdk-core/tests}/runner.rs +2 -2
  210. package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/mod.rs +10 -5
  211. package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/priority.rs +5 -5
  212. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/Cargo.toml +13 -10
  213. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/include/temporal-sdk-core-c-bridge.h +32 -23
  214. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/client.rs +55 -32
  215. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/envconfig.rs +1 -1
  216. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/lib.rs +1 -1
  217. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/metric.rs +1 -1
  218. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/runtime.rs +24 -9
  219. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/testing.rs +1 -1
  220. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/context.rs +11 -10
  221. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/mod.rs +7 -7
  222. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/utils.rs +3 -4
  223. package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/worker.rs +111 -58
  224. package/sdk-core/docker-cgroup-tests.sh +24 -0
  225. package/sdk-core/{docker → etc/docker}/docker-compose-ci.yaml +9 -9
  226. package/sdk-core/{docker → etc/docker}/docker-compose-telem.yaml +11 -11
  227. package/sdk-core/{docker → etc/docker}/docker-compose.yaml +8 -8
  228. package/sdk-core/{integ-with-otel.sh → etc/integ-with-otel.sh} +1 -1
  229. package/sdk-core/etc/regen-depgraph.sh +2 -2
  230. package/src/client.rs +24 -33
  231. package/src/helpers/try_from_js.rs +1 -1
  232. package/src/logs.rs +1 -1
  233. package/src/metrics.rs +3 -3
  234. package/src/runtime.rs +42 -28
  235. package/src/testing.rs +3 -3
  236. package/src/worker.rs +70 -36
  237. package/ts/native.ts +13 -6
  238. package/LICENSE.md +0 -23
  239. package/sdk-core/client/src/worker_registry/mod.rs +0 -282
  240. package/sdk-core/core/src/worker/heartbeat.rs +0 -230
  241. package/sdk-core/core/src/worker/mod.rs +0 -990
  242. package/sdk-core/etc/deps.svg +0 -162
  243. package/sdk-core/fsm/Cargo.toml +0 -21
  244. package/sdk-core/fsm/README.md +0 -3
  245. package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +0 -27
  246. package/sdk-core/fsm/rustfsm_procmacro/LICENSE.txt +0 -21
  247. package/sdk-core/fsm/rustfsm_procmacro/tests/progress.rs +0 -8
  248. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +0 -12
  249. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +0 -15
  250. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.stderr +0 -5
  251. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.stderr +0 -5
  252. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.stderr +0 -5
  253. package/sdk-core/fsm/rustfsm_trait/Cargo.toml +0 -14
  254. package/sdk-core/fsm/src/lib.rs +0 -2
  255. package/sdk-core/sdk-core-protos/Cargo.toml +0 -37
  256. package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/VERSION +0 -1
  257. /package/sdk-core/{client → crates/client}/src/callback_based.rs +0 -0
  258. /package/sdk-core/{client → crates/client}/src/proxy.rs +0 -0
  259. /package/sdk-core/{client → crates/client}/src/replaceable.rs +0 -0
  260. /package/sdk-core/{sdk-core-protos → crates/common}/build.rs +0 -0
  261. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/build.yaml +0 -0
  262. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/push-to-buf.yml +0 -0
  263. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/CODEOWNERS +0 -0
  264. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/LICENSE +0 -0
  265. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/Makefile +0 -0
  266. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/README.md +0 -0
  267. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.gen.yaml +0 -0
  268. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.lock +0 -0
  269. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.yaml +0 -0
  270. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/connectivityrule/v1/message.proto +0 -0
  271. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/identity/v1/message.proto +0 -0
  272. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/namespace/v1/message.proto +0 -0
  273. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/nexus/v1/message.proto +0 -0
  274. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/region/v1/message.proto +0 -0
  275. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/resource/v1/message.proto +0 -0
  276. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/usage/v1/message.proto +0 -0
  277. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/CODEOWNERS +0 -0
  278. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  279. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/ci.yml +0 -0
  280. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/publish-docs.yml +0 -0
  281. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/push-to-buf.yml +0 -0
  282. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-delete-release.yml +0 -0
  283. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-publish-release.yml +0 -0
  284. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-update.yml +0 -0
  285. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/LICENSE +0 -0
  286. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/Makefile +0 -0
  287. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/README.md +0 -0
  288. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/api-linter.yaml +0 -0
  289. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.gen.yaml +0 -0
  290. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.lock +0 -0
  291. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.yaml +0 -0
  292. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/annotations.proto +0 -0
  293. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/http.proto +0 -0
  294. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/any.proto +0 -0
  295. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/descriptor.proto +0 -0
  296. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/duration.proto +0 -0
  297. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/empty.proto +0 -0
  298. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/struct.proto +0 -0
  299. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/timestamp.proto +0 -0
  300. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/wrappers.proto +0 -0
  301. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv2.json +0 -0
  302. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv3.yaml +0 -0
  303. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/payload_description.txt +0 -0
  304. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/activity/v1/message.proto +0 -0
  305. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/batch/v1/message.proto +0 -0
  306. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/command/v1/message.proto +0 -0
  307. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/common/v1/message.proto +0 -0
  308. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/deployment/v1/message.proto +0 -0
  309. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -0
  310. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/command_type.proto +0 -0
  311. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/common.proto +0 -0
  312. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/deployment.proto +0 -0
  313. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/event_type.proto +0 -0
  314. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +0 -0
  315. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/namespace.proto +0 -0
  316. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/nexus.proto +0 -0
  317. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/query.proto +0 -0
  318. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/reset.proto +0 -0
  319. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/schedule.proto +0 -0
  320. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -0
  321. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/update.proto +0 -0
  322. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/workflow.proto +0 -0
  323. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/errordetails/v1/message.proto +0 -0
  324. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/export/v1/message.proto +0 -0
  325. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/failure/v1/message.proto +0 -0
  326. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/filter/v1/message.proto +0 -0
  327. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/history/v1/message.proto +0 -0
  328. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/namespace/v1/message.proto +0 -0
  329. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/nexus/v1/message.proto +0 -0
  330. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +0 -0
  331. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +0 -0
  332. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/protocol/v1/message.proto +0 -0
  333. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/query/v1/message.proto +0 -0
  334. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/replication/v1/message.proto +0 -0
  335. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/rules/v1/message.proto +0 -0
  336. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/schedule/v1/message.proto +0 -0
  337. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/enhanced_stack_trace.proto +0 -0
  338. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +0 -0
  339. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/user_metadata.proto +0 -0
  340. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/worker_config.proto +0 -0
  341. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +0 -0
  342. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +0 -0
  343. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/update/v1/message.proto +0 -0
  344. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/version/v1/message.proto +0 -0
  345. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/worker/v1/message.proto +0 -0
  346. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflow/v1/message.proto +0 -0
  347. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +0 -0
  348. /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +0 -0
  349. /package/sdk-core/{sdk-core-protos → crates/common}/protos/google/rpc/status.proto +0 -0
  350. /package/sdk-core/{sdk-core-protos → crates/common}/protos/grpc/health/v1/health.proto +0 -0
  351. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_result/activity_result.proto +0 -0
  352. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_task/activity_task.proto +0 -0
  353. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -0
  354. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/common/common.proto +0 -0
  355. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/core_interface.proto +0 -0
  356. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/external_data/external_data.proto +0 -0
  357. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/nexus/nexus.proto +0 -0
  358. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +0 -0
  359. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +0 -0
  360. /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -0
  361. /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/Makefile +0 -0
  362. /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/api-linter.yaml +0 -0
  363. /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/buf.yaml +0 -0
  364. /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -0
  365. /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -0
  366. /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/constants.rs +0 -0
  367. /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/task_token.rs +0 -0
  368. /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/utilities.rs +0 -0
  369. /package/sdk-core/{fsm → crates/macros}/LICENSE.txt +0 -0
  370. /package/sdk-core/{sdk → crates/sdk}/src/app_data.rs +0 -0
  371. /package/sdk-core/{core → crates/sdk-core}/src/abstractions/take_cell.rs +0 -0
  372. /package/sdk-core/{core → crates/sdk-core}/src/test_help/mod.rs +0 -0
  373. /package/sdk-core/{core → crates/sdk-core}/src/worker/slot_supplier.rs +0 -0
  374. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/ends_empty_wft_complete.bin +0 -0
  375. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-16_history.bin +0 -0
  376. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-23_history.bin +0 -0
  377. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-85_history.bin +0 -0
  378. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/fail_wf_task.bin +0 -0
  379. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-0_history.bin +0 -0
  380. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-1_history.bin +0 -0
  381. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-2_history.bin +0 -0
  382. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-3_history.bin +0 -0
  383. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/old_change_marker_format.bin +0 -0
  384. /package/sdk-core/{histories → crates/sdk-core/tests/histories}/timer_workflow_history.bin +0 -0
  385. /package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/priority.rs +0 -0
  386. /package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/build.rs +0 -0
  387. /package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/random.rs +0 -0
  388. /package/sdk-core/{cargo-tokio-console.sh → etc/cargo-tokio-console.sh} +0 -0
@@ -1,18 +1,18 @@
1
1
  use super::{
2
- EventInfo, NewMachineWithCommand, OnEventWrapper, WFMachinesAdapter, WFMachinesError,
3
- workflow_machines::MachineResponse,
2
+ EventInfo, MachineError, NewMachineWithCommand, OnEventWrapper, StateMachine, TransitionResult,
3
+ WFMachinesAdapter, WFMachinesError, fsm, workflow_machines::MachineResponse,
4
4
  };
5
5
  use crate::{
6
+ abstractions::dbg_panic,
6
7
  internal_flags::CoreInternalFlags,
7
- worker::workflow::{InternalFlagsRef, machines::HistEventData},
8
+ worker::workflow::{InternalFlagsRef, fatal, machines::HistEventData, nondeterminism},
8
9
  };
9
10
  use itertools::Itertools;
10
- use rustfsm::{MachineError, StateMachine, TransitionResult, fsm};
11
11
  use std::{
12
12
  convert::{TryFrom, TryInto},
13
13
  string::ToString,
14
14
  };
15
- use temporal_sdk_core_protos::{
15
+ use temporalio_common::protos::{
16
16
  coresdk::{
17
17
  child_workflow::{
18
18
  self as wfr, ChildWorkflowCancellationType, ChildWorkflowResult,
@@ -134,10 +134,9 @@ pub(super) struct Cancelled {
134
134
  }
135
135
 
136
136
  fn completion_of_not_abandoned_err() -> WFMachinesError {
137
- WFMachinesError::Nondeterminism(
137
+ nondeterminism!(
138
138
  "Child workflows which don't have the ABANDON cancellation type cannot complete after \
139
139
  being cancelled."
140
- .to_string(),
141
140
  )
142
141
  }
143
142
 
@@ -146,10 +145,9 @@ impl Cancelled {
146
145
  self,
147
146
  ) -> ChildWorkflowMachineTransition<Cancelled> {
148
147
  if self.seen_cancelled_event {
149
- ChildWorkflowMachineTransition::Err(WFMachinesError::Fatal(
148
+ ChildWorkflowMachineTransition::Err(fatal!(
150
149
  "Child workflow has already seen a ChildWorkflowExecutionCanceledEvent, and now \
151
150
  another is being applied! This is a bug, please report."
152
- .to_string(),
153
151
  ))
154
152
  } else {
155
153
  ChildWorkflowMachineTransition::ok(
@@ -234,18 +232,20 @@ impl StartCommandCreated {
234
232
  event_dat.last_task_in_history,
235
233
  ) {
236
234
  if event_dat.wf_id != state.workflow_id {
237
- return TransitionResult::Err(WFMachinesError::Nondeterminism(format!(
235
+ return TransitionResult::Err(nondeterminism!(
238
236
  "Child workflow id of scheduled event '{}' does not \
239
237
  match child workflow id of command '{}'",
240
- event_dat.wf_id, state.workflow_id
241
- )));
238
+ event_dat.wf_id,
239
+ state.workflow_id
240
+ ));
242
241
  }
243
242
  if event_dat.wf_type != state.workflow_type {
244
- return TransitionResult::Err(WFMachinesError::Nondeterminism(format!(
243
+ return TransitionResult::Err(nondeterminism!(
245
244
  "Child workflow type of scheduled event '{}' does not \
246
245
  match child workflow type of command '{}'",
247
- event_dat.wf_type, state.workflow_type
248
- )));
246
+ event_dat.wf_type,
247
+ state.workflow_type
248
+ ));
249
249
  }
250
250
  }
251
251
  state.initiated_event_id = event_dat.event_id;
@@ -497,7 +497,10 @@ impl ChildWorkflowMachine {
497
497
  | c @ ChildWorkflowCommand::IssueCancelAfterStarted { .. } => {
498
498
  self.adapt_response(c, None)
499
499
  }
500
- x => panic!("Invalid cancel event response {x:?}"),
500
+ x => {
501
+ dbg_panic!("Invalid cancel event response {x:?}");
502
+ panic!("Invalid cancel event response {x:?}");
503
+ }
501
504
  })
502
505
  .flatten_ok()
503
506
  .try_collect()?;
@@ -530,8 +533,8 @@ impl TryFrom<HistEventData> for ChildWorkflowMachineEvents {
530
533
  last_task_in_history,
531
534
  })
532
535
  } else {
533
- return Err(WFMachinesError::Fatal(
534
- "StartChildWorkflowExecutionInitiated attributes were unset".to_string(),
536
+ return Err(fatal!(
537
+ "StartChildWorkflowExecutionInitiated attributes were unset"
535
538
  ));
536
539
  }
537
540
  }
@@ -544,14 +547,12 @@ impl TryFrom<HistEventData> for ChildWorkflowMachineEvents {
544
547
  {
545
548
  Self::StartChildWorkflowExecutionFailed(
546
549
  StartChildWorkflowExecutionFailedCause::try_from(cause).map_err(|_| {
547
- WFMachinesError::Fatal(
548
- "Invalid StartChildWorkflowExecutionFailedCause".to_string(),
549
- )
550
+ fatal!("Invalid StartChildWorkflowExecutionFailedCause")
550
551
  })?,
551
552
  )
552
553
  } else {
553
- return Err(WFMachinesError::Fatal(
554
- "StartChildWorkflowExecutionFailed attributes were unset".to_string(),
554
+ return Err(fatal!(
555
+ "StartChildWorkflowExecutionFailed attributes were unset"
555
556
  ));
556
557
  }
557
558
  }
@@ -570,9 +571,8 @@ impl TryFrom<HistEventData> for ChildWorkflowMachineEvents {
570
571
  started_event_id: e.event_id,
571
572
  })
572
573
  } else {
573
- return Err(WFMachinesError::Fatal(
574
+ return Err(fatal!(
574
575
  "ChildWorkflowExecutionStarted attributes were unset or malformed"
575
- .to_string(),
576
576
  ));
577
577
  }
578
578
  }
@@ -585,9 +585,8 @@ impl TryFrom<HistEventData> for ChildWorkflowMachineEvents {
585
585
  {
586
586
  Self::ChildWorkflowExecutionCompleted(result)
587
587
  } else {
588
- return Err(WFMachinesError::Fatal(
588
+ return Err(fatal!(
589
589
  "ChildWorkflowExecutionCompleted attributes were unset or malformed"
590
- .to_string(),
591
590
  ));
592
591
  }
593
592
  }
@@ -598,9 +597,7 @@ impl TryFrom<HistEventData> for ChildWorkflowMachineEvents {
598
597
  {
599
598
  Self::ChildWorkflowExecutionFailed(attrs)
600
599
  } else {
601
- return Err(WFMachinesError::Fatal(
602
- "ChildWorkflowExecutionFailed attributes were unset".to_string(),
603
- ));
600
+ return Err(fatal!("ChildWorkflowExecutionFailed attributes were unset"));
604
601
  }
605
602
  }
606
603
  Ok(EventType::ChildWorkflowExecutionTimedOut) => {
@@ -610,9 +607,8 @@ impl TryFrom<HistEventData> for ChildWorkflowMachineEvents {
610
607
  {
611
608
  Self::ChildWorkflowExecutionTimedOut(atts.retry_state())
612
609
  } else {
613
- return Err(WFMachinesError::Fatal(
610
+ return Err(fatal!(
614
611
  "ChildWorkflowExecutionTimedOut attributes were unset or malformed"
615
- .to_string(),
616
612
  ));
617
613
  }
618
614
  }
@@ -621,9 +617,9 @@ impl TryFrom<HistEventData> for ChildWorkflowMachineEvents {
621
617
  }
622
618
  Ok(EventType::ChildWorkflowExecutionCanceled) => Self::ChildWorkflowExecutionCancelled,
623
619
  _ => {
624
- return Err(WFMachinesError::Nondeterminism(format!(
620
+ return Err(nondeterminism!(
625
621
  "Child workflow machine does not handle this event: {e:?}"
626
- )));
622
+ ));
627
623
  }
628
624
  })
629
625
  }
@@ -770,9 +766,7 @@ fn convert_payloads(
770
766
  result: Option<Payloads>,
771
767
  ) -> Result<Option<Payload>, WFMachinesError> {
772
768
  result.map(TryInto::try_into).transpose().map_err(|pe| {
773
- WFMachinesError::Fatal(format!(
774
- "Not exactly one payload in child workflow result ({pe}) for event: {event_info:?}"
775
- ))
769
+ fatal!("Not exactly one payload in child workflow result ({pe}) for event: {event_info:?}")
776
770
  })
777
771
  }
778
772
 
@@ -1,11 +1,13 @@
1
1
  use super::{
2
- EventInfo, NewMachineWithCommand, OnEventWrapper, WFMachinesAdapter, WFMachinesError,
3
- workflow_machines::MachineResponse,
2
+ EventInfo, NewMachineWithCommand, OnEventWrapper, StateMachine, TransitionResult,
3
+ WFMachinesAdapter, WFMachinesError, fsm, workflow_machines::MachineResponse,
4
+ };
5
+ use crate::{
6
+ abstractions::dbg_panic,
7
+ worker::workflow::{machines::HistEventData, nondeterminism},
4
8
  };
5
- use crate::worker::workflow::machines::HistEventData;
6
- use rustfsm::{StateMachine, TransitionResult, fsm};
7
9
  use std::convert::TryFrom;
8
- use temporal_sdk_core_protos::{
10
+ use temporalio_common::protos::{
9
11
  coresdk::workflow_commands::CompleteWorkflowExecution,
10
12
  temporal::api::{
11
13
  command::v1::command,
@@ -42,7 +44,10 @@ pub(super) fn complete_workflow(attribs: CompleteWorkflowExecution) -> NewMachin
42
44
  .pop()
43
45
  {
44
46
  Some(CompleteWFCommand::AddCommand(c)) => c,
45
- _ => panic!("complete wf machine on_schedule must produce command"),
47
+ unexpected => {
48
+ dbg_panic!("complete wf machine on_schedule must produce command: {unexpected:?}");
49
+ panic!("complete wf machine on_schedule must produce command");
50
+ }
46
51
  };
47
52
  NewMachineWithCommand {
48
53
  command: add_cmd,
@@ -58,9 +63,9 @@ impl TryFrom<HistEventData> for CompleteWorkflowMachineEvents {
58
63
  Ok(match e.event_type() {
59
64
  EventType::WorkflowExecutionCompleted => Self::WorkflowExecutionCompleted,
60
65
  _ => {
61
- return Err(WFMachinesError::Nondeterminism(format!(
66
+ return Err(nondeterminism!(
62
67
  "Complete workflow machine does not handle this event: {e}"
63
- )));
68
+ ));
64
69
  }
65
70
  })
66
71
  }
@@ -1,11 +1,10 @@
1
1
  use super::{
2
- EventInfo, MachineResponse, NewMachineWithCommand, OnEventWrapper, WFMachinesAdapter,
3
- WFMachinesError,
2
+ EventInfo, MachineResponse, NewMachineWithCommand, OnEventWrapper, StateMachine,
3
+ TransitionResult, WFMachinesAdapter, WFMachinesError, fsm,
4
4
  };
5
- use crate::worker::workflow::machines::HistEventData;
6
- use rustfsm::{StateMachine, TransitionResult, fsm};
5
+ use crate::worker::workflow::{machines::HistEventData, nondeterminism};
7
6
  use std::convert::TryFrom;
8
- use temporal_sdk_core_protos::{
7
+ use temporalio_common::protos::{
9
8
  coresdk::workflow_commands::ContinueAsNewWorkflowExecution,
10
9
  temporal::api::{
11
10
  command::v1::continue_as_new_cmd_to_api,
@@ -74,9 +73,9 @@ impl TryFrom<HistEventData> for ContinueAsNewWorkflowMachineEvents {
74
73
  Ok(match e.event_type() {
75
74
  EventType::WorkflowExecutionContinuedAsNew => Self::WorkflowExecutionContinuedAsNew,
76
75
  _ => {
77
- return Err(WFMachinesError::Nondeterminism(format!(
76
+ return Err(nondeterminism!(
78
77
  "Continue as new workflow machine does not handle this event: {e}"
79
- )));
78
+ ));
80
79
  }
81
80
  })
82
81
  }
@@ -1,11 +1,10 @@
1
1
  use super::{
2
- EventInfo, NewMachineWithCommand, OnEventWrapper, WFMachinesAdapter, WFMachinesError,
3
- workflow_machines::MachineResponse,
2
+ EventInfo, NewMachineWithCommand, OnEventWrapper, StateMachine, TransitionResult,
3
+ WFMachinesAdapter, WFMachinesError, fsm, workflow_machines::MachineResponse,
4
4
  };
5
- use crate::worker::workflow::machines::HistEventData;
6
- use rustfsm::{StateMachine, TransitionResult, fsm};
5
+ use crate::worker::workflow::{machines::HistEventData, nondeterminism};
7
6
  use std::convert::TryFrom;
8
- use temporal_sdk_core_protos::{
7
+ use temporalio_common::protos::{
9
8
  coresdk::workflow_commands::FailWorkflowExecution,
10
9
  temporal::api::{
11
10
  command::v1::command,
@@ -85,9 +84,9 @@ impl TryFrom<HistEventData> for FailWorkflowMachineEvents {
85
84
  Ok(match e.event_type() {
86
85
  EventType::WorkflowExecutionFailed => Self::WorkflowExecutionFailed,
87
86
  _ => {
88
- return Err(WFMachinesError::Nondeterminism(format!(
87
+ return Err(nondeterminism!(
89
88
  "Fail workflow machine does not handle this event: {e}"
90
- )));
89
+ ));
91
90
  }
92
91
  })
93
92
  }
@@ -1,6 +1,6 @@
1
1
  use super::{
2
- EventInfo, OnEventWrapper, WFMachinesAdapter, WFMachinesError,
3
- workflow_machines::MachineResponse,
2
+ EventInfo, MachineError, OnEventWrapper, StateMachine, TransitionResult, WFMachinesAdapter,
3
+ WFMachinesError, fsm, workflow_machines::MachineResponse,
4
4
  };
5
5
  use crate::{
6
6
  internal_flags::CoreInternalFlags,
@@ -8,18 +8,18 @@ use crate::{
8
8
  worker::{
9
9
  LocalActivityExecutionResult,
10
10
  workflow::{
11
- InternalFlagsRef,
11
+ InternalFlagsRef, fatal,
12
12
  machines::{HistEventData, activity_state_machine::activity_fail_info},
13
+ nondeterminism,
13
14
  },
14
15
  },
15
16
  };
16
17
  use itertools::Itertools;
17
- use rustfsm::{MachineError, StateMachine, TransitionResult, fsm};
18
18
  use std::{
19
19
  convert::TryFrom,
20
20
  time::{Duration, SystemTime},
21
21
  };
22
- use temporal_sdk_core_protos::{
22
+ use temporalio_common::protos::{
23
23
  constants::LOCAL_ACTIVITY_MARKER_NAME,
24
24
  coresdk::{
25
25
  activity_result::{
@@ -163,8 +163,8 @@ pub(super) fn new_local_activity(
163
163
  }
164
164
  } else {
165
165
  if maybe_pre_resolved.is_some() {
166
- return Err(WFMachinesError::Nondeterminism(
167
- "Local activity cannot be created as pre-resolved while not replaying".to_string(),
166
+ return Err(nondeterminism!(
167
+ "Local activity cannot be created as pre-resolved while not replaying"
168
168
  ));
169
169
  }
170
170
  Executing {}.into()
@@ -211,10 +211,10 @@ impl LocalActivityMachine {
211
211
  LocalActivityMachineState::ResultNotified(_) => Ok(false),
212
212
  LocalActivityMachineState::WaitingMarkerEvent(_) => Ok(true),
213
213
  LocalActivityMachineState::WaitingMarkerEventPreResolved(_) => Ok(true),
214
- _ => Err(WFMachinesError::Fatal(format!(
214
+ _ => Err(fatal!(
215
215
  "Attempted to check for LA marker handling in invalid state {}",
216
216
  self.state()
217
- ))),
217
+ )),
218
218
  }
219
219
  }
220
220
 
@@ -242,12 +242,12 @@ impl LocalActivityMachine {
242
242
  let mut res =
243
243
  OnEventWrapper::on_event_mut(self, LocalActivityMachineEvents::StartedNonReplayWFT)
244
244
  .map_err(|e| match e {
245
- MachineError::InvalidTransition => WFMachinesError::Fatal(format!(
245
+ MachineError::InvalidTransition => fatal!(
246
246
  "Invalid transition while notifying local activity (seq {})\
247
247
  of non-replay-wft-started in {}",
248
248
  self.shared_state.attrs.seq,
249
249
  self.state(),
250
- )),
250
+ ),
251
251
  MachineError::Underlying(e) => e,
252
252
  })?;
253
253
  let res = res.pop().expect("Always produces one response");
@@ -296,12 +296,12 @@ impl LocalActivityMachine {
296
296
  LocalActivityMachineEvents::HandleResult(dat)
297
297
  };
298
298
  let res = OnEventWrapper::on_event_mut(self, evt).map_err(|e| match e {
299
- MachineError::InvalidTransition => WFMachinesError::Fatal(format!(
299
+ MachineError::InvalidTransition => fatal!(
300
300
  "Invalid transition resolving local activity (seq {}, from marker: {}) in {}",
301
301
  self.shared_state.attrs.seq,
302
302
  from_marker,
303
303
  self.state(),
304
- )),
304
+ ),
305
305
  MachineError::Underlying(e) => e,
306
306
  })?;
307
307
 
@@ -543,16 +543,16 @@ impl ResultNotified {
543
543
  dat: CompleteLocalActivityData,
544
544
  ) -> LocalActivityMachineTransition<MarkerCommandRecorded> {
545
545
  if self.result_type == ResultType::Completed && dat.result.is_err() {
546
- return TransitionResult::Err(WFMachinesError::Nondeterminism(format!(
546
+ return TransitionResult::Err(nondeterminism!(
547
547
  "Local activity (seq {}) completed successfully locally, but history said \
548
548
  it failed!",
549
549
  shared.attrs.seq
550
- )));
550
+ ));
551
551
  } else if self.result_type == ResultType::Failed && dat.result.is_ok() {
552
- return TransitionResult::Err(WFMachinesError::Nondeterminism(format!(
552
+ return TransitionResult::Err(nondeterminism!(
553
553
  "Local activity (seq {}) failed locally, but history said it completed!",
554
554
  shared.attrs.seq
555
- )));
555
+ ));
556
556
  }
557
557
  verify_marker_dat!(shared, &dat, TransitionResult::default())
558
558
  }
@@ -812,15 +812,15 @@ impl TryFrom<HistEventData> for LocalActivityMachineEvents {
812
812
  fn try_from(e: HistEventData) -> Result<Self, Self::Error> {
813
813
  let e = e.event;
814
814
  if e.event_type() != EventType::MarkerRecorded {
815
- return Err(WFMachinesError::Nondeterminism(format!(
815
+ return Err(nondeterminism!(
816
816
  "Local activity machine cannot handle this event: {e}"
817
- )));
817
+ ));
818
818
  }
819
819
 
820
820
  match e.into_local_activity_marker_details() {
821
821
  Some(marker_dat) => Ok(LocalActivityMachineEvents::MarkerRecorded(marker_dat)),
822
- _ => Err(WFMachinesError::Nondeterminism(
823
- "Local activity machine encountered an unparsable marker".to_string(),
822
+ _ => Err(nondeterminism!(
823
+ "Local activity machine encountered an unparsable marker"
824
824
  )),
825
825
  }
826
826
  }
@@ -831,11 +831,12 @@ fn verify_marker_data_matches(
831
831
  dat: &CompleteLocalActivityData,
832
832
  ) -> Result<(), WFMachinesError> {
833
833
  if shared.attrs.seq != dat.marker_dat.seq {
834
- return Err(WFMachinesError::Nondeterminism(format!(
834
+ return Err(nondeterminism!(
835
835
  "Local activity marker data has sequence number {} but matched against LA \
836
836
  command with sequence number {}",
837
- dat.marker_dat.seq, shared.attrs.seq
838
- )));
837
+ dat.marker_dat.seq,
838
+ shared.attrs.seq
839
+ ));
839
840
  }
840
841
  // Here we use whether or not we were replaying when we _first invoked_ the LA, because we
841
842
  // are always replaying when we see the marker recorded event, and that would make this check
@@ -845,18 +846,20 @@ fn verify_marker_data_matches(
845
846
  !shared.replaying_when_invoked,
846
847
  ) {
847
848
  if dat.marker_dat.activity_id != shared.attrs.activity_id {
848
- return Err(WFMachinesError::Nondeterminism(format!(
849
+ return Err(nondeterminism!(
849
850
  "Activity id of recorded marker '{}' does not \
850
851
  match activity id of local activity command '{}'",
851
- dat.marker_dat.activity_id, shared.attrs.activity_id
852
- )));
852
+ dat.marker_dat.activity_id,
853
+ shared.attrs.activity_id
854
+ ));
853
855
  }
854
856
  if dat.marker_dat.activity_type != shared.attrs.activity_type {
855
- return Err(WFMachinesError::Nondeterminism(format!(
857
+ return Err(nondeterminism!(
856
858
  "Activity type of recorded marker '{}' does not \
857
859
  match activity type of local activity command '{}'",
858
- dat.marker_dat.activity_type, shared.attrs.activity_type
859
- )));
860
+ dat.marker_dat.activity_type,
861
+ shared.attrs.activity_type
862
+ ));
860
863
  }
861
864
  }
862
865
 
@@ -23,9 +23,13 @@ mod workflow_task_state_machine;
23
23
  #[cfg(test)]
24
24
  mod transition_coverage;
25
25
 
26
+ pub(crate) use temporalio_common::fsm_trait::MachineError;
26
27
  pub(crate) use workflow_machines::{MachinesWFTResponseContent, WorkflowMachines};
27
28
 
28
- use crate::{telemetry::VecDisplayer, worker::workflow::WFMachinesError};
29
+ use crate::{
30
+ telemetry::VecDisplayer,
31
+ worker::workflow::{WFMachinesError, fatal, nondeterminism},
32
+ };
29
33
  use activity_state_machine::ActivityMachine;
30
34
  use cancel_external_state_machine::CancelExternalMachine;
31
35
  use cancel_workflow_state_machine::CancelWorkflowMachine;
@@ -37,16 +41,19 @@ use local_activity_state_machine::LocalActivityMachine;
37
41
  use modify_workflow_properties_state_machine::ModifyWorkflowPropertiesMachine;
38
42
  use nexus_operation_state_machine::NexusOperationMachine;
39
43
  use patch_state_machine::PatchMachine;
40
- use rustfsm::{MachineError, StateMachine};
41
44
  use signal_external_state_machine::SignalExternalMachine;
42
45
  use std::{
43
46
  convert::{TryFrom, TryInto},
44
47
  fmt::{Debug, Display},
45
48
  };
46
- use temporal_sdk_core_protos::temporal::api::{
47
- enums::v1::{CommandType, EventType},
48
- history::v1::HistoryEvent,
49
+ use temporalio_common::{
50
+ fsm_trait::{StateMachine, TransitionResult},
51
+ protos::temporal::api::{
52
+ enums::v1::{CommandType, EventType},
53
+ history::v1::HistoryEvent,
54
+ },
49
55
  };
56
+ use temporalio_macros::fsm;
50
57
  use timer_state_machine::TimerMachine;
51
58
  use update_state_machine::UpdateMachine;
52
59
  use upsert_search_attributes_state_machine::UpsertSearchAttributesMachine;
@@ -123,21 +130,19 @@ where
123
130
  if let Ok(converted_command) = command_type.try_into() {
124
131
  match OnEventWrapper::on_event_mut(self, converted_command) {
125
132
  Ok(c) => process_machine_commands(self, c, None),
126
- Err(MachineError::InvalidTransition) => {
127
- Err(WFMachinesError::Nondeterminism(format!(
128
- "Unexpected command producing an invalid transition {:?} in state {}",
129
- command_type,
130
- self.state()
131
- )))
132
- }
133
+ Err(MachineError::InvalidTransition) => Err(nondeterminism!(
134
+ "Unexpected command producing an invalid transition {:?} in state {}",
135
+ command_type,
136
+ self.state()
137
+ )),
133
138
  Err(MachineError::Underlying(e)) => Err(e.into()),
134
139
  }
135
140
  } else {
136
- Err(WFMachinesError::Nondeterminism(format!(
141
+ Err(nondeterminism!(
137
142
  "Unexpected command {:?} generated by a {:?} machine",
138
143
  command_type,
139
144
  self.name()
140
- )))
145
+ ))
141
146
  }
142
147
  }
143
148
 
@@ -159,12 +164,12 @@ where
159
164
 
160
165
  match OnEventWrapper::on_event_mut(self, converted_event) {
161
166
  Ok(c) => process_machine_commands(self, c, Some(event_info)),
162
- Err(MachineError::InvalidTransition) => Err(WFMachinesError::Fatal(format!(
167
+ Err(MachineError::InvalidTransition) => Err(fatal!(
163
168
  "{} in state {} says the transition is invalid during event {:?}",
164
169
  self.name(),
165
170
  self.state(),
166
171
  event_info
167
- ))),
172
+ )),
168
173
  Err(MachineError::Underlying(e)) => Err(e.into()),
169
174
  }
170
175
  }
@@ -288,7 +293,7 @@ where
288
293
  }
289
294
 
290
295
  struct NewMachineWithCommand {
291
- command: temporal_sdk_core_protos::temporal::api::command::v1::command::Attributes,
296
+ command: temporalio_common::protos::temporal::api::command::v1::command::Attributes,
292
297
  machine: Machines,
293
298
  }
294
299
 
@@ -1,10 +1,11 @@
1
- use super::{NewMachineWithCommand, workflow_machines::MachineResponse};
1
+ use super::{
2
+ NewMachineWithCommand, StateMachine, TransitionResult, fsm, workflow_machines::MachineResponse,
3
+ };
2
4
  use crate::worker::workflow::{
3
5
  WFMachinesError,
4
6
  machines::{EventInfo, HistEventData, WFMachinesAdapter},
5
7
  };
6
- use rustfsm::{StateMachine, TransitionResult, fsm};
7
- use temporal_sdk_core_protos::{
8
+ use temporalio_common::protos::{
8
9
  coresdk::workflow_commands::ModifyWorkflowProperties,
9
10
  temporal::api::enums::v1::{CommandType, EventType},
10
11
  };