@temporalio/core-bridge 1.13.1 → 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.
- package/Cargo.lock +350 -436
- package/Cargo.toml +14 -13
- package/{sdk-core/fsm/rustfsm_procmacro/LICENSE.txt → LICENSE} +5 -5
- package/README.md +0 -1
- package/bridge-macros/Cargo.toml +16 -0
- package/bridge-macros/src/derive_js_function.rs +126 -0
- package/bridge-macros/src/derive_tryfromjs.rs +138 -0
- package/bridge-macros/src/derive_tryintojs.rs +151 -0
- package/bridge-macros/src/lib.rs +42 -0
- package/lib/native.d.ts +23 -9
- package/package.json +6 -5
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/sdk-core/.cargo/config.toml +78 -12
- package/sdk-core/.clippy.toml +1 -0
- package/sdk-core/.github/workflows/heavy.yml +2 -0
- package/sdk-core/.github/workflows/per-pr.yml +90 -21
- package/sdk-core/AGENTS.md +17 -19
- package/sdk-core/ARCHITECTURE.md +44 -48
- package/sdk-core/Cargo.toml +25 -7
- package/sdk-core/README.md +16 -15
- package/sdk-core/arch_docs/diagrams/TimerMachine_Coverage.puml +14 -0
- package/sdk-core/arch_docs/diagrams/deps.svg +102 -0
- package/sdk-core/arch_docs/diagrams/initial_event_history.png +0 -0
- package/sdk-core/arch_docs/sdks_intro.md +299 -0
- package/sdk-core/{client → crates/client}/Cargo.toml +15 -16
- package/sdk-core/{client → crates/client}/src/callback_based.rs +1 -2
- package/sdk-core/{client → crates/client}/src/lib.rs +594 -457
- package/sdk-core/{client → crates/client}/src/metrics.rs +32 -8
- package/sdk-core/crates/client/src/proxy.rs +209 -0
- package/sdk-core/{client → crates/client}/src/raw.rs +648 -328
- package/sdk-core/crates/client/src/replaceable.rs +253 -0
- package/sdk-core/crates/client/src/request_extensions.rs +40 -0
- package/sdk-core/{client → crates/client}/src/retry.rs +32 -22
- package/sdk-core/crates/client/src/worker/mod.rs +1468 -0
- package/sdk-core/{client → crates/client}/src/workflow_handle/mod.rs +24 -21
- package/sdk-core/{core-api → crates/common}/Cargo.toml +21 -12
- package/sdk-core/{sdk-core-protos → crates/common}/build.rs +10 -23
- package/sdk-core/crates/common/protos/api_cloud_upstream/VERSION +1 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/account/v1/message.proto +18 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/request_response.proto +38 -11
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto +21 -4
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/operation/v1/message.proto +6 -6
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/sink/v1/message.proto +22 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/create-release.yml +13 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv2.json +254 -5
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv3.yaml +234 -5
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/common/v1/message.proto +1 -1
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/deployment/v1/message.proto +6 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -2
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +60 -2
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +30 -6
- package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +2 -0
- package/sdk-core/{core-api → crates/common}/src/envconfig.rs +155 -56
- package/sdk-core/{core-api → crates/common}/src/errors.rs +8 -1
- package/sdk-core/{fsm/rustfsm_trait/src/lib.rs → crates/common/src/fsm_trait.rs} +1 -27
- package/sdk-core/{core-api → crates/common}/src/lib.rs +92 -9
- package/sdk-core/{test-utils/src → crates/common/src/protos}/canned_histories.rs +5 -5
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_builder.rs +3 -3
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_info.rs +2 -2
- package/sdk-core/{sdk-core-protos/src/lib.rs → crates/common/src/protos/mod.rs} +43 -26
- package/sdk-core/crates/common/src/protos/test_utils.rs +89 -0
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/utilities.rs +14 -5
- package/sdk-core/{core-api → crates/common}/src/telemetry/metrics.rs +449 -51
- package/sdk-core/{core-api → crates/common}/src/telemetry.rs +16 -1
- package/sdk-core/{core-api → crates/common}/src/worker.rs +112 -18
- package/sdk-core/crates/common/tests/worker_task_types_test.rs +129 -0
- package/sdk-core/crates/macros/Cargo.toml +23 -0
- package/sdk-core/{fsm/rustfsm_procmacro → crates/macros}/src/lib.rs +12 -12
- package/sdk-core/{sdk → crates/sdk}/Cargo.toml +18 -12
- package/sdk-core/{sdk → crates/sdk}/src/activity_context.rs +9 -7
- package/sdk-core/{sdk → crates/sdk}/src/app_data.rs +1 -1
- package/sdk-core/{sdk → crates/sdk}/src/interceptors.rs +2 -5
- package/sdk-core/{sdk → crates/sdk}/src/lib.rs +43 -42
- package/sdk-core/{sdk → crates/sdk}/src/workflow_context/options.rs +12 -3
- package/sdk-core/{sdk → crates/sdk}/src/workflow_context.rs +21 -19
- package/sdk-core/{sdk → crates/sdk}/src/workflow_future.rs +2 -2
- package/sdk-core/crates/sdk-core/Cargo.toml +222 -0
- package/sdk-core/{core/benches/workflow_replay.rs → crates/sdk-core/benches/workflow_replay_bench.rs} +15 -10
- package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +32 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CancelExternalMachine_Coverage.puml +9 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CancelWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ChildWorkflowMachine_Coverage.puml +27 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CompleteWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ContinueAsNewWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/FailWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/LocalActivityMachine_Coverage.puml +23 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ModifyWorkflowPropertiesMachine_Coverage.puml +5 -0
- package/sdk-core/crates/sdk-core/machine_coverage/PatchMachine_Coverage.puml +8 -0
- package/sdk-core/crates/sdk-core/machine_coverage/SignalExternalMachine_Coverage.puml +12 -0
- package/sdk-core/crates/sdk-core/machine_coverage/TimerMachine_Coverage.puml +13 -0
- package/sdk-core/crates/sdk-core/machine_coverage/UpdateMachine_Coverage.puml +19 -0
- package/sdk-core/crates/sdk-core/machine_coverage/UpsertSearchAttributesMachine_Coverage.puml +5 -0
- package/sdk-core/crates/sdk-core/machine_coverage/WorkflowTaskMachine_Coverage.puml +11 -0
- package/sdk-core/{core → crates/sdk-core}/src/abstractions.rs +62 -6
- package/sdk-core/crates/sdk-core/src/antithesis.rs +60 -0
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/activity_tasks.rs +85 -250
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/mod.rs +13 -16
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/queries.rs +25 -24
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/replay_flag.rs +11 -68
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/updates.rs +21 -20
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workers.rs +242 -16
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_cancels.rs +10 -7
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_tasks.rs +150 -326
- package/sdk-core/{core → crates/sdk-core}/src/debug_client.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/ephemeral_server/mod.rs +18 -6
- package/sdk-core/{test-utils → crates/sdk-core}/src/histfetch.rs +9 -4
- package/sdk-core/{core → crates/sdk-core}/src/internal_flags.rs +15 -4
- package/sdk-core/{core → crates/sdk-core}/src/lib.rs +128 -72
- package/sdk-core/{core → crates/sdk-core}/src/pollers/mod.rs +13 -11
- package/sdk-core/{core → crates/sdk-core}/src/pollers/poll_buffer.rs +53 -18
- package/sdk-core/{core → crates/sdk-core}/src/protosext/mod.rs +14 -6
- package/sdk-core/{core → crates/sdk-core}/src/protosext/protocol_messages.rs +5 -12
- package/sdk-core/{core → crates/sdk-core}/src/replay/mod.rs +14 -11
- package/sdk-core/crates/sdk-core/src/retry_logic.rs +390 -0
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/log_export.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/metrics.rs +80 -33
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/mod.rs +12 -6
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/otel.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_meter.rs +14 -14
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_server.rs +2 -2
- package/sdk-core/{core/src/test_help/mod.rs → crates/sdk-core/src/test_help/integ_helpers.rs} +284 -329
- package/sdk-core/crates/sdk-core/src/test_help/mod.rs +13 -0
- package/sdk-core/crates/sdk-core/src/test_help/unit_helpers.rs +220 -0
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities/activity_heartbeat_manager.rs +44 -8
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities/local_activities.rs +33 -31
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities.rs +31 -15
- package/sdk-core/{core → crates/sdk-core}/src/worker/client/mocks.rs +28 -15
- package/sdk-core/{core → crates/sdk-core}/src/worker/client.rs +275 -145
- package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +246 -0
- package/sdk-core/crates/sdk-core/src/worker/mod.rs +1462 -0
- package/sdk-core/{core → crates/sdk-core}/src/worker/nexus.rs +24 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/slot_provider.rs +18 -10
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/fixed_size.rs +5 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/resource_based.rs +453 -57
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner.rs +179 -3
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/driven_workflow.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/history_update.rs +5 -267
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/activity_state_machine.rs +147 -90
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_external_state_machine.rs +8 -91
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_nexus_op_state_machine.rs +14 -12
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +97 -0
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/child_workflow_state_machine.rs +32 -229
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/complete_workflow_state_machine.rs +13 -8
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +6 -50
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/fail_workflow_state_machine.rs +6 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/local_activity_state_machine.rs +39 -584
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/mod.rs +22 -17
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +4 -74
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/nexus_operation_state_machine.rs +118 -21
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/patch_state_machine.rs +273 -0
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/signal_external_state_machine.rs +9 -151
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/timer_state_machine.rs +27 -132
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/transition_coverage.rs +1 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/update_state_machine.rs +19 -13
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +25 -80
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines/local_acts.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines.rs +68 -72
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_task_state_machine.rs +13 -15
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/managed_run.rs +55 -37
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/mod.rs +171 -61
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/run_cache.rs +10 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_extraction.rs +4 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_poller.rs +15 -4
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/workflow_stream.rs +38 -19
- package/sdk-core/crates/sdk-core/tests/c_bridge_smoke_test.c +10 -0
- package/sdk-core/crates/sdk-core/tests/cloud_tests.rs +25 -0
- package/sdk-core/crates/sdk-core/tests/common/fake_grpc_server.rs +106 -0
- package/sdk-core/crates/sdk-core/tests/common/http_proxy.rs +134 -0
- package/sdk-core/{test-utils/src/lib.rs → crates/sdk-core/tests/common/mod.rs} +286 -334
- package/sdk-core/{test-utils/src → crates/sdk-core/tests/common}/workflows.rs +6 -4
- package/sdk-core/crates/sdk-core/tests/fsm_procmacro.rs +6 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dupe_transitions_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/dupe_transitions_fail.stderr +12 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dynamic_dest_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.rs +1 -3
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.stderr +4 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_arg_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/medium_complex_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/no_handle_conversions_require_into_fail.rs +2 -4
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/no_handle_conversions_require_into_fail.stderr +15 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/simple_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/struct_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/struct_event_variant_fail.stderr +5 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_more_item_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_more_item_event_variant_fail.stderr +5 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_zero_item_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_zero_item_event_variant_fail.stderr +5 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/global_metric_tests.rs +22 -22
- package/sdk-core/{tests → crates/sdk-core/tests/heavy_tests}/fuzzy_workflow.rs +4 -4
- package/sdk-core/{tests → crates/sdk-core/tests}/heavy_tests.rs +25 -14
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/activity_functions.rs +1 -1
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/client_tests.rs +115 -123
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/ephemeral_server_tests.rs +19 -15
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/heartbeat_tests.rs +24 -20
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/metrics_tests.rs +241 -67
- package/sdk-core/crates/sdk-core/tests/integ_tests/pagination_tests.rs +273 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/polling_tests.rs +513 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/queries_tests.rs +13 -11
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/update_tests.rs +47 -29
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/visibility_tests.rs +49 -27
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +1061 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_tests.rs +920 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_versioning_tests.rs +58 -40
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/activities.rs +268 -30
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/appdata_propagation.rs +4 -4
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +155 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +121 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +717 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +109 -0
- package/sdk-core/{core/src/core_tests → crates/sdk-core/tests/integ_tests/workflow_tests}/determinism.rs +108 -20
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/eager.rs +10 -5
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +2884 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +119 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/nexus.rs +174 -46
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/patches.rs +740 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/replay.rs +78 -27
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/resets.rs +46 -28
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/signals.rs +294 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/stickyness.rs +9 -8
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/timers.rs +249 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/upsert_search_attrs.rs +72 -7
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests.rs +97 -33
- package/sdk-core/{tests → crates/sdk-core/tests}/main.rs +40 -25
- package/sdk-core/{tests → crates/sdk-core/tests}/manual_tests.rs +25 -15
- package/sdk-core/{tests → crates/sdk-core/tests}/runner.rs +23 -41
- package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/mod.rs +11 -6
- package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/priority.rs +6 -6
- package/sdk-core/crates/sdk-core-c-bridge/Cargo.toml +59 -0
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/include/temporal-sdk-core-c-bridge.h +215 -44
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/client.rs +515 -214
- package/sdk-core/crates/sdk-core-c-bridge/src/envconfig.rs +314 -0
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/lib.rs +2 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/metric.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/random.rs +4 -4
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/runtime.rs +42 -28
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/testing.rs +2 -5
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/context.rs +42 -41
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/mod.rs +38 -34
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/utils.rs +10 -11
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/worker.rs +427 -121
- package/sdk-core/docker-cgroup-tests.sh +24 -0
- package/sdk-core/{docker → etc/docker}/docker-compose-ci.yaml +9 -9
- package/sdk-core/{docker → etc/docker}/docker-compose-telem.yaml +11 -11
- package/sdk-core/{docker → etc/docker}/docker-compose.yaml +8 -8
- package/sdk-core/{integ-with-otel.sh → etc/integ-with-otel.sh} +1 -1
- package/sdk-core/etc/regen-depgraph.sh +2 -2
- package/src/client.rs +117 -49
- package/src/helpers/callbacks.rs +4 -4
- package/src/helpers/errors.rs +7 -1
- package/src/helpers/handles.rs +1 -0
- package/src/helpers/try_from_js.rs +5 -4
- package/src/lib.rs +3 -2
- package/src/logs.rs +1 -1
- package/src/metrics.rs +6 -3
- package/src/runtime.rs +41 -24
- package/src/testing.rs +3 -3
- package/src/worker.rs +77 -44
- package/ts/native.ts +26 -9
- package/LICENSE.md +0 -23
- package/sdk-core/arch_docs/diagrams/workflow_internals.svg +0 -1
- package/sdk-core/client/src/proxy.rs +0 -90
- package/sdk-core/client/src/worker_registry/mod.rs +0 -266
- package/sdk-core/core/Cargo.toml +0 -146
- package/sdk-core/core/src/core_tests/child_workflows.rs +0 -281
- package/sdk-core/core/src/core_tests/local_activities.rs +0 -1442
- package/sdk-core/core/src/retry_logic.rs +0 -224
- package/sdk-core/core/src/worker/heartbeat.rs +0 -231
- package/sdk-core/core/src/worker/mod.rs +0 -980
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +0 -165
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +0 -801
- package/sdk-core/core-c-bridge/Cargo.toml +0 -51
- package/sdk-core/etc/deps.svg +0 -162
- package/sdk-core/fsm/Cargo.toml +0 -21
- package/sdk-core/fsm/README.md +0 -3
- package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +0 -27
- package/sdk-core/fsm/rustfsm_procmacro/tests/progress.rs +0 -8
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +0 -12
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +0 -15
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_trait/Cargo.toml +0 -14
- package/sdk-core/fsm/rustfsm_trait/LICENSE.txt +0 -21
- package/sdk-core/fsm/src/lib.rs +0 -2
- package/sdk-core/sdk-core-protos/Cargo.toml +0 -37
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/VERSION +0 -1
- package/sdk-core/test-utils/Cargo.toml +0 -38
- package/sdk-core/test-utils/src/interceptors.rs +0 -46
- package/sdk-core/tests/cloud_tests.rs +0 -23
- package/sdk-core/tests/integ_tests/polling_tests.rs +0 -294
- package/sdk-core/tests/integ_tests/worker_tests.rs +0 -203
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +0 -74
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +0 -57
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +0 -246
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +0 -65
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +0 -85
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +0 -908
- package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +0 -51
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +0 -206
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +0 -164
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +0 -123
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/build.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/push-to-buf.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/CODEOWNERS +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/LICENSE +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/README.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.gen.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.lock +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/connectivityrule/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/identity/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/namespace/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/nexus/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/region/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/resource/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/usage/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/CODEOWNERS +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/ci.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/publish-docs.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/push-to-buf.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-delete-release.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-publish-release.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-update.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/LICENSE +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/README.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/api-linter.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.gen.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.lock +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/annotations.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/http.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/any.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/descriptor.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/duration.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/empty.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/struct.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/timestamp.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/wrappers.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/payload_description.txt +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/activity/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/batch/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/command/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/command_type.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/common.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/deployment.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/event_type.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/namespace.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/nexus.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/query.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/reset.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/schedule.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/update.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/workflow.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/errordetails/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/export/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/failure/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/filter/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/history/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/nexus/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/protocol/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/query/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/replication/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/rules/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/schedule/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/enhanced_stack_trace.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/user_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/worker_config.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/update/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/version/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/worker/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflow/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/google/rpc/status.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/grpc/health/v1/health.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_result/activity_result.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_task/activity_task.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/common/common.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/core_interface.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/external_data/external_data.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/nexus/nexus.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/api-linter.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -0
- /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/constants.rs +0 -0
- /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/task_token.rs +0 -0
- /package/sdk-core/{fsm → crates/macros}/LICENSE.txt +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/abstractions/take_cell.rs +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/worker/slot_supplier.rs +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/ends_empty_wft_complete.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-16_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-23_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-85_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/fail_wf_task.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-0_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-1_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-2_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-3_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/old_change_marker_format.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/timer_workflow_history.bin +0 -0
- /package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/priority.rs +0 -0
- /package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/build.rs +0 -0
- /package/sdk-core/{cargo-tokio-console.sh → etc/cargo-tokio-console.sh} +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
use crate::common::{CoreWfStarter, build_fake_sdk};
|
|
2
|
+
use temporalio_client::WorkflowClientTrait;
|
|
3
|
+
use temporalio_common::{
|
|
4
|
+
protos::{
|
|
5
|
+
DEFAULT_WORKFLOW_TYPE, TestHistoryBuilder,
|
|
6
|
+
coresdk::{AsJsonPayloadExt, FromJsonPayloadExt},
|
|
7
|
+
temporal::api::{
|
|
8
|
+
command::v1::{Command, command},
|
|
9
|
+
common::v1::Payload,
|
|
10
|
+
enums::v1::EventType,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
worker::WorkerTaskTypes,
|
|
14
|
+
};
|
|
15
|
+
use temporalio_sdk::{WfContext, WorkflowResult};
|
|
16
|
+
use temporalio_sdk_core::test_help::MockPollCfg;
|
|
17
|
+
use uuid::Uuid;
|
|
18
|
+
|
|
19
|
+
static FIELD_A: &str = "cat_name";
|
|
20
|
+
static FIELD_B: &str = "cute_level";
|
|
21
|
+
|
|
22
|
+
async fn memo_upserter(ctx: WfContext) -> WorkflowResult<()> {
|
|
23
|
+
ctx.upsert_memo([
|
|
24
|
+
(FIELD_A.to_string(), "enchi".as_json_payload().unwrap()),
|
|
25
|
+
(FIELD_B.to_string(), 9001.as_json_payload().unwrap()),
|
|
26
|
+
]);
|
|
27
|
+
Ok(().into())
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#[tokio::test]
|
|
31
|
+
async fn sends_modify_wf_props() {
|
|
32
|
+
let wf_name = "can_upsert_memo";
|
|
33
|
+
let wf_id = Uuid::new_v4();
|
|
34
|
+
let mut starter = CoreWfStarter::new(wf_name);
|
|
35
|
+
starter
|
|
36
|
+
.worker_config
|
|
37
|
+
.task_types(WorkerTaskTypes::workflow_only());
|
|
38
|
+
let mut worker = starter.worker().await;
|
|
39
|
+
|
|
40
|
+
worker.register_wf(wf_name, memo_upserter);
|
|
41
|
+
let run_id = worker
|
|
42
|
+
.submit_wf(wf_id.to_string(), wf_name, vec![], Default::default())
|
|
43
|
+
.await
|
|
44
|
+
.unwrap();
|
|
45
|
+
worker.run_until_done().await.unwrap();
|
|
46
|
+
|
|
47
|
+
let memo = starter
|
|
48
|
+
.get_client()
|
|
49
|
+
.await
|
|
50
|
+
.describe_workflow_execution(wf_id.to_string(), Some(run_id))
|
|
51
|
+
.await
|
|
52
|
+
.unwrap()
|
|
53
|
+
.workflow_execution_info
|
|
54
|
+
.unwrap()
|
|
55
|
+
.memo
|
|
56
|
+
.unwrap()
|
|
57
|
+
.fields;
|
|
58
|
+
let catname = memo.get(FIELD_A).unwrap();
|
|
59
|
+
let cuteness = memo.get(FIELD_B).unwrap();
|
|
60
|
+
for payload in [catname, cuteness] {
|
|
61
|
+
assert!(payload.is_json_payload());
|
|
62
|
+
}
|
|
63
|
+
assert_eq!("enchi", String::from_json_payload(catname).unwrap());
|
|
64
|
+
assert_eq!(9001, usize::from_json_payload(cuteness).unwrap());
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
#[tokio::test]
|
|
68
|
+
async fn workflow_modify_props() {
|
|
69
|
+
let mut t = TestHistoryBuilder::default();
|
|
70
|
+
t.add_by_type(EventType::WorkflowExecutionStarted);
|
|
71
|
+
t.add_full_wf_task();
|
|
72
|
+
t.add_workflow_execution_completed();
|
|
73
|
+
|
|
74
|
+
let (k1, k2) = ("foo", "bar");
|
|
75
|
+
|
|
76
|
+
let mut mock_cfg = MockPollCfg::from_hist_builder(t);
|
|
77
|
+
mock_cfg.completion_asserts_from_expectations(|mut asserts| {
|
|
78
|
+
asserts.then(|wft| {
|
|
79
|
+
assert_matches!(
|
|
80
|
+
wft.commands.as_slice(),
|
|
81
|
+
[Command {
|
|
82
|
+
attributes: Some(
|
|
83
|
+
command::Attributes::ModifyWorkflowPropertiesCommandAttributes(msg)
|
|
84
|
+
),
|
|
85
|
+
..
|
|
86
|
+
}, ..] => {
|
|
87
|
+
let fields = &msg.upserted_memo.as_ref().unwrap().fields;
|
|
88
|
+
let payload1 = fields.get(k1).unwrap();
|
|
89
|
+
let payload2 = fields.get(k2).unwrap();
|
|
90
|
+
assert_eq!(payload1.data[0], 0x01);
|
|
91
|
+
assert_eq!(payload2.data[0], 0x02);
|
|
92
|
+
assert_eq!(fields.len(), 2);
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
let mut worker = build_fake_sdk(mock_cfg);
|
|
99
|
+
worker.register_wf(DEFAULT_WORKFLOW_TYPE, move |ctx: WfContext| async move {
|
|
100
|
+
ctx.upsert_memo([
|
|
101
|
+
(
|
|
102
|
+
String::from(k1),
|
|
103
|
+
Payload {
|
|
104
|
+
data: vec![0x01],
|
|
105
|
+
..Default::default()
|
|
106
|
+
},
|
|
107
|
+
),
|
|
108
|
+
(
|
|
109
|
+
String::from(k2),
|
|
110
|
+
Payload {
|
|
111
|
+
data: vec![0x02],
|
|
112
|
+
..Default::default()
|
|
113
|
+
},
|
|
114
|
+
),
|
|
115
|
+
]);
|
|
116
|
+
Ok(().into())
|
|
117
|
+
});
|
|
118
|
+
worker.run().await.unwrap();
|
|
119
|
+
}
|
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
use crate::
|
|
1
|
+
use crate::{
|
|
2
|
+
common::{CoreWfStarter, WorkflowHandleExt, rand_6_chars},
|
|
3
|
+
integ_tests::mk_nexus_endpoint,
|
|
4
|
+
};
|
|
2
5
|
use anyhow::bail;
|
|
3
6
|
use assert_matches::assert_matches;
|
|
4
|
-
use std::
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
use temporal_sdk_core_protos::{
|
|
9
|
-
coresdk::{
|
|
10
|
-
FromJsonPayloadExt,
|
|
11
|
-
nexus::{
|
|
12
|
-
NexusOperationCancellationType, NexusOperationResult, NexusTaskCancelReason,
|
|
13
|
-
NexusTaskCompletion, nexus_operation_result, nexus_task, nexus_task_completion,
|
|
14
|
-
},
|
|
7
|
+
use std::{
|
|
8
|
+
sync::{
|
|
9
|
+
Arc,
|
|
10
|
+
atomic::{AtomicBool, Ordering},
|
|
15
11
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
time::Duration,
|
|
13
|
+
};
|
|
14
|
+
use temporalio_client::{WfClientExt, WorkflowClientTrait, WorkflowOptions};
|
|
15
|
+
use temporalio_common::{
|
|
16
|
+
errors::PollError,
|
|
17
|
+
protos::{
|
|
18
|
+
coresdk::{
|
|
19
|
+
FromJsonPayloadExt,
|
|
20
|
+
nexus::{
|
|
21
|
+
NexusOperationCancellationType, NexusOperationResult, NexusTaskCancelReason,
|
|
22
|
+
NexusTaskCompletion, nexus_operation_result, nexus_task, nexus_task_completion,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
temporal::api::{
|
|
26
|
+
common::v1::{Callback, callback},
|
|
27
|
+
enums::v1::NexusHandlerErrorRetryBehavior,
|
|
28
|
+
failure::v1::{Failure, failure::FailureInfo},
|
|
29
|
+
nexus,
|
|
30
|
+
nexus::v1::{
|
|
31
|
+
CancelOperationResponse, HandlerError, StartOperationResponse, request,
|
|
32
|
+
start_operation_response, workflow_event_link_from_nexus,
|
|
33
|
+
},
|
|
24
34
|
},
|
|
25
35
|
},
|
|
36
|
+
worker::WorkerTaskTypes,
|
|
26
37
|
};
|
|
27
|
-
use
|
|
38
|
+
use temporalio_sdk::{CancellableFuture, NexusOperationOptions, WfContext, WfExitValue};
|
|
28
39
|
use tokio::{
|
|
29
40
|
join,
|
|
30
41
|
sync::{mpsc, watch},
|
|
31
42
|
};
|
|
43
|
+
use tokio_stream::StreamExt;
|
|
32
44
|
|
|
33
45
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
|
34
46
|
enum Outcome {
|
|
@@ -46,7 +58,12 @@ async fn nexus_basic(
|
|
|
46
58
|
) {
|
|
47
59
|
let wf_name = "nexus_basic";
|
|
48
60
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
49
|
-
starter.worker_config.
|
|
61
|
+
starter.worker_config.task_types(WorkerTaskTypes {
|
|
62
|
+
enable_workflows: true,
|
|
63
|
+
enable_local_activities: false,
|
|
64
|
+
enable_remote_activities: false,
|
|
65
|
+
enable_nexus: true,
|
|
66
|
+
});
|
|
50
67
|
let mut worker = starter.worker().await;
|
|
51
68
|
let core_worker = starter.get_worker().await;
|
|
52
69
|
|
|
@@ -191,7 +208,12 @@ async fn nexus_async(
|
|
|
191
208
|
) {
|
|
192
209
|
let wf_name = "nexus_async";
|
|
193
210
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
194
|
-
starter.worker_config.
|
|
211
|
+
starter.worker_config.task_types(WorkerTaskTypes {
|
|
212
|
+
enable_workflows: true,
|
|
213
|
+
enable_local_activities: false,
|
|
214
|
+
enable_remote_activities: false,
|
|
215
|
+
enable_nexus: true,
|
|
216
|
+
});
|
|
195
217
|
let mut worker = starter.worker().await;
|
|
196
218
|
let core_worker = starter.get_worker().await;
|
|
197
219
|
|
|
@@ -249,6 +271,16 @@ async fn nexus_async(
|
|
|
249
271
|
let client = starter.get_client().await.get_client().clone();
|
|
250
272
|
let nexus_task_handle = async {
|
|
251
273
|
let mut nt = core_worker.poll_nexus_task().await.unwrap().unwrap_task();
|
|
274
|
+
// Verify request header key for timeout exists and is lowercase
|
|
275
|
+
if outcome == Outcome::Timeout {
|
|
276
|
+
assert!(
|
|
277
|
+
nt.request
|
|
278
|
+
.as_ref()
|
|
279
|
+
.unwrap()
|
|
280
|
+
.header
|
|
281
|
+
.contains_key("request-timeout")
|
|
282
|
+
);
|
|
283
|
+
}
|
|
252
284
|
let start_req = assert_matches!(
|
|
253
285
|
nt.request.unwrap().variant.unwrap(),
|
|
254
286
|
request::Variant::StartOperation(sr) => sr
|
|
@@ -408,7 +440,12 @@ async fn nexus_async(
|
|
|
408
440
|
async fn nexus_cancel_before_start() {
|
|
409
441
|
let wf_name = "nexus_cancel_before_start";
|
|
410
442
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
411
|
-
starter.worker_config.
|
|
443
|
+
starter.worker_config.task_types(WorkerTaskTypes {
|
|
444
|
+
enable_workflows: true,
|
|
445
|
+
enable_local_activities: false,
|
|
446
|
+
enable_remote_activities: false,
|
|
447
|
+
enable_nexus: true,
|
|
448
|
+
});
|
|
412
449
|
let mut worker = starter.worker().await;
|
|
413
450
|
|
|
414
451
|
let endpoint = mk_nexus_endpoint(&mut starter).await;
|
|
@@ -450,7 +487,12 @@ async fn nexus_cancel_before_start() {
|
|
|
450
487
|
async fn nexus_must_complete_task_to_shutdown(#[values(true, false)] use_grace_period: bool) {
|
|
451
488
|
let wf_name = "nexus_must_complete_task_to_shutdown";
|
|
452
489
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
453
|
-
starter.worker_config.
|
|
490
|
+
starter.worker_config.task_types(WorkerTaskTypes {
|
|
491
|
+
enable_workflows: true,
|
|
492
|
+
enable_local_activities: false,
|
|
493
|
+
enable_remote_activities: false,
|
|
494
|
+
enable_nexus: true,
|
|
495
|
+
});
|
|
454
496
|
if use_grace_period {
|
|
455
497
|
starter
|
|
456
498
|
.worker_config
|
|
@@ -550,17 +592,22 @@ async fn nexus_cancellation_types(
|
|
|
550
592
|
) {
|
|
551
593
|
let wf_name = "nexus_cancellation_types";
|
|
552
594
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
553
|
-
starter.worker_config.
|
|
595
|
+
starter.worker_config.task_types(WorkerTaskTypes {
|
|
596
|
+
enable_workflows: true,
|
|
597
|
+
enable_local_activities: false,
|
|
598
|
+
enable_remote_activities: false,
|
|
599
|
+
enable_nexus: true,
|
|
600
|
+
});
|
|
554
601
|
let mut worker = starter.worker().await;
|
|
555
602
|
let core_worker = starter.get_worker().await;
|
|
556
603
|
|
|
557
604
|
let endpoint = mk_nexus_endpoint(&mut starter).await;
|
|
558
605
|
let schedule_to_close_timeout = Some(Duration::from_secs(5));
|
|
559
606
|
|
|
560
|
-
let (
|
|
607
|
+
let (caller_op_future_tx, caller_op_future_rx) = watch::channel(false);
|
|
561
608
|
worker.register_wf(wf_name.to_owned(), move |ctx: WfContext| {
|
|
562
609
|
let endpoint = endpoint.clone();
|
|
563
|
-
let
|
|
610
|
+
let caller_op_future_tx = caller_op_future_tx.clone();
|
|
564
611
|
async move {
|
|
565
612
|
let options = NexusOperationOptions {
|
|
566
613
|
endpoint,
|
|
@@ -577,42 +624,62 @@ async fn nexus_cancellation_types(
|
|
|
577
624
|
started.cancel(&ctx);
|
|
578
625
|
|
|
579
626
|
let res = result.await;
|
|
580
|
-
|
|
627
|
+
caller_op_future_tx.send(true).unwrap();
|
|
581
628
|
|
|
582
|
-
// Make sure cancel after completion doesn't cause problems
|
|
629
|
+
// Make sure cancel after op completion doesn't cause problems
|
|
583
630
|
started.cancel(&ctx);
|
|
584
631
|
|
|
585
632
|
// We need to wait slightly so that the workflow is not complete at the same time
|
|
586
|
-
// cancellation is invoked. If it does, the caller workflow will close and the server
|
|
633
|
+
// cancellation is invoked. If it does, the caller workflow will close and the server
|
|
634
|
+
// won't attempt to send the cancellation to the handler
|
|
587
635
|
ctx.timer(Duration::from_millis(1)).await;
|
|
588
636
|
Ok(res.into())
|
|
589
637
|
}
|
|
590
638
|
});
|
|
591
639
|
|
|
592
|
-
let
|
|
640
|
+
let cancellation_wait_happened = Arc::new(AtomicBool::new(false));
|
|
641
|
+
let cancellation_wait_happened_clone = cancellation_wait_happened.clone();
|
|
593
642
|
let (cancellation_tx, mut cancellation_rx) = watch::channel(false);
|
|
643
|
+
let (handler_exited_tx, mut handler_exited_rx) = watch::channel(false);
|
|
594
644
|
worker.register_wf("async_completer".to_owned(), move |ctx: WfContext| {
|
|
595
645
|
let cancellation_tx = cancellation_tx.clone();
|
|
596
|
-
let
|
|
646
|
+
let cancellation_wait_happened = cancellation_wait_happened_clone.clone();
|
|
647
|
+
let handler_exited_tx = handler_exited_tx.clone();
|
|
597
648
|
async move {
|
|
649
|
+
// Wait for cancellation
|
|
598
650
|
ctx.cancelled().await;
|
|
599
651
|
cancellation_tx.send(true).unwrap();
|
|
652
|
+
|
|
600
653
|
if cancellation_type == NexusOperationCancellationType::WaitCancellationCompleted {
|
|
601
|
-
|
|
654
|
+
ctx.wait_condition(|| cancellation_wait_happened.load(Ordering::Relaxed))
|
|
655
|
+
.await;
|
|
656
|
+
} else if cancellation_type == NexusOperationCancellationType::WaitCancellationRequested
|
|
657
|
+
{
|
|
658
|
+
// For WAIT_REQUESTED, wait until the caller nexus op future has been resolved. This
|
|
659
|
+
// allows the test to verify that it resolved due to
|
|
660
|
+
// NexusOperationCancelRequestCompleted (written after cancel handler responds)
|
|
661
|
+
// rather than NexusOperationCanceled (written after handler workflow completes as
|
|
662
|
+
// cancelled).
|
|
663
|
+
let mut signal_chan = ctx.make_signal_channel("proceed-to-exit");
|
|
664
|
+
signal_chan.next().await;
|
|
602
665
|
}
|
|
666
|
+
|
|
667
|
+
handler_exited_tx.send(true).unwrap();
|
|
603
668
|
Ok(WfExitValue::<()>::Cancelled)
|
|
604
669
|
}
|
|
605
670
|
});
|
|
606
671
|
let submitter = worker.get_submitter_handle();
|
|
607
672
|
let wf_handle = starter.start_with_worker(wf_name, &mut worker).await;
|
|
608
673
|
let client = starter.get_client().await.get_client().clone();
|
|
674
|
+
let (handler_wf_id_tx, mut handler_wf_id_rx) = tokio::sync::oneshot::channel();
|
|
675
|
+
let completer_id = &format!("completer-{}", rand_6_chars());
|
|
609
676
|
let nexus_task_handle = async {
|
|
610
677
|
let nt = core_worker.poll_nexus_task().await.unwrap().unwrap_task();
|
|
611
678
|
let start_req = assert_matches!(
|
|
612
679
|
nt.request.unwrap().variant.unwrap(),
|
|
613
680
|
request::Variant::StartOperation(sr) => sr
|
|
614
681
|
);
|
|
615
|
-
let
|
|
682
|
+
let _ = handler_wf_id_tx.send(completer_id.clone());
|
|
616
683
|
let links = start_req
|
|
617
684
|
.links
|
|
618
685
|
.iter()
|
|
@@ -668,16 +735,19 @@ async fn nexus_cancellation_types(
|
|
|
668
735
|
match cancellation_type {
|
|
669
736
|
NexusOperationCancellationType::WaitCancellationCompleted
|
|
670
737
|
| NexusOperationCancellationType::WaitCancellationRequested => {
|
|
671
|
-
|
|
738
|
+
// The nexus op future should not have been resolved
|
|
739
|
+
assert!(!*caller_op_future_rx.borrow());
|
|
672
740
|
}
|
|
673
741
|
NexusOperationCancellationType::Abandon | NexusOperationCancellationType::TryCancel => {
|
|
674
742
|
wf_handle
|
|
675
743
|
.get_workflow_result(Default::default())
|
|
676
744
|
.await
|
|
677
745
|
.unwrap();
|
|
678
|
-
|
|
746
|
+
// The nexus op future should have been resolved
|
|
747
|
+
assert!(*caller_op_future_rx.borrow())
|
|
679
748
|
}
|
|
680
749
|
}
|
|
750
|
+
let (cancel_handler_responded_tx, _cancel_handler_responded_rx) = watch::channel(false);
|
|
681
751
|
if cancellation_type != NexusOperationCancellationType::Abandon {
|
|
682
752
|
let nt = core_worker.poll_nexus_task().await.unwrap();
|
|
683
753
|
let nt = nt.unwrap_task();
|
|
@@ -686,7 +756,12 @@ async fn nexus_cancellation_types(
|
|
|
686
756
|
request::Variant::CancelOperation(_)
|
|
687
757
|
);
|
|
688
758
|
client
|
|
689
|
-
.cancel_workflow_execution(
|
|
759
|
+
.cancel_workflow_execution(
|
|
760
|
+
completer_id.to_string(),
|
|
761
|
+
None,
|
|
762
|
+
"nexus cancel".to_string(),
|
|
763
|
+
None,
|
|
764
|
+
)
|
|
690
765
|
.await
|
|
691
766
|
.unwrap();
|
|
692
767
|
core_worker
|
|
@@ -702,19 +777,31 @@ async fn nexus_cancellation_types(
|
|
|
702
777
|
})
|
|
703
778
|
.await
|
|
704
779
|
.unwrap();
|
|
780
|
+
// Mark that the cancel handler has responded
|
|
781
|
+
cancel_handler_responded_tx.send(true).unwrap();
|
|
705
782
|
}
|
|
706
783
|
|
|
707
|
-
//
|
|
784
|
+
// Check that the nexus op future resolves only _after_ the handler WF completes
|
|
708
785
|
if cancellation_type == NexusOperationCancellationType::WaitCancellationCompleted {
|
|
709
|
-
assert!(!*
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
786
|
+
assert!(!*caller_op_future_rx.borrow());
|
|
787
|
+
|
|
788
|
+
cancellation_wait_happened.store(true, Ordering::Relaxed);
|
|
789
|
+
// Send a signal just to wake up the workflow so it'll check the condition
|
|
790
|
+
// (it may already have completed, so ignore the result)
|
|
791
|
+
let _ = client
|
|
792
|
+
.signal_workflow_execution(
|
|
793
|
+
completer_id.to_string(),
|
|
794
|
+
"".to_string(),
|
|
795
|
+
"wakeupdude".to_string(),
|
|
796
|
+
None,
|
|
797
|
+
None,
|
|
798
|
+
)
|
|
799
|
+
.await;
|
|
713
800
|
wf_handle
|
|
714
801
|
.get_workflow_result(Default::default())
|
|
715
802
|
.await
|
|
716
803
|
.unwrap();
|
|
717
|
-
assert!(*
|
|
804
|
+
assert!(*caller_op_future_rx.borrow());
|
|
718
805
|
}
|
|
719
806
|
|
|
720
807
|
assert_matches!(
|
|
@@ -724,6 +811,38 @@ async fn nexus_cancellation_types(
|
|
|
724
811
|
};
|
|
725
812
|
|
|
726
813
|
let shutdown_handle = worker.inner_mut().shutdown_handle();
|
|
814
|
+
|
|
815
|
+
let check_caller_op_future_resolved_then_allow_handler_to_complete = async {
|
|
816
|
+
// The caller nexus op future has been resolved
|
|
817
|
+
assert!(*caller_op_future_rx.borrow());
|
|
818
|
+
|
|
819
|
+
// Verify the handler workflow has not exited yet. This proves that the caller op future
|
|
820
|
+
// was resolved as a result of NexusOperationCancelRequestCompleted (written after cancel
|
|
821
|
+
// handler responds), as opposed to NexusOperationCanceled (written after handler workflow
|
|
822
|
+
// exits).
|
|
823
|
+
assert!(
|
|
824
|
+
!*handler_exited_rx.borrow(),
|
|
825
|
+
"Handler should not have exited yet"
|
|
826
|
+
);
|
|
827
|
+
|
|
828
|
+
let handler_wf_id = handler_wf_id_rx
|
|
829
|
+
.try_recv()
|
|
830
|
+
.expect("Should have received handler workflow ID");
|
|
831
|
+
client
|
|
832
|
+
.signal_workflow_execution(
|
|
833
|
+
handler_wf_id,
|
|
834
|
+
"".to_string(),
|
|
835
|
+
"proceed-to-exit".to_string(),
|
|
836
|
+
None,
|
|
837
|
+
None,
|
|
838
|
+
)
|
|
839
|
+
.await
|
|
840
|
+
.unwrap();
|
|
841
|
+
|
|
842
|
+
handler_exited_rx.changed().await.unwrap();
|
|
843
|
+
assert!(*handler_exited_rx.borrow());
|
|
844
|
+
};
|
|
845
|
+
|
|
727
846
|
join!(
|
|
728
847
|
nexus_task_handle,
|
|
729
848
|
async { worker.inner_mut().run().await.unwrap() },
|
|
@@ -735,6 +854,9 @@ async fn nexus_cancellation_types(
|
|
|
735
854
|
if cancellation_type == NexusOperationCancellationType::TryCancel {
|
|
736
855
|
cancellation_rx.changed().await.unwrap();
|
|
737
856
|
}
|
|
857
|
+
if cancellation_type == NexusOperationCancellationType::WaitCancellationRequested {
|
|
858
|
+
check_caller_op_future_resolved_then_allow_handler_to_complete.await;
|
|
859
|
+
}
|
|
738
860
|
shutdown_handle();
|
|
739
861
|
}
|
|
740
862
|
);
|
|
@@ -765,8 +887,14 @@ async fn nexus_cancellation_types(
|
|
|
765
887
|
);
|
|
766
888
|
assert_eq!(f.message, "Nexus operation cancelled after starting");
|
|
767
889
|
}
|
|
768
|
-
NexusOperationCancellationType::WaitCancellationRequested
|
|
769
|
-
|
|
890
|
+
NexusOperationCancellationType::WaitCancellationRequested => {
|
|
891
|
+
let f = assert_matches!(
|
|
892
|
+
res.status,
|
|
893
|
+
Some(nexus_operation_result::Status::Cancelled(f)) => f
|
|
894
|
+
);
|
|
895
|
+
assert_eq!(f.message, "Nexus operation cancellation request completed");
|
|
896
|
+
}
|
|
897
|
+
NexusOperationCancellationType::WaitCancellationCompleted => {
|
|
770
898
|
let f = assert_matches!(
|
|
771
899
|
res.status,
|
|
772
900
|
Some(nexus_operation_result::Status::Cancelled(f)) => f
|