@temporalio/core-bridge 1.13.2 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +135 -100
- package/Cargo.toml +3 -2
- package/{sdk-core/fsm/rustfsm_trait/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 +13 -6
- 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 +9 -3
- package/sdk-core/.github/workflows/per-pr.yml +42 -5
- package/sdk-core/AGENTS.md +17 -19
- package/sdk-core/Cargo.toml +6 -7
- package/sdk-core/README.md +12 -15
- package/sdk-core/arch_docs/diagrams/deps.svg +102 -0
- package/sdk-core/{client → crates/client}/Cargo.toml +7 -9
- package/sdk-core/{client → crates/client}/src/lib.rs +110 -159
- package/sdk-core/{client → crates/client}/src/metrics.rs +1 -1
- package/sdk-core/{client → crates/client}/src/raw.rs +73 -44
- package/sdk-core/crates/client/src/request_extensions.rs +40 -0
- package/sdk-core/{client → crates/client}/src/retry.rs +24 -17
- package/sdk-core/crates/client/src/worker/mod.rs +1468 -0
- package/sdk-core/{client → crates/client}/src/workflow_handle/mod.rs +4 -4
- package/sdk-core/{core-api → crates/common}/Cargo.toml +17 -8
- 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 +5 -0
- package/sdk-core/{core-api → crates/common}/src/envconfig.rs +2 -2
- 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 +24 -9
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/canned_histories.rs +1 -1
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_builder.rs +1 -1
- 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} +18 -17
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/test_utils.rs +1 -1
- package/sdk-core/{core-api → crates/common}/src/telemetry/metrics.rs +447 -50
- package/sdk-core/{core-api → crates/common}/src/telemetry.rs +3 -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 +6 -11
- package/sdk-core/{sdk → crates/sdk}/Cargo.toml +10 -10
- package/sdk-core/{sdk → crates/sdk}/src/activity_context.rs +8 -6
- package/sdk-core/{sdk → crates/sdk}/src/interceptors.rs +1 -1
- package/sdk-core/{sdk → crates/sdk}/src/lib.rs +42 -37
- package/sdk-core/{sdk → crates/sdk}/src/workflow_context/options.rs +2 -2
- package/sdk-core/{sdk → crates/sdk}/src/workflow_context.rs +21 -19
- package/sdk-core/{sdk → crates/sdk}/src/workflow_future.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/Cargo.toml +32 -25
- package/sdk-core/{tests → crates/sdk-core/benches}/workflow_replay_bench.rs +10 -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 +36 -31
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/mod.rs +12 -9
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/queries.rs +24 -21
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/replay_flag.rs +10 -8
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/updates.rs +17 -15
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workers.rs +242 -17
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_cancels.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_tasks.rs +126 -39
- 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 +3 -3
- package/sdk-core/crates/sdk-core/src/histfetch.rs +33 -0
- package/sdk-core/{core → crates/sdk-core}/src/internal_flags.rs +4 -3
- package/sdk-core/{core → crates/sdk-core}/src/lib.rs +85 -43
- package/sdk-core/{core → crates/sdk-core}/src/pollers/mod.rs +8 -6
- package/sdk-core/{core → crates/sdk-core}/src/pollers/poll_buffer.rs +51 -16
- package/sdk-core/{core → crates/sdk-core}/src/protosext/mod.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/protosext/protocol_messages.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/replay/mod.rs +14 -11
- package/sdk-core/{core → crates/sdk-core}/src/retry_logic.rs +19 -1
- 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 -34
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/mod.rs +4 -4
- 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 +13 -13
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_server.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/test_help/integ_helpers.rs +127 -40
- package/sdk-core/{core → crates/sdk-core}/src/test_help/unit_helpers.rs +13 -11
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities/activity_heartbeat_manager.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities/local_activities.rs +14 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities.rs +21 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/client/mocks.rs +25 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/client.rs +164 -71
- 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 +15 -14
- package/sdk-core/{core → crates/sdk-core}/src/worker/slot_provider.rs +12 -13
- 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 +21 -4
- 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 +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/activity_state_machine.rs +147 -37
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_external_state_machine.rs +8 -9
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_nexus_op_state_machine.rs +14 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_workflow_state_machine.rs +6 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/child_workflow_state_machine.rs +31 -37
- 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 -7
- 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 +33 -30
- 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 -3
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/nexus_operation_state_machine.rs +20 -22
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/patch_state_machine.rs +12 -11
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/signal_external_state_machine.rs +9 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/timer_state_machine.rs +26 -13
- 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 +20 -18
- 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 +61 -70
- 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 +166 -60
- 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 +30 -16
- package/sdk-core/{tests → crates/sdk-core/tests}/c_bridge_smoke_test.c +1 -1
- package/sdk-core/{tests → crates/sdk-core/tests}/cloud_tests.rs +1 -1
- package/sdk-core/crates/sdk-core/tests/common/fake_grpc_server.rs +106 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/common/http_proxy.rs +1 -1
- package/sdk-core/{tests → crates/sdk-core/tests}/common/mod.rs +93 -74
- package/sdk-core/{tests → crates/sdk-core/tests}/common/workflows.rs +4 -3
- 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 +14 -15
- package/sdk-core/{tests → crates/sdk-core/tests/heavy_tests}/fuzzy_workflow.rs +3 -3
- package/sdk-core/{tests → crates/sdk-core/tests}/heavy_tests.rs +19 -12
- 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 +16 -111
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/ephemeral_server_tests.rs +5 -6
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/heartbeat_tests.rs +23 -19
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/metrics_tests.rs +134 -60
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/pagination_tests.rs +4 -4
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/polling_tests.rs +37 -36
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/queries_tests.rs +12 -10
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/update_tests.rs +41 -29
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/visibility_tests.rs +24 -19
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +1061 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_tests.rs +113 -51
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_versioning_tests.rs +19 -17
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/activities.rs +35 -30
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/appdata_propagation.rs +3 -3
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/cancel_external.rs +14 -9
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/cancel_wf.rs +13 -8
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/child_workflows.rs +48 -35
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/continue_as_new.rs +14 -9
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/determinism.rs +24 -15
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/eager.rs +9 -4
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/local_activities.rs +47 -47
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/modify_wf_properties.rs +16 -11
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/nexus.rs +51 -23
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/patches.rs +22 -10
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/replay.rs +19 -17
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/resets.rs +14 -5
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/signals.rs +24 -15
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/stickyness.rs +8 -6
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/timers.rs +28 -18
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/upsert_search_attrs.rs +18 -13
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests.rs +46 -41
- package/sdk-core/{tests → crates/sdk-core/tests}/main.rs +15 -9
- package/sdk-core/{tests → crates/sdk-core/tests}/manual_tests.rs +20 -14
- package/sdk-core/{tests → crates/sdk-core/tests}/runner.rs +2 -2
- package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/mod.rs +10 -5
- package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/priority.rs +5 -5
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/Cargo.toml +13 -10
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/include/temporal-sdk-core-c-bridge.h +32 -23
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/client.rs +55 -32
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/envconfig.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/lib.rs +1 -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/runtime.rs +24 -9
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/testing.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/context.rs +11 -10
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/mod.rs +7 -7
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/utils.rs +3 -4
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/worker.rs +111 -58
- 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 +24 -33
- package/src/helpers/try_from_js.rs +1 -1
- package/src/logs.rs +1 -1
- package/src/metrics.rs +3 -3
- package/src/runtime.rs +42 -28
- package/src/testing.rs +3 -3
- package/src/worker.rs +70 -36
- package/ts/native.ts +13 -6
- package/LICENSE.md +0 -23
- package/sdk-core/client/src/worker_registry/mod.rs +0 -282
- package/sdk-core/core/src/worker/heartbeat.rs +0 -230
- package/sdk-core/core/src/worker/mod.rs +0 -990
- 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/LICENSE.txt +0 -21
- 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/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/{client → crates/client}/src/callback_based.rs +0 -0
- /package/sdk-core/{client → crates/client}/src/proxy.rs +0 -0
- /package/sdk-core/{client → crates/client}/src/replaceable.rs +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/build.rs +0 -0
- /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/openapiv2.json +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv3.yaml +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/common/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/deployment/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/namespace/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/api_upstream/temporal/api/workflowservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/service.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_activation/workflow_activation.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/{sdk-core-protos/src → crates/common/src/protos}/utilities.rs +0 -0
- /package/sdk-core/{fsm → crates/macros}/LICENSE.txt +0 -0
- /package/sdk-core/{sdk → crates/sdk}/src/app_data.rs +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/abstractions/take_cell.rs +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/test_help/mod.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/{core-c-bridge → crates/sdk-core-c-bridge}/src/random.rs +0 -0
- /package/sdk-core/{cargo-tokio-console.sh → etc/cargo-tokio-console.sh} +0 -0
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
[package]
|
|
2
|
-
name = "
|
|
2
|
+
name = "temporalio-sdk-core"
|
|
3
3
|
version = "0.1.0"
|
|
4
|
-
authors = [
|
|
5
|
-
"Spencer Judge <spencer@temporal.io>",
|
|
6
|
-
"Vitaly Arbuzov <vitaly@temporal.io>",
|
|
7
|
-
]
|
|
4
|
+
authors = ["Temporal Technologies Inc. <sdk@temporal.io>"]
|
|
8
5
|
edition = "2024"
|
|
9
6
|
license-file = { workspace = true }
|
|
10
7
|
description = "Library for building new Temporal SDKs"
|
|
@@ -30,9 +27,11 @@ tokio-console = ["console-subscriber"]
|
|
|
30
27
|
ephemeral-server = ["dep:flate2", "dep:reqwest", "dep:tar", "dep:zip"]
|
|
31
28
|
debug-plugin = ["dep:reqwest"]
|
|
32
29
|
test-utilities = ["dep:assert_matches", "dep:bimap"]
|
|
30
|
+
antithesis_assertions = ["dep:antithesis_sdk"]
|
|
33
31
|
|
|
34
32
|
[dependencies]
|
|
35
33
|
anyhow = "1.0"
|
|
34
|
+
antithesis_sdk = { version = "0.2.1", optional = true, default-features = false, features = ["full"] }
|
|
36
35
|
assert_matches = { version = "1.5", optional = true }
|
|
37
36
|
bimap = { version = "0.6.3", optional = true }
|
|
38
37
|
async-trait = "0.1"
|
|
@@ -120,19 +119,15 @@ uuid = { version = "1.18", features = ["v4"] }
|
|
|
120
119
|
zip = { version = "4.6", optional = true, default-features = false, features = ["deflate", "bzip2", "zstd"] }
|
|
121
120
|
|
|
122
121
|
# 1st party local deps
|
|
123
|
-
[dependencies.
|
|
124
|
-
path = "../
|
|
125
|
-
features = ["otel_impls"]
|
|
126
|
-
|
|
127
|
-
[dependencies.temporal-sdk-core-protos]
|
|
128
|
-
path = "../sdk-core-protos"
|
|
129
|
-
features = ["history_builders", "test-utilities"]
|
|
122
|
+
[dependencies.temporalio-common]
|
|
123
|
+
path = "../common"
|
|
124
|
+
features = ["otel_impls", "history_builders", "test-utilities"]
|
|
130
125
|
|
|
131
|
-
[dependencies.
|
|
126
|
+
[dependencies.temporalio-client]
|
|
132
127
|
path = "../client"
|
|
133
128
|
|
|
134
|
-
[dependencies.
|
|
135
|
-
path = "../
|
|
129
|
+
[dependencies.temporalio-macros]
|
|
130
|
+
path = "../macros"
|
|
136
131
|
|
|
137
132
|
[dev-dependencies]
|
|
138
133
|
assert_matches = "1.5"
|
|
@@ -142,7 +137,7 @@ clap = { version = "4.5", features = ["derive"] }
|
|
|
142
137
|
criterion = { version = "0.7", features = ["async", "async_tokio"] }
|
|
143
138
|
rstest = "0.26"
|
|
144
139
|
semver = "1.0"
|
|
145
|
-
|
|
140
|
+
temporalio-sdk = { path = "../sdk" }
|
|
146
141
|
tokio = { version = "1.47", features = [
|
|
147
142
|
"rt",
|
|
148
143
|
"rt-multi-thread",
|
|
@@ -153,46 +148,58 @@ tokio = { version = "1.47", features = [
|
|
|
153
148
|
"test-util",
|
|
154
149
|
] }
|
|
155
150
|
tokio-stream = { version = "0.1", features = ["net"] }
|
|
151
|
+
trybuild = { version = "1.0", features = ["diff"] }
|
|
152
|
+
|
|
153
|
+
[[bin]]
|
|
154
|
+
name = "histfetch"
|
|
155
|
+
path = "src/histfetch.rs"
|
|
156
|
+
required-features = ["test-utilities"]
|
|
156
157
|
|
|
157
158
|
[[test]]
|
|
158
159
|
name = "integ_tests"
|
|
159
|
-
path = "
|
|
160
|
+
path = "tests/main.rs"
|
|
160
161
|
# Prevents autodiscovery, and hence these getting run with `cargo test`. Run with
|
|
161
162
|
# `cargo test --test integ_tests`
|
|
162
163
|
test = false
|
|
163
164
|
required-features = [
|
|
164
|
-
"
|
|
165
|
+
"temporalio-common/serde_serialize",
|
|
165
166
|
"test-utilities",
|
|
166
167
|
"ephemeral-server",
|
|
167
168
|
]
|
|
168
169
|
|
|
169
170
|
[[test]]
|
|
170
171
|
name = "heavy_tests"
|
|
171
|
-
path = "
|
|
172
|
+
path = "tests/heavy_tests.rs"
|
|
172
173
|
test = false
|
|
173
174
|
required-features = ["test-utilities"]
|
|
174
175
|
|
|
175
176
|
[[test]]
|
|
176
177
|
name = "manual_tests"
|
|
177
|
-
path = "
|
|
178
|
+
path = "tests/manual_tests.rs"
|
|
178
179
|
test = false
|
|
179
180
|
required-features = ["test-utilities"]
|
|
180
181
|
|
|
181
182
|
[[test]]
|
|
182
183
|
name = "global_metric_tests"
|
|
183
|
-
path = "
|
|
184
|
+
path = "tests/global_metric_tests.rs"
|
|
184
185
|
test = false
|
|
185
186
|
required-features = ["test-utilities"]
|
|
186
187
|
|
|
187
188
|
[[test]]
|
|
188
189
|
name = "cloud_tests"
|
|
189
|
-
path = "
|
|
190
|
+
path = "tests/cloud_tests.rs"
|
|
190
191
|
test = false
|
|
191
192
|
required-features = ["test-utilities"]
|
|
192
193
|
|
|
194
|
+
[[test]]
|
|
195
|
+
name = "fsm_procmacro"
|
|
196
|
+
path = "tests/fsm_procmacro.rs"
|
|
197
|
+
required-features = ["temporalio-common/serde_serialize"]
|
|
198
|
+
|
|
193
199
|
[[bench]]
|
|
194
200
|
name = "workflow_replay"
|
|
195
|
-
path = "
|
|
201
|
+
path = "benches/workflow_replay_bench.rs"
|
|
202
|
+
test = false
|
|
196
203
|
harness = false
|
|
197
204
|
|
|
198
205
|
# The integration test runner should compile with the same configuration as the
|
|
@@ -201,11 +208,11 @@ harness = false
|
|
|
201
208
|
# tests directly.
|
|
202
209
|
[[test]]
|
|
203
210
|
name = "integ_runner"
|
|
204
|
-
path = "
|
|
211
|
+
path = "tests/runner.rs"
|
|
205
212
|
harness = false
|
|
206
213
|
test = false
|
|
207
214
|
required-features = [
|
|
208
|
-
"
|
|
215
|
+
"temporalio-common/serde_serialize",
|
|
209
216
|
"test-utilities",
|
|
210
217
|
"ephemeral-server",
|
|
211
218
|
]
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
//! This bench lives outside of the traditional /benches directory so it can share common code with
|
|
2
|
-
//! integration tests.
|
|
3
|
-
|
|
4
1
|
// All non-main.rs tests ignore dead common code so that the linter doesn't complain about about it.
|
|
5
2
|
#[allow(dead_code)]
|
|
3
|
+
#[path = "../tests/common/mod.rs"]
|
|
6
4
|
mod common;
|
|
7
5
|
|
|
8
|
-
use crate::common::{
|
|
6
|
+
use crate::common::{
|
|
7
|
+
DONT_AUTO_INIT_INTEG_TELEM, get_integ_runtime_options, prom_metrics, replay_sdk_worker,
|
|
8
|
+
};
|
|
9
9
|
use criterion::{BatchSize, Criterion, criterion_group, criterion_main};
|
|
10
10
|
use futures_util::StreamExt;
|
|
11
11
|
use std::{
|
|
@@ -13,12 +13,12 @@ use std::{
|
|
|
13
13
|
thread,
|
|
14
14
|
time::Duration,
|
|
15
15
|
};
|
|
16
|
-
use
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
MetricKeyValue, MetricParametersBuilder, NewAttributes,
|
|
16
|
+
use temporalio_common::{
|
|
17
|
+
protos::{DEFAULT_WORKFLOW_TYPE, canned_histories},
|
|
18
|
+
telemetry::metrics::{MetricKeyValue, MetricParametersBuilder, NewAttributes},
|
|
20
19
|
};
|
|
21
|
-
use
|
|
20
|
+
use temporalio_sdk::{WfContext, WorkflowFunction};
|
|
21
|
+
use temporalio_sdk_core::{CoreRuntime, replay::HistoryForReplay};
|
|
22
22
|
|
|
23
23
|
pub fn criterion_benchmark(c: &mut Criterion) {
|
|
24
24
|
let tokio_runtime = tokio::runtime::Builder::new_current_thread()
|
|
@@ -80,7 +80,7 @@ pub fn bench_metrics(c: &mut Criterion) {
|
|
|
80
80
|
let _tokio = tokio_runtime.enter();
|
|
81
81
|
let (mut telemopts, _addr, _aborter) = prom_metrics(None);
|
|
82
82
|
telemopts.logging = None;
|
|
83
|
-
let rt = CoreRuntime::new_assume_tokio(telemopts).unwrap();
|
|
83
|
+
let rt = CoreRuntime::new_assume_tokio(get_integ_runtime_options(telemopts)).unwrap();
|
|
84
84
|
let meter = rt.telemetry().get_metric_meter().unwrap();
|
|
85
85
|
|
|
86
86
|
c.bench_function("Record with new attributes on each call", move |b| {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Created -[#blue]-> ScheduleCommandCreated: Schedule
|
|
3
|
+
ScheduleCommandCreated -[#blue]-> ScheduleCommandCreated: CommandScheduleActivityTask
|
|
4
|
+
ScheduleCommandCreated -[#blue]-> ScheduledEventRecorded: ActivityTaskScheduled
|
|
5
|
+
ScheduleCommandCreated -[#blue]-> Canceled: Cancel
|
|
6
|
+
ScheduleCommandCreated -[#blue]-> Canceled: Abandon
|
|
7
|
+
ScheduledEventRecorded -[#blue]-> Started: ActivityTaskStarted
|
|
8
|
+
ScheduledEventRecorded -[#blue]-> TimedOut: ActivityTaskTimedOut
|
|
9
|
+
ScheduledEventRecorded -[#blue]-> ScheduledActivityCancelCommandCreated: Cancel
|
|
10
|
+
ScheduledEventRecorded -[#blue]-> Canceled: Abandon
|
|
11
|
+
Started -[#blue]-> Completed: ActivityTaskCompleted
|
|
12
|
+
Started -[#blue]-> Failed: ActivityTaskFailed
|
|
13
|
+
Started -[#blue]-> TimedOut: ActivityTaskTimedOut
|
|
14
|
+
Started -[#blue]-> StartedActivityCancelCommandCreated: Cancel
|
|
15
|
+
Started -[#blue]-> Canceled: Abandon
|
|
16
|
+
ScheduledActivityCancelCommandCreated -[#blue]-> ScheduledActivityCancelCommandCreated: CommandRequestCancelActivityTask
|
|
17
|
+
ScheduledActivityCancelCommandCreated -[#blue]-> ScheduledActivityCancelEventRecorded: ActivityTaskCancelRequested
|
|
18
|
+
ScheduledActivityCancelEventRecorded -[#blue]-> Canceled: ActivityTaskCanceled
|
|
19
|
+
ScheduledActivityCancelEventRecorded -[#blue]-> StartedActivityCancelEventRecorded: ActivityTaskStarted
|
|
20
|
+
ScheduledActivityCancelEventRecorded -[#blue]-> TimedOut: ActivityTaskTimedOut
|
|
21
|
+
StartedActivityCancelCommandCreated -[#blue]-> StartedActivityCancelCommandCreated: CommandRequestCancelActivityTask
|
|
22
|
+
StartedActivityCancelCommandCreated -[#blue]-> StartedActivityCancelEventRecorded: ActivityTaskCancelRequested
|
|
23
|
+
StartedActivityCancelEventRecorded --> Failed: ActivityTaskFailed
|
|
24
|
+
StartedActivityCancelEventRecorded -[#blue]-> Completed: ActivityTaskCompleted
|
|
25
|
+
StartedActivityCancelEventRecorded -[#blue]-> TimedOut: ActivityTaskTimedOut
|
|
26
|
+
StartedActivityCancelEventRecorded -[#blue]-> Canceled: ActivityTaskCanceled
|
|
27
|
+
Canceled -[#blue]-> Canceled: ActivityTaskStarted
|
|
28
|
+
Canceled -[#blue]-> Canceled: ActivityTaskCompleted
|
|
29
|
+
TimedOut --> [*]
|
|
30
|
+
Failed --> [*]
|
|
31
|
+
Completed --> [*]
|
|
32
|
+
@enduml
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Created -[#blue]-> RequestCancelExternalCommandCreated: Schedule
|
|
3
|
+
RequestCancelExternalCommandCreated -[#blue]-> RequestCancelExternalCommandCreated: CommandRequestCancelExternalWorkflowExecution
|
|
4
|
+
RequestCancelExternalCommandCreated -[#blue]-> RequestCancelExternalCommandRecorded: RequestCancelExternalWorkflowExecutionInitiated
|
|
5
|
+
RequestCancelExternalCommandRecorded -[#blue]-> CancelRequested: ExternalWorkflowExecutionCancelRequested
|
|
6
|
+
RequestCancelExternalCommandRecorded -[#blue]-> RequestCancelFailed: RequestCancelExternalWorkflowExecutionFailed
|
|
7
|
+
CancelRequested --> [*]
|
|
8
|
+
RequestCancelFailed --> [*]
|
|
9
|
+
@enduml
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Created -[#blue]-> CancelWorkflowCommandCreated: Schedule
|
|
3
|
+
CancelWorkflowCommandCreated -[#blue]-> CancelWorkflowCommandCreated: CommandCancelWorkflowExecution
|
|
4
|
+
CancelWorkflowCommandCreated -[#blue]-> CancelWorkflowCommandRecorded: WorkflowExecutionCanceled
|
|
5
|
+
CancelWorkflowCommandRecorded --> [*]
|
|
6
|
+
@enduml
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Created -[#blue]-> StartCommandCreated: Schedule
|
|
3
|
+
StartCommandCreated -[#blue]-> StartCommandCreated: CommandStartChildWorkflowExecution
|
|
4
|
+
StartCommandCreated --> StartEventRecorded: StartChildWorkflowExecutionInitiated
|
|
5
|
+
StartCommandCreated --> Cancelled: Cancel
|
|
6
|
+
StartEventRecorded --> Started: ChildWorkflowExecutionStarted
|
|
7
|
+
StartEventRecorded --> StartFailed: StartChildWorkflowExecutionFailed
|
|
8
|
+
Started --> Completed: ChildWorkflowExecutionCompleted
|
|
9
|
+
Started --> Failed: ChildWorkflowExecutionFailed
|
|
10
|
+
Started --> TimedOut: ChildWorkflowExecutionTimedOut
|
|
11
|
+
Started --> Cancelled: ChildWorkflowExecutionCancelled
|
|
12
|
+
Started --> Terminated: ChildWorkflowExecutionTerminated
|
|
13
|
+
Started --> Started: Cancel
|
|
14
|
+
Started --> Cancelled: Cancel
|
|
15
|
+
Started --> Started: CommandRequestCancelExternalWorkflowExecution
|
|
16
|
+
Cancelled -[#blue]-> Cancelled: Cancel
|
|
17
|
+
Cancelled --> Cancelled: ChildWorkflowExecutionCancelled
|
|
18
|
+
Cancelled --> Cancelled: ChildWorkflowExecutionCompleted
|
|
19
|
+
Cancelled --> Cancelled: ChildWorkflowExecutionFailed
|
|
20
|
+
Cancelled --> Cancelled: ChildWorkflowExecutionTimedOut
|
|
21
|
+
Cancelled --> Cancelled: ChildWorkflowExecutionTerminated
|
|
22
|
+
Failed -[#blue]-> Failed: Cancel
|
|
23
|
+
StartFailed -[#blue]-> StartFailed: Cancel
|
|
24
|
+
TimedOut -[#blue]-> TimedOut: Cancel
|
|
25
|
+
Completed -[#blue]-> Completed: Cancel
|
|
26
|
+
Terminated --> [*]
|
|
27
|
+
@enduml
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Created -[#blue]-> CompleteWorkflowCommandCreated: Schedule
|
|
3
|
+
CompleteWorkflowCommandCreated -[#blue]-> CompleteWorkflowCommandCreated: CommandCompleteWorkflowExecution
|
|
4
|
+
CompleteWorkflowCommandCreated -[#blue]-> CompleteWorkflowCommandRecorded: WorkflowExecutionCompleted
|
|
5
|
+
CompleteWorkflowCommandRecorded --> [*]
|
|
6
|
+
@enduml
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Created -[#blue]-> ContinueAsNewWorkflowCommandCreated: Schedule
|
|
3
|
+
ContinueAsNewWorkflowCommandCreated -[#blue]-> ContinueAsNewWorkflowCommandCreated: CommandContinueAsNewWorkflowExecution
|
|
4
|
+
ContinueAsNewWorkflowCommandCreated --> ContinueAsNewWorkflowCommandRecorded: WorkflowExecutionContinuedAsNew
|
|
5
|
+
ContinueAsNewWorkflowCommandRecorded --> [*]
|
|
6
|
+
@enduml
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Created -[#blue]-> FailWorkflowCommandCreated: Schedule
|
|
3
|
+
FailWorkflowCommandCreated -[#blue]-> FailWorkflowCommandCreated: CommandFailWorkflowExecution
|
|
4
|
+
FailWorkflowCommandCreated -[#blue]-> FailWorkflowCommandRecorded: WorkflowExecutionFailed
|
|
5
|
+
FailWorkflowCommandRecorded --> [*]
|
|
6
|
+
@enduml
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Executing -[#blue]-> RequestSent: Schedule
|
|
3
|
+
Replaying -[#blue]-> WaitingMarkerEvent: Schedule
|
|
4
|
+
ReplayingPreResolved -[#blue]-> WaitingMarkerEventPreResolved: Schedule
|
|
5
|
+
RequestSent -[#blue]-> MarkerCommandCreated: HandleResult
|
|
6
|
+
RequestSent -[#blue]-> RequestSent: Cancel
|
|
7
|
+
RequestSent -[#blue]-> MarkerCommandCreated: NoWaitCancel
|
|
8
|
+
MarkerCommandCreated -[#blue]-> ResultNotified: CommandRecordMarker
|
|
9
|
+
ResultNotified -[#blue]-> MarkerCommandRecorded: MarkerRecorded
|
|
10
|
+
WaitingMarkerEvent -[#blue]-> MarkerCommandRecorded: MarkerRecorded
|
|
11
|
+
WaitingMarkerEvent -[#blue]-> WaitingMarkerEvent: Cancel
|
|
12
|
+
WaitingMarkerEvent -[#blue]-> WaitingMarkerEvent: HandleKnownResult
|
|
13
|
+
WaitingMarkerEvent -[#blue]-> WaitingMarkerEvent: NoWaitCancel
|
|
14
|
+
WaitingMarkerEvent -[#blue]-> RequestSent: StartedNonReplayWFT
|
|
15
|
+
WaitingMarkerEventPreResolved -[#blue]-> MarkerCommandRecorded: MarkerRecorded
|
|
16
|
+
WaitingMarkerEventPreResolved --> WaitingMarkerEventPreResolved: Cancel
|
|
17
|
+
WaitingMarkerEventPreResolved --> WaitingMarkerEventPreResolved: NoWaitCancel
|
|
18
|
+
MarkerCommandRecorded --> MarkerCommandRecorded: Cancel
|
|
19
|
+
MarkerCommandRecorded --> MarkerCommandRecorded: NoWaitCancel
|
|
20
|
+
MarkerCommandCreated -[#blue]-> MarkerCommandCreated: HandleResult
|
|
21
|
+
ResultNotified -[#blue]-> ResultNotified: HandleResult
|
|
22
|
+
MarkerCommandRecorded --> MarkerCommandRecorded: HandleResult
|
|
23
|
+
@enduml
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Executing -[#blue]-> MarkerCommandCreated: Schedule
|
|
3
|
+
Replaying -[#blue]-> MarkerCommandCreatedReplaying: Schedule
|
|
4
|
+
MarkerCommandCreated -[#blue]-> Notified: CommandRecordMarker
|
|
5
|
+
MarkerCommandCreatedReplaying -[#blue]-> Notified: CommandRecordMarker
|
|
6
|
+
Notified -[#blue]-> MarkerCommandRecorded: MarkerRecorded
|
|
7
|
+
MarkerCommandRecorded --> [*]
|
|
8
|
+
@enduml
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Created -[#blue]-> SignalExternalCommandCreated: Schedule
|
|
3
|
+
SignalExternalCommandCreated -[#blue]-> SignalExternalCommandCreated: CommandSignalExternalWorkflowExecution
|
|
4
|
+
SignalExternalCommandCreated -[#blue]-> Cancelled: Cancel
|
|
5
|
+
SignalExternalCommandCreated -[#blue]-> SignalExternalCommandRecorded: SignalExternalWorkflowExecutionInitiated
|
|
6
|
+
SignalExternalCommandRecorded --> SignalExternalCommandRecorded: Cancel
|
|
7
|
+
SignalExternalCommandRecorded -[#blue]-> Signaled: ExternalWorkflowExecutionSignaled
|
|
8
|
+
SignalExternalCommandRecorded -[#blue]-> Failed: SignalExternalWorkflowExecutionFailed
|
|
9
|
+
Cancelled -[#blue]-> Cancelled: Cancel
|
|
10
|
+
Signaled -[#blue]-> Signaled: Cancel
|
|
11
|
+
Failed --> [*]
|
|
12
|
+
@enduml
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Created -[#blue]-> StartCommandCreated: Schedule
|
|
3
|
+
StartCommandCreated -[#blue]-> StartCommandCreated: CommandStartTimer
|
|
4
|
+
StartCommandCreated -[#blue]-> StartCommandRecorded: TimerStarted
|
|
5
|
+
StartCommandCreated -[#blue]-> Canceled: Cancel
|
|
6
|
+
StartCommandRecorded -[#blue]-> Fired: TimerFired
|
|
7
|
+
StartCommandRecorded -[#blue]-> CancelTimerCommandCreated: Cancel
|
|
8
|
+
CancelTimerCommandCreated --> CancelTimerCommandCreated: Cancel
|
|
9
|
+
CancelTimerCommandCreated -[#blue]-> CancelTimerCommandSent: CommandCancelTimer
|
|
10
|
+
CancelTimerCommandSent --> Canceled: TimerCanceled
|
|
11
|
+
Canceled -[#blue]-> Canceled: Cancel
|
|
12
|
+
Fired -[#blue]-> Fired: Cancel
|
|
13
|
+
@enduml
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
RequestInitiated --> Accepted: Accept
|
|
3
|
+
RequestInitiated --> Rejected: Reject
|
|
4
|
+
Accepted --> CompletedImmediately: Complete
|
|
5
|
+
Accepted --> CompletedImmediately: Reject
|
|
6
|
+
Accepted -[#blue]-> AcceptCommandCreated: CommandProtocolMessage
|
|
7
|
+
AcceptCommandCreated -[#blue]-> AcceptCommandRecorded: WorkflowExecutionUpdateAccepted
|
|
8
|
+
AcceptCommandCreated --> CompletedImmediatelyAcceptCreated: Complete
|
|
9
|
+
AcceptCommandCreated --> CompletedImmediatelyAcceptCreated: Reject
|
|
10
|
+
AcceptCommandRecorded --> Completed: Complete
|
|
11
|
+
AcceptCommandRecorded --> Completed: Reject
|
|
12
|
+
Completed -[#blue]-> CompletedCommandCreated: CommandProtocolMessage
|
|
13
|
+
CompletedCommandCreated -[#blue]-> CompletedCommandRecorded: WorkflowExecutionUpdateCompleted
|
|
14
|
+
CompletedImmediately -[#blue]-> CompletedImmediatelyAcceptCreated: CommandProtocolMessage
|
|
15
|
+
CompletedImmediatelyAcceptCreated -[#blue]-> CompletedImmediatelyCompleteCreated: CommandProtocolMessage
|
|
16
|
+
CompletedImmediatelyCompleteCreated -[#blue]-> CompletedCommandCreated: WorkflowExecutionUpdateAccepted
|
|
17
|
+
Rejected --> [*]
|
|
18
|
+
CompletedCommandRecorded --> [*]
|
|
19
|
+
@enduml
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
Created -[#blue]-> Scheduled: WorkflowTaskScheduled
|
|
3
|
+
Scheduled -[#blue]-> Started: WorkflowTaskStarted
|
|
4
|
+
Scheduled --> TimedOut: WorkflowTaskTimedOut
|
|
5
|
+
Started -[#blue]-> Completed: WorkflowTaskCompleted
|
|
6
|
+
Started -[#blue]-> Failed: WorkflowTaskFailed
|
|
7
|
+
Started -[#blue]-> TimedOut: WorkflowTaskTimedOut
|
|
8
|
+
TimedOut --> [*]
|
|
9
|
+
Completed --> [*]
|
|
10
|
+
Failed --> [*]
|
|
11
|
+
@enduml
|
|
@@ -10,7 +10,7 @@ use std::{
|
|
|
10
10
|
atomic::{AtomicBool, AtomicUsize, Ordering},
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
-
use
|
|
13
|
+
use temporalio_common::{
|
|
14
14
|
telemetry::metrics::TemporalMeter,
|
|
15
15
|
worker::{
|
|
16
16
|
SlotKind, SlotMarkUsedContext, SlotReleaseContext, SlotReservationContext, SlotSupplier,
|
|
@@ -25,6 +25,7 @@ use tokio_util::sync::CancellationToken;
|
|
|
25
25
|
#[derive(Clone)]
|
|
26
26
|
pub(crate) struct MeteredPermitDealer<SK: SlotKind> {
|
|
27
27
|
supplier: Arc<dyn SlotSupplier<SlotKind = SK> + Send + Sync>,
|
|
28
|
+
slot_supplier_kind: SlotSupplierKind,
|
|
28
29
|
/// The number of permit owners who have acquired a permit, but are not yet meaningfully using
|
|
29
30
|
/// that permit. This is useful for giving a more semantically accurate count of used task
|
|
30
31
|
/// slots, since we typically wait for a permit first before polling, but that slot isn't used
|
|
@@ -54,6 +55,35 @@ pub(crate) struct PermitDealerContextData {
|
|
|
54
55
|
pub(crate) worker_deployment_version: Option<WorkerDeploymentVersion>,
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
59
|
+
pub(crate) enum SlotSupplierKind {
|
|
60
|
+
Fixed,
|
|
61
|
+
ResourceBased,
|
|
62
|
+
Custom(String),
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
impl SlotSupplierKind {
|
|
66
|
+
fn from_label(label: &str) -> Self {
|
|
67
|
+
if label == "Fixed" {
|
|
68
|
+
SlotSupplierKind::Fixed
|
|
69
|
+
} else if label == "ResourceBased" {
|
|
70
|
+
SlotSupplierKind::ResourceBased
|
|
71
|
+
} else {
|
|
72
|
+
SlotSupplierKind::Custom(label.to_string())
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
impl std::fmt::Display for SlotSupplierKind {
|
|
78
|
+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
79
|
+
match self {
|
|
80
|
+
SlotSupplierKind::Fixed => f.write_str("Fixed"),
|
|
81
|
+
SlotSupplierKind::ResourceBased => f.write_str("ResourceBased"),
|
|
82
|
+
SlotSupplierKind::Custom(name) => f.write_str(name.as_str()),
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
57
87
|
impl<SK> MeteredPermitDealer<SK>
|
|
58
88
|
where
|
|
59
89
|
SK: SlotKind + 'static,
|
|
@@ -65,8 +95,11 @@ where
|
|
|
65
95
|
context_data: Arc<PermitDealerContextData>,
|
|
66
96
|
meter: Option<TemporalMeter>,
|
|
67
97
|
) -> Self {
|
|
98
|
+
let supplier_kind_label = supplier.slot_supplier_kind();
|
|
99
|
+
let slot_supplier_kind = SlotSupplierKind::from_label(supplier_kind_label.as_ref());
|
|
68
100
|
Self {
|
|
69
101
|
supplier,
|
|
102
|
+
slot_supplier_kind,
|
|
70
103
|
unused_claimants: Arc::new(AtomicUsize::new(0)),
|
|
71
104
|
extant_permits: watch::channel(0),
|
|
72
105
|
metrics_ctx,
|
|
@@ -81,6 +114,10 @@ where
|
|
|
81
114
|
self.supplier.available_slots()
|
|
82
115
|
}
|
|
83
116
|
|
|
117
|
+
pub(crate) fn slot_supplier_kind(&self) -> &SlotSupplierKind {
|
|
118
|
+
&self.slot_supplier_kind
|
|
119
|
+
}
|
|
120
|
+
|
|
84
121
|
#[cfg(test)]
|
|
85
122
|
pub(crate) fn unused_permits(&self) -> Option<usize> {
|
|
86
123
|
self.available_permits()
|
|
@@ -386,10 +423,23 @@ impl<SK: SlotKind> OwnedMeteredSemPermit<SK> {
|
|
|
386
423
|
pub(crate) struct UsedMeteredSemPermit<SK: SlotKind>(#[allow(dead_code)] OwnedMeteredSemPermit<SK>);
|
|
387
424
|
|
|
388
425
|
macro_rules! dbg_panic {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
426
|
+
($($arg:tt)*) => {{
|
|
427
|
+
let message = format!($($arg)*);
|
|
428
|
+
error!("{}", message);
|
|
429
|
+
|
|
430
|
+
#[cfg(feature = "antithesis_assertions")]
|
|
431
|
+
crate::antithesis::assert_always!(
|
|
432
|
+
false,
|
|
433
|
+
"dbg_panic invariant triggered",
|
|
434
|
+
::serde_json::json!({
|
|
435
|
+
"message": message,
|
|
436
|
+
"file": file!(),
|
|
437
|
+
"line": line!(),
|
|
438
|
+
"module": module_path!(),
|
|
439
|
+
})
|
|
440
|
+
);
|
|
441
|
+
debug_assert!(false, "{}", message);
|
|
442
|
+
}};
|
|
393
443
|
}
|
|
394
444
|
pub(crate) use dbg_panic;
|
|
395
445
|
|
|
@@ -427,7 +477,7 @@ pub(crate) mod tests {
|
|
|
427
477
|
use super::*;
|
|
428
478
|
use crate::{advance_fut, worker::tuner::FixedSizeSlotSupplier};
|
|
429
479
|
use futures_util::FutureExt;
|
|
430
|
-
use
|
|
480
|
+
use temporalio_common::worker::WorkflowSlotKind;
|
|
431
481
|
|
|
432
482
|
pub(crate) fn fixed_size_permit_dealer<SK: SlotKind + Send + Sync + 'static>(
|
|
433
483
|
size: usize,
|
|
@@ -492,4 +542,10 @@ pub(crate) mod tests {
|
|
|
492
542
|
// Now it'll proceed
|
|
493
543
|
acquire_fut.await;
|
|
494
544
|
}
|
|
545
|
+
|
|
546
|
+
#[test]
|
|
547
|
+
fn captures_slot_supplier_kind() {
|
|
548
|
+
let dealer = fixed_size_permit_dealer::<WorkflowSlotKind>(1);
|
|
549
|
+
assert_eq!(*dealer.slot_supplier_kind(), SlotSupplierKind::Fixed);
|
|
550
|
+
}
|
|
495
551
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//! Antithesis SDK integration for invariant testing.
|
|
2
|
+
//!
|
|
3
|
+
//! This module provides assertion macros that integrate with the Antithesis
|
|
4
|
+
//! testing platform to detect invariant violations during fuzz testing.
|
|
5
|
+
|
|
6
|
+
use std::sync::OnceLock;
|
|
7
|
+
|
|
8
|
+
/// Ensure Antithesis is initialized exactly once.
|
|
9
|
+
pub(crate) fn ensure_init() {
|
|
10
|
+
static INIT: OnceLock<()> = OnceLock::new();
|
|
11
|
+
INIT.get_or_init(|| {
|
|
12
|
+
::antithesis_sdk::antithesis_init();
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/// Assert that a condition is always true during Antithesis fuzz testing.
|
|
17
|
+
/// Use `false` as the condition to log an invariant violation.
|
|
18
|
+
macro_rules! assert_always {
|
|
19
|
+
($condition:expr, $message:literal, $details:expr) => {{
|
|
20
|
+
$crate::antithesis::ensure_init();
|
|
21
|
+
let details: ::serde_json::Value = $details;
|
|
22
|
+
::antithesis_sdk::assert_always!($condition, $message, &details);
|
|
23
|
+
}};
|
|
24
|
+
($condition:expr, $message:literal) => {{
|
|
25
|
+
$crate::antithesis::ensure_init();
|
|
26
|
+
::antithesis_sdk::assert_always!($condition, $message);
|
|
27
|
+
}};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// Assert that a condition is sometimes true during Antithesis fuzz testing.
|
|
31
|
+
/// This checks that the condition occurs at least once across the entire test session.
|
|
32
|
+
macro_rules! assert_sometimes {
|
|
33
|
+
($condition:expr, $message:literal, $details:expr) => {{
|
|
34
|
+
$crate::antithesis::ensure_init();
|
|
35
|
+
let details: ::serde_json::Value = $details;
|
|
36
|
+
::antithesis_sdk::assert_sometimes!($condition, $message, &details);
|
|
37
|
+
}};
|
|
38
|
+
($condition:expr, $message:literal) => {{
|
|
39
|
+
$crate::antithesis::ensure_init();
|
|
40
|
+
::antithesis_sdk::assert_sometimes!($condition, $message);
|
|
41
|
+
}};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// Assert that a code location is unreachable during Antithesis fuzz testing.
|
|
45
|
+
/// Use this for code paths that should never be reached (bugs, invariant violations).
|
|
46
|
+
macro_rules! assert_unreachable {
|
|
47
|
+
($message:literal, $details:expr) => {{
|
|
48
|
+
$crate::antithesis::ensure_init();
|
|
49
|
+
let details: ::serde_json::Value = $details;
|
|
50
|
+
::antithesis_sdk::assert_unreachable!($message, &details);
|
|
51
|
+
}};
|
|
52
|
+
($message:literal) => {{
|
|
53
|
+
$crate::antithesis::ensure_init();
|
|
54
|
+
::antithesis_sdk::assert_unreachable!($message);
|
|
55
|
+
}};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
pub(crate) use assert_always;
|
|
59
|
+
pub(crate) use assert_sometimes;
|
|
60
|
+
pub(crate) use assert_unreachable;
|