Skip to content

Commit ad45085

Browse files
feat: add last_sdk_version to workflow activation
1 parent 5560b4a commit ad45085

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

crates/common/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 {

crates/common/src/protos/mod.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

crates/sdk-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 {

crates/sdk-core/src/worker/workflow/machines/workflow_machines.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,11 @@ impl WorkflowMachines {
465465
continue_as_new_suggested: self.continue_as_new_suggested,
466466
deployment_version_for_current_task: deployment_version_for_current_task
467467
.map(Into::into),
468+
last_sdk_version: (*self.observed_internal_flags)
469+
.borrow()
470+
.last_sdk_version()
471+
.unwrap_or_default()
472+
.to_owned(),
468473
}
469474
}
470475

0 commit comments

Comments
 (0)