@temporalio/core-bridge 1.5.2 → 1.6.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 +255 -48
- package/package.json +4 -4
- 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/.buildkite/pipeline.yml +1 -3
- package/sdk-core/.cargo/config.toml +5 -2
- package/sdk-core/.github/workflows/heavy.yml +28 -0
- package/sdk-core/Cargo.toml +1 -1
- package/sdk-core/README.md +9 -5
- package/sdk-core/client/src/lib.rs +211 -36
- package/sdk-core/client/src/raw.rs +1 -1
- package/sdk-core/client/src/retry.rs +32 -20
- package/sdk-core/core/Cargo.toml +23 -9
- package/sdk-core/core/src/abstractions.rs +11 -0
- package/sdk-core/core/src/core_tests/activity_tasks.rs +6 -5
- package/sdk-core/core/src/core_tests/local_activities.rs +263 -22
- package/sdk-core/core/src/core_tests/queries.rs +2 -2
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +249 -5
- package/sdk-core/core/src/ephemeral_server/mod.rs +5 -6
- package/sdk-core/core/src/lib.rs +2 -0
- package/sdk-core/core/src/protosext/mod.rs +1 -1
- package/sdk-core/core/src/telemetry/log_export.rs +1 -1
- package/sdk-core/core/src/telemetry/mod.rs +23 -8
- package/sdk-core/core/src/test_help/mod.rs +8 -1
- package/sdk-core/core/src/worker/activities/local_activities.rs +259 -125
- package/sdk-core/core/src/worker/activities.rs +3 -2
- package/sdk-core/core/src/worker/mod.rs +53 -26
- package/sdk-core/core/src/worker/workflow/bridge.rs +1 -3
- package/sdk-core/core/src/worker/workflow/driven_workflow.rs +3 -5
- package/sdk-core/core/src/worker/workflow/history_update.rs +835 -277
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +9 -17
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +3 -5
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +3 -5
- package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +73 -51
- package/sdk-core/core/src/worker/workflow/machines/mod.rs +3 -3
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +4 -4
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +3 -5
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +6 -7
- package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +2 -2
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +4 -4
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +6 -17
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +89 -58
- package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +4 -7
- package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +21 -9
- package/sdk-core/core/src/worker/workflow/managed_run.rs +1021 -360
- package/sdk-core/core/src/worker/workflow/mod.rs +306 -346
- package/sdk-core/core/src/worker/workflow/run_cache.rs +29 -53
- package/sdk-core/core/src/worker/workflow/wft_extraction.rs +125 -0
- package/sdk-core/core/src/worker/workflow/wft_poller.rs +1 -4
- package/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +115 -0
- package/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +24 -0
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +444 -714
- package/sdk-core/core-api/Cargo.toml +2 -0
- package/sdk-core/core-api/src/errors.rs +1 -34
- package/sdk-core/core-api/src/lib.rs +6 -2
- package/sdk-core/core-api/src/worker.rs +14 -1
- package/sdk-core/etc/deps.svg +115 -140
- package/sdk-core/etc/regen-depgraph.sh +5 -0
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +6 -6
- package/sdk-core/fsm/rustfsm_trait/src/lib.rs +7 -3
- package/sdk-core/histories/evict_while_la_running_no_interference-16_history.bin +0 -0
- package/sdk-core/protos/api_upstream/Makefile +5 -5
- package/sdk-core/protos/api_upstream/build/go.mod +7 -0
- package/sdk-core/protos/api_upstream/build/go.sum +5 -0
- package/sdk-core/protos/api_upstream/build/tools.go +29 -0
- package/sdk-core/protos/api_upstream/go.mod +6 -0
- package/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +9 -2
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +12 -19
- package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +3 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +3 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +3 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +3 -3
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +20 -2
- package/sdk-core/protos/api_upstream/temporal/api/{update/v1/message.proto → enums/v1/interaction_type.proto} +11 -18
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +2 -13
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +13 -19
- package/sdk-core/protos/api_upstream/temporal/api/interaction/v1/message.proto +87 -0
- package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +13 -8
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +2 -2
- package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +2 -0
- package/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +2 -2
- package/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +2 -2
- package/sdk-core/sdk/Cargo.toml +4 -3
- package/sdk-core/sdk/src/lib.rs +87 -21
- package/sdk-core/sdk/src/workflow_future.rs +7 -12
- package/sdk-core/sdk-core-protos/Cargo.toml +5 -2
- package/sdk-core/sdk-core-protos/build.rs +36 -2
- package/sdk-core/sdk-core-protos/src/history_builder.rs +26 -19
- package/sdk-core/sdk-core-protos/src/history_info.rs +4 -0
- package/sdk-core/sdk-core-protos/src/lib.rs +78 -34
- package/sdk-core/sdk-core-protos/src/task_token.rs +12 -2
- package/sdk-core/test-utils/Cargo.toml +3 -1
- package/sdk-core/test-utils/src/histfetch.rs +1 -1
- package/sdk-core/test-utils/src/lib.rs +50 -18
- package/sdk-core/test-utils/src/wf_input_saver.rs +50 -0
- package/sdk-core/test-utils/src/workflows.rs +29 -0
- package/sdk-core/tests/fuzzy_workflow.rs +130 -0
- package/sdk-core/tests/{load_tests.rs → heavy_tests.rs} +114 -7
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +5 -2
- package/sdk-core/tests/integ_tests/metrics_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/polling_tests.rs +1 -39
- package/sdk-core/tests/integ_tests/queries_tests.rs +2 -127
- package/sdk-core/tests/integ_tests/visibility_tests.rs +52 -5
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +74 -1
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +5 -13
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +2 -10
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +69 -197
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +4 -28
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +12 -7
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +14 -14
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +3 -19
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +3 -19
- package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests.rs +5 -6
- package/sdk-core/tests/main.rs +2 -12
- package/sdk-core/tests/runner.rs +71 -34
- package/sdk-core/tests/wf_input_replay.rs +32 -0
- package/sdk-core/bridge-ffi/Cargo.toml +0 -24
- package/sdk-core/bridge-ffi/LICENSE.txt +0 -23
- package/sdk-core/bridge-ffi/build.rs +0 -25
- package/sdk-core/bridge-ffi/include/sdk-core-bridge.h +0 -224
- package/sdk-core/bridge-ffi/src/lib.rs +0 -746
- package/sdk-core/bridge-ffi/src/wrappers.rs +0 -221
- package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +0 -210
- package/sdk-core/sdk/src/conversions.rs +0 -8
|
@@ -172,7 +172,7 @@ impl EphemeralServer {
|
|
|
172
172
|
.stdout(config.output)
|
|
173
173
|
.spawn()?;
|
|
174
174
|
let target = format!("127.0.0.1:{}", config.port);
|
|
175
|
-
let target_url = format!("http://{}"
|
|
175
|
+
let target_url = format!("http://{target}");
|
|
176
176
|
let success = Ok(EphemeralServer {
|
|
177
177
|
target,
|
|
178
178
|
has_test_service: config.has_test_service,
|
|
@@ -304,9 +304,9 @@ impl EphemeralExe {
|
|
|
304
304
|
EphemeralExeVersion::Default {
|
|
305
305
|
sdk_name,
|
|
306
306
|
sdk_version,
|
|
307
|
-
} => format!("{}-{}-{}{}"
|
|
307
|
+
} => format!("{artifact_name}-{sdk_name}-{sdk_version}{out_ext}"),
|
|
308
308
|
EphemeralExeVersion::Fixed(version) => {
|
|
309
|
-
format!("{}-{}{}"
|
|
309
|
+
format!("{artifact_name}-{version}{out_ext}")
|
|
310
310
|
}
|
|
311
311
|
});
|
|
312
312
|
debug!(
|
|
@@ -340,8 +340,7 @@ impl EphemeralExe {
|
|
|
340
340
|
let client = reqwest::Client::new();
|
|
341
341
|
let info: DownloadInfo = client
|
|
342
342
|
.get(format!(
|
|
343
|
-
"https://temporal.download/{}/{}"
|
|
344
|
-
artifact_name, version_name
|
|
343
|
+
"https://temporal.download/{artifact_name}/{version_name}"
|
|
345
344
|
))
|
|
346
345
|
.query(&get_info_params)
|
|
347
346
|
.send()
|
|
@@ -371,7 +370,7 @@ impl EphemeralExe {
|
|
|
371
370
|
fn get_free_port(bind_ip: &str) -> u16 {
|
|
372
371
|
// Can just ask OS to give us a port then close socket. OS's don't give that
|
|
373
372
|
// port back to anyone else anytime soon.
|
|
374
|
-
std::net::TcpListener::bind(format!("{}:0"
|
|
373
|
+
std::net::TcpListener::bind(format!("{bind_ip}:0"))
|
|
375
374
|
.unwrap()
|
|
376
375
|
.local_addr()
|
|
377
376
|
.unwrap()
|
package/sdk-core/core/src/lib.rs
CHANGED
|
@@ -36,6 +36,8 @@ pub use temporal_sdk_core_api as api;
|
|
|
36
36
|
pub use temporal_sdk_core_protos as protos;
|
|
37
37
|
pub use temporal_sdk_core_protos::TaskToken;
|
|
38
38
|
pub use url::Url;
|
|
39
|
+
#[cfg(feature = "save_wf_inputs")]
|
|
40
|
+
pub use worker::replay_wf_state_inputs;
|
|
39
41
|
pub use worker::{Worker, WorkerConfig, WorkerConfigBuilder};
|
|
40
42
|
|
|
41
43
|
use crate::{
|
|
@@ -274,7 +274,7 @@ impl TryFrom<activity_execution_result::Status> for LocalActivityExecutionResult
|
|
|
274
274
|
Status::Failed(f)
|
|
275
275
|
if f.failure
|
|
276
276
|
.as_ref()
|
|
277
|
-
.map(|fail| fail.is_timeout())
|
|
277
|
+
.map(|fail| fail.is_timeout().is_some())
|
|
278
278
|
.unwrap_or_default() =>
|
|
279
279
|
{
|
|
280
280
|
Ok(LocalActivityExecutionResult::TimedOut(f))
|
|
@@ -139,7 +139,7 @@ impl<'a> tracing::field::Visit for JsonVisitor<'a> {
|
|
|
139
139
|
fn record_debug(&mut self, field: &tracing::field::Field, value: &dyn std::fmt::Debug) {
|
|
140
140
|
self.0.insert(
|
|
141
141
|
field.name().to_string(),
|
|
142
|
-
serde_json::json!(format!("{:?}"
|
|
142
|
+
serde_json::json!(format!("{value:?}")),
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -25,7 +25,17 @@ use opentelemetry::{
|
|
|
25
25
|
};
|
|
26
26
|
use opentelemetry_otlp::WithExportConfig;
|
|
27
27
|
use parking_lot::Mutex;
|
|
28
|
-
use std::{
|
|
28
|
+
use std::{
|
|
29
|
+
cell::RefCell,
|
|
30
|
+
collections::VecDeque,
|
|
31
|
+
convert::TryInto,
|
|
32
|
+
env,
|
|
33
|
+
sync::{
|
|
34
|
+
atomic::{AtomicBool, Ordering},
|
|
35
|
+
Arc,
|
|
36
|
+
},
|
|
37
|
+
time::Duration,
|
|
38
|
+
};
|
|
29
39
|
use temporal_sdk_core_api::telemetry::{
|
|
30
40
|
CoreLog, CoreTelemetry, Logger, MetricTemporality, MetricsExporter, OtelCollectorOptions,
|
|
31
41
|
TelemetryOptions, TraceExporter,
|
|
@@ -37,12 +47,10 @@ use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Layer};
|
|
|
37
47
|
const TELEM_SERVICE_NAME: &str = "temporal-core-sdk";
|
|
38
48
|
|
|
39
49
|
/// Help you construct an [EnvFilter] compatible filter string which will forward all core module
|
|
40
|
-
/// traces at `core_level` and all others (from 3rd party modules, etc) at `
|
|
50
|
+
/// traces at `core_level` and all others (from 3rd party modules, etc) at `other_level`.
|
|
41
51
|
pub fn construct_filter_string(core_level: Level, other_level: Level) -> String {
|
|
42
52
|
format!(
|
|
43
|
-
"{
|
|
44
|
-
o = other_level,
|
|
45
|
-
l = core_level
|
|
53
|
+
"{other_level},temporal_sdk_core={core_level},temporal_client={core_level},temporal_sdk={core_level}"
|
|
46
54
|
)
|
|
47
55
|
}
|
|
48
56
|
|
|
@@ -295,10 +303,17 @@ pub fn telemetry_init(opts: TelemetryOptions) -> Result<TelemetryInstance, anyho
|
|
|
295
303
|
}
|
|
296
304
|
}
|
|
297
305
|
|
|
298
|
-
/// Initialize telemetry/tracing globally. Useful for testing.
|
|
306
|
+
/// Initialize telemetry/tracing globally. Useful for testing. Only takes affect when called
|
|
307
|
+
/// the first time. Subsequent calls are ignored.
|
|
299
308
|
pub fn telemetry_init_global(opts: TelemetryOptions) -> Result<(), anyhow::Error> {
|
|
300
|
-
|
|
301
|
-
|
|
309
|
+
static INITTED: AtomicBool = AtomicBool::new(false);
|
|
310
|
+
if INITTED
|
|
311
|
+
.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed)
|
|
312
|
+
.is_ok()
|
|
313
|
+
{
|
|
314
|
+
let ti = telemetry_init(opts)?;
|
|
315
|
+
tracing::subscriber::set_global_default(ti.trace_subscriber())?;
|
|
316
|
+
}
|
|
302
317
|
Ok(())
|
|
303
318
|
}
|
|
304
319
|
|
|
@@ -379,6 +379,7 @@ pub(crate) struct MockPollCfg {
|
|
|
379
379
|
/// early with no work, since we cannot know the exact number of times polling will happen.
|
|
380
380
|
/// Instead, they will just block forever.
|
|
381
381
|
pub using_rust_sdk: bool,
|
|
382
|
+
pub make_poll_stream_interminable: bool,
|
|
382
383
|
}
|
|
383
384
|
|
|
384
385
|
impl MockPollCfg {
|
|
@@ -396,6 +397,7 @@ impl MockPollCfg {
|
|
|
396
397
|
expect_fail_wft_matcher: Box::new(|_, _, _| true),
|
|
397
398
|
completion_asserts: None,
|
|
398
399
|
using_rust_sdk: false,
|
|
400
|
+
make_poll_stream_interminable: false,
|
|
399
401
|
}
|
|
400
402
|
}
|
|
401
403
|
pub fn from_resp_batches(
|
|
@@ -417,6 +419,7 @@ impl MockPollCfg {
|
|
|
417
419
|
expect_fail_wft_matcher: Box::new(|_, _, _| true),
|
|
418
420
|
completion_asserts: None,
|
|
419
421
|
using_rust_sdk: false,
|
|
422
|
+
make_poll_stream_interminable: false,
|
|
420
423
|
}
|
|
421
424
|
}
|
|
422
425
|
}
|
|
@@ -612,11 +615,15 @@ pub(crate) fn build_mock_pollers(mut cfg: MockPollCfg) -> MocksHolder {
|
|
|
612
615
|
Ok(Default::default())
|
|
613
616
|
});
|
|
614
617
|
|
|
615
|
-
MocksHolder {
|
|
618
|
+
let mut mh = MocksHolder {
|
|
616
619
|
client: Arc::new(cfg.mock_client),
|
|
617
620
|
inputs: mock_worker,
|
|
618
621
|
outstanding_task_map: Some(outstanding_wf_task_tokens),
|
|
622
|
+
};
|
|
623
|
+
if cfg.make_poll_stream_interminable {
|
|
624
|
+
mh.make_wft_stream_interminable();
|
|
619
625
|
}
|
|
626
|
+
mh
|
|
620
627
|
}
|
|
621
628
|
|
|
622
629
|
pub struct QueueResponse<T> {
|