@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,273 @@
|
|
|
1
|
+
use crate::common::*;
|
|
2
|
+
use futures_util::StreamExt;
|
|
3
|
+
use std::sync::{
|
|
4
|
+
Arc,
|
|
5
|
+
atomic::{AtomicUsize, Ordering},
|
|
6
|
+
};
|
|
7
|
+
use temporalio_client::WorkflowOptions;
|
|
8
|
+
use temporalio_common::protos::{
|
|
9
|
+
DEFAULT_WORKFLOW_TYPE, TestHistoryBuilder,
|
|
10
|
+
temporal::api::{
|
|
11
|
+
common::v1::WorkflowExecution,
|
|
12
|
+
enums::v1::{EventType, WorkflowTaskFailedCause},
|
|
13
|
+
history::v1::{History, HistoryEvent},
|
|
14
|
+
workflowservice::v1::GetWorkflowExecutionHistoryResponse,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
use temporalio_sdk::WfContext;
|
|
18
|
+
use temporalio_sdk_core::test_help::{MockPollCfg, ResponseType, mock_worker_client};
|
|
19
|
+
|
|
20
|
+
#[tokio::test]
|
|
21
|
+
async fn weird_pagination_doesnt_drop_wft_events() {
|
|
22
|
+
let wf_id = "fakeid";
|
|
23
|
+
// 1: EVENT_TYPE_WORKFLOW_EXECUTION_STARTED
|
|
24
|
+
// 2: EVENT_TYPE_WORKFLOW_TASK_SCHEDULED
|
|
25
|
+
// 3: EVENT_TYPE_WORKFLOW_TASK_STARTED
|
|
26
|
+
// 4: EVENT_TYPE_WORKFLOW_TASK_COMPLETED
|
|
27
|
+
// empty page
|
|
28
|
+
// 5: EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED
|
|
29
|
+
// 6: EVENT_TYPE_WORKFLOW_TASK_SCHEDULED
|
|
30
|
+
// 7: EVENT_TYPE_WORKFLOW_TASK_STARTED
|
|
31
|
+
// 8: EVENT_TYPE_WORKFLOW_TASK_FAILED
|
|
32
|
+
// empty page
|
|
33
|
+
// 9: EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED
|
|
34
|
+
// 10: EVENT_TYPE_WORKFLOW_TASK_SCHEDULED
|
|
35
|
+
// 11: EVENT_TYPE_WORKFLOW_TASK_STARTED
|
|
36
|
+
// empty page
|
|
37
|
+
let mut t = TestHistoryBuilder::default();
|
|
38
|
+
t.add_by_type(EventType::WorkflowExecutionStarted);
|
|
39
|
+
t.add_full_wf_task();
|
|
40
|
+
|
|
41
|
+
t.add_we_signaled("hi", vec![]);
|
|
42
|
+
t.add_workflow_task_scheduled_and_started();
|
|
43
|
+
t.add_workflow_task_failed_with_failure(
|
|
44
|
+
WorkflowTaskFailedCause::UnhandledCommand,
|
|
45
|
+
Default::default(),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
t.add_we_signaled("hi", vec![]);
|
|
49
|
+
t.add_workflow_task_scheduled_and_started();
|
|
50
|
+
|
|
51
|
+
let workflow_task = t.get_full_history_info().unwrap();
|
|
52
|
+
let mut wft_resp = workflow_task.as_poll_wft_response();
|
|
53
|
+
wft_resp.workflow_execution = Some(WorkflowExecution {
|
|
54
|
+
workflow_id: wf_id.to_string(),
|
|
55
|
+
run_id: t.get_orig_run_id().to_string(),
|
|
56
|
+
});
|
|
57
|
+
// Just 9/10/11 in WFT
|
|
58
|
+
wft_resp.history.as_mut().unwrap().events.drain(0..8);
|
|
59
|
+
|
|
60
|
+
let mut resp_1: GetWorkflowExecutionHistoryResponse = t.get_full_history_info().unwrap().into();
|
|
61
|
+
resp_1.next_page_token = vec![1];
|
|
62
|
+
resp_1.history.as_mut().unwrap().events.truncate(4);
|
|
63
|
+
|
|
64
|
+
let mut mock_client = mock_worker_client();
|
|
65
|
+
mock_client
|
|
66
|
+
.expect_get_workflow_execution_history()
|
|
67
|
+
.returning(move |_, _, _| Ok(resp_1.clone()))
|
|
68
|
+
.times(1);
|
|
69
|
+
mock_client
|
|
70
|
+
.expect_get_workflow_execution_history()
|
|
71
|
+
.returning(move |_, _, _| {
|
|
72
|
+
Ok(GetWorkflowExecutionHistoryResponse {
|
|
73
|
+
history: Some(History { events: vec![] }),
|
|
74
|
+
raw_history: vec![],
|
|
75
|
+
next_page_token: vec![2],
|
|
76
|
+
archived: false,
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
.times(1);
|
|
80
|
+
let mut resp_2: GetWorkflowExecutionHistoryResponse = t.get_full_history_info().unwrap().into();
|
|
81
|
+
resp_2.next_page_token = vec![3];
|
|
82
|
+
resp_2.history.as_mut().unwrap().events.drain(0..4);
|
|
83
|
+
resp_2.history.as_mut().unwrap().events.truncate(4);
|
|
84
|
+
mock_client
|
|
85
|
+
.expect_get_workflow_execution_history()
|
|
86
|
+
.returning(move |_, _, _| Ok(resp_2.clone()))
|
|
87
|
+
.times(1);
|
|
88
|
+
mock_client
|
|
89
|
+
.expect_get_workflow_execution_history()
|
|
90
|
+
.returning(move |_, _, _| {
|
|
91
|
+
Ok(GetWorkflowExecutionHistoryResponse {
|
|
92
|
+
history: Some(History { events: vec![] }),
|
|
93
|
+
raw_history: vec![],
|
|
94
|
+
next_page_token: vec![],
|
|
95
|
+
archived: false,
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
.times(1);
|
|
99
|
+
|
|
100
|
+
let wf_type = DEFAULT_WORKFLOW_TYPE;
|
|
101
|
+
let mh = MockPollCfg::from_resp_batches(wf_id, t, [ResponseType::Raw(wft_resp)], mock_client);
|
|
102
|
+
let mut worker = mock_sdk_cfg(mh, |cfg| {
|
|
103
|
+
cfg.max_cached_workflows = 2;
|
|
104
|
+
cfg.ignore_evicts_on_shutdown = false;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
let sig_ctr = Arc::new(AtomicUsize::new(0));
|
|
108
|
+
let sig_ctr_clone = sig_ctr.clone();
|
|
109
|
+
worker.register_wf(wf_type.to_owned(), move |ctx: WfContext| {
|
|
110
|
+
let sig_ctr_clone = sig_ctr_clone.clone();
|
|
111
|
+
async move {
|
|
112
|
+
let mut sigchan = ctx.make_signal_channel("hi");
|
|
113
|
+
while sigchan.next().await.is_some() {
|
|
114
|
+
if sig_ctr_clone.fetch_add(1, Ordering::AcqRel) == 1 {
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
Ok(().into())
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
worker
|
|
123
|
+
.submit_wf(
|
|
124
|
+
wf_id.to_owned(),
|
|
125
|
+
wf_type.to_owned(),
|
|
126
|
+
vec![],
|
|
127
|
+
WorkflowOptions::default(),
|
|
128
|
+
)
|
|
129
|
+
.await
|
|
130
|
+
.unwrap();
|
|
131
|
+
worker.run_until_done().await.unwrap();
|
|
132
|
+
assert_eq!(sig_ctr.load(Ordering::Acquire), 2);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
#[tokio::test]
|
|
136
|
+
async fn extreme_pagination_doesnt_drop_wft_events_worker() {
|
|
137
|
+
let wf_id = "fakeid";
|
|
138
|
+
|
|
139
|
+
// In this test, we add empty pages between each event
|
|
140
|
+
|
|
141
|
+
// 1: EVENT_TYPE_WORKFLOW_EXECUTION_STARTED
|
|
142
|
+
// 2: EVENT_TYPE_WORKFLOW_TASK_SCHEDULED
|
|
143
|
+
// 3: EVENT_TYPE_WORKFLOW_TASK_STARTED // <- previous_started_event_id
|
|
144
|
+
// 4: EVENT_TYPE_WORKFLOW_TASK_COMPLETED
|
|
145
|
+
|
|
146
|
+
// 5: EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED
|
|
147
|
+
// 6: EVENT_TYPE_WORKFLOW_TASK_SCHEDULED
|
|
148
|
+
// 7: EVENT_TYPE_WORKFLOW_TASK_STARTED
|
|
149
|
+
// 8: EVENT_TYPE_WORKFLOW_TASK_FAILED
|
|
150
|
+
|
|
151
|
+
// 9: EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED
|
|
152
|
+
// 10: EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED
|
|
153
|
+
// 11: EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED
|
|
154
|
+
// 12: EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED
|
|
155
|
+
// 13: EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED
|
|
156
|
+
// 14: EVENT_TYPE_WORKFLOW_TASK_SCHEDULED
|
|
157
|
+
// 15: EVENT_TYPE_WORKFLOW_TASK_STARTED // <- started_event_id
|
|
158
|
+
|
|
159
|
+
let mut t = TestHistoryBuilder::default();
|
|
160
|
+
t.add_by_type(EventType::WorkflowExecutionStarted);
|
|
161
|
+
t.add_full_wf_task();
|
|
162
|
+
|
|
163
|
+
t.add_we_signaled("hi", vec![]);
|
|
164
|
+
t.add_workflow_task_scheduled_and_started();
|
|
165
|
+
t.add_workflow_task_failed_with_failure(
|
|
166
|
+
WorkflowTaskFailedCause::UnhandledCommand,
|
|
167
|
+
Default::default(),
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
t.add_we_signaled("hi", vec![]);
|
|
171
|
+
t.add_we_signaled("hi", vec![]);
|
|
172
|
+
t.add_we_signaled("hi", vec![]);
|
|
173
|
+
t.add_we_signaled("hi", vec![]);
|
|
174
|
+
t.add_we_signaled("hi", vec![]);
|
|
175
|
+
t.add_workflow_task_scheduled_and_started();
|
|
176
|
+
|
|
177
|
+
/////
|
|
178
|
+
|
|
179
|
+
let events: Vec<HistoryEvent> = t.get_full_history_info().unwrap().into_events();
|
|
180
|
+
let first_event = events[0].clone();
|
|
181
|
+
|
|
182
|
+
let mut mock_client = mock_worker_client();
|
|
183
|
+
|
|
184
|
+
for (i, event) in events.into_iter().enumerate() {
|
|
185
|
+
// Add an empty page
|
|
186
|
+
mock_client
|
|
187
|
+
.expect_get_workflow_execution_history()
|
|
188
|
+
.returning(move |_, _, _| {
|
|
189
|
+
Ok(GetWorkflowExecutionHistoryResponse {
|
|
190
|
+
history: Some(History { events: vec![] }),
|
|
191
|
+
raw_history: vec![],
|
|
192
|
+
next_page_token: vec![(i * 10 + 1) as u8],
|
|
193
|
+
archived: false,
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
.times(1);
|
|
197
|
+
|
|
198
|
+
// Add a page with just event i
|
|
199
|
+
mock_client
|
|
200
|
+
.expect_get_workflow_execution_history()
|
|
201
|
+
.returning(move |_, _, _| {
|
|
202
|
+
Ok(GetWorkflowExecutionHistoryResponse {
|
|
203
|
+
history: Some(History {
|
|
204
|
+
events: vec![event.clone()],
|
|
205
|
+
}),
|
|
206
|
+
raw_history: vec![],
|
|
207
|
+
next_page_token: vec![(i * 10) as u8],
|
|
208
|
+
archived: false,
|
|
209
|
+
})
|
|
210
|
+
})
|
|
211
|
+
.times(1);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Add an extra empty page at the end, with no NPT
|
|
215
|
+
mock_client
|
|
216
|
+
.expect_get_workflow_execution_history()
|
|
217
|
+
.returning(move |_, _, _| {
|
|
218
|
+
Ok(GetWorkflowExecutionHistoryResponse {
|
|
219
|
+
history: Some(History { events: vec![] }),
|
|
220
|
+
raw_history: vec![],
|
|
221
|
+
next_page_token: vec![],
|
|
222
|
+
archived: false,
|
|
223
|
+
})
|
|
224
|
+
})
|
|
225
|
+
.times(1);
|
|
226
|
+
|
|
227
|
+
let workflow_task = t.get_full_history_info().unwrap();
|
|
228
|
+
let mut wft_resp = workflow_task.as_poll_wft_response();
|
|
229
|
+
wft_resp.workflow_execution = Some(WorkflowExecution {
|
|
230
|
+
workflow_id: wf_id.to_string(),
|
|
231
|
+
run_id: t.get_orig_run_id().to_string(),
|
|
232
|
+
});
|
|
233
|
+
wft_resp.history = Some(History {
|
|
234
|
+
events: vec![first_event],
|
|
235
|
+
});
|
|
236
|
+
wft_resp.next_page_token = vec![1];
|
|
237
|
+
wft_resp.previous_started_event_id = 3;
|
|
238
|
+
wft_resp.started_event_id = 15;
|
|
239
|
+
|
|
240
|
+
let wf_type = DEFAULT_WORKFLOW_TYPE;
|
|
241
|
+
let mh = MockPollCfg::from_resp_batches(wf_id, t, [ResponseType::Raw(wft_resp)], mock_client);
|
|
242
|
+
let mut worker = mock_sdk_cfg(mh, |cfg| {
|
|
243
|
+
cfg.max_cached_workflows = 2;
|
|
244
|
+
cfg.ignore_evicts_on_shutdown = false;
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
let sig_ctr = Arc::new(AtomicUsize::new(0));
|
|
248
|
+
let sig_ctr_clone = sig_ctr.clone();
|
|
249
|
+
worker.register_wf(wf_type.to_owned(), move |ctx: WfContext| {
|
|
250
|
+
let sig_ctr_clone = sig_ctr_clone.clone();
|
|
251
|
+
async move {
|
|
252
|
+
let mut sigchan = ctx.make_signal_channel("hi");
|
|
253
|
+
while sigchan.next().await.is_some() {
|
|
254
|
+
if sig_ctr_clone.fetch_add(1, Ordering::AcqRel) == 5 {
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
Ok(().into())
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
worker
|
|
263
|
+
.submit_wf(
|
|
264
|
+
wf_id.to_owned(),
|
|
265
|
+
wf_type.to_owned(),
|
|
266
|
+
vec![],
|
|
267
|
+
WorkflowOptions::default(),
|
|
268
|
+
)
|
|
269
|
+
.await
|
|
270
|
+
.unwrap();
|
|
271
|
+
worker.run_until_done().await.unwrap();
|
|
272
|
+
assert_eq!(sig_ctr.load(Ordering::Acquire), 6);
|
|
273
|
+
}
|