Skip to content

Commit bd02cce

Browse files
feat: add last_sdk_version to workflow activation (#1040)
1 parent 561ca79 commit bd02cce

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

core/src/internal_flags.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@ impl InternalFlags {
203203
Self::Disabled => Either::Right(iter::empty()),
204204
}
205205
}
206+
207+
pub(crate) fn last_sdk_version(&self) -> Option<&str> {
208+
match self {
209+
InternalFlags::Enabled {
210+
last_sdk_version, ..
211+
} if !last_sdk_version.is_empty() => Some(last_sdk_version),
212+
InternalFlags::Enabled { .. } | InternalFlags::Disabled => None,
213+
}
214+
}
206215
}
207216

208217
impl CoreInternalFlags {

core/src/worker/workflow/machines/workflow_machines.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,11 @@ impl WorkflowMachines {
463463
continue_as_new_suggested: self.continue_as_new_suggested,
464464
deployment_version_for_current_task: deployment_version_for_current_task
465465
.map(Into::into),
466+
last_sdk_version: (*self.observed_internal_flags)
467+
.borrow()
468+
.last_sdk_version()
469+
.unwrap_or_default()
470+
.to_owned(),
466471
}
467472
}
468473

sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ message WorkflowActivation {
9292
// build id, if this worker was using the deprecated Build ID-only
9393
// feature(s).
9494
common.WorkerDeploymentVersion deployment_version_for_current_task = 9;
95+
// The last seen SDK version from the most recent WFT completed event
96+
string last_sdk_version = 10;
9597
}
9698

9799
message WorkflowActivationJob {

sdk-core-protos/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ pub mod coresdk {
519519
history_size_bytes: 0,
520520
continue_as_new_suggested: false,
521521
deployment_version_for_current_task: None,
522+
last_sdk_version: String::new(),
522523
}
523524
}
524525

0 commit comments

Comments
 (0)