Skip to content

Conversation

@ShahabT
Copy link
Contributor

@ShahabT ShahabT commented Dec 20, 2025

What changed?

Add TemporalUsedWorkerDeploymentVersions search attribute to contain all the Deployment Versions that completed at least one workflow tasks for the execution.

This Search Attribute replaces, now deprecated, BuildIds Search attribute.

Why?

Needed a replacement for BuildIds Search attribute which holds internal values and prefixes.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

None.

Copy link
Contributor

@carlydf carlydf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't review the tests yet, but this looks good so far! I really appreciate you taking it on.

TemporalWorkerDeployment: enumspb.INDEXED_VALUE_TYPE_KEYWORD,
TemporalChangeVersion: enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST,
BinaryChecksums: enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST,
BuildIds: enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to comment BuildIds as deprecated at this time, or are you saving that for later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. will do. for all intents and purposes BuildIds will be considered deprecated after this change.

limit := ms.config.SearchAttributesSizeOfValueLimit(string(ms.namespaceEntry.Name()))
if _, err := ms.addBuildIdAndDeploymentInfoToSearchAttributesWithNoVisibilityTask(event.SourceVersionStamp, limit); err != nil {
// Passing nil for usedVersion because starting with pinned override does not add the version to used versions SA until the version is actally used.
if _, err := ms.addBuildIdAndDeploymentInfoToSearchAttributesWithNoVisibilityTask(event.SourceVersionStamp, nil, limit); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, so we update the SAs for version, behavior, and deployment name on task started (and on successful set-override), but only update used-versions on task completed?

makes sense

// This is also useful for unversioned workers.
// For v1 and v2 versioned workflows the search attributes should be already up-to-date based on the task started events.
if err := m.ms.updateBuildIdsAndDeploymentSearchAttributes(attrs.GetWorkerVersion(), limits.MaxSearchAttributeValueSize); err != nil {
if err := m.ms.updateBuildIdsAndDeploymentSearchAttributes(attrs.GetWorkerVersion(), worker_versioning.ExternalWorkerDeploymentVersionFromDeployment(wftDeployment), limits.MaxSearchAttributeValueSize); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we could just pass attrs.GetDeploymentVersion() instead of wftDeployment here, but I suppose wftDeployment is correct for older SDKs that are sending deprecated attrs.GetDeployment() or deprecated attrs.GetWorkerDeploymentVersion() values?

As a follow-up: Should we be passing a form of wftDeployment as the first parameter instead of attrs.GetWorkerVersion()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I thought about that too. but I decided against using deprecated types for new args. but I think we're close to getting rid of all the v0.3.0-0.3.1 types. in next Go SDK and CLI we should completely get rid of them (by GA) and then we can remove them from server.

@ShahabT ShahabT marked this pull request as ready for review January 4, 2026 03:21
@ShahabT ShahabT requested review from a team as code owners January 4, 2026 03:21
@ShahabT ShahabT requested a review from rodrigozhou January 4, 2026 05:11
@ShahabT ShahabT enabled auto-merge (squash) January 4, 2026 05:28
Comment on lines +2901 to +2909
if event.GetInheritedAutoUpgradeInfo() != nil {
ms.SetVersioningRevisionNumber(event.GetInheritedAutoUpgradeInfo().GetSourceDeploymentRevisionNumber())
// TODO (Shivam): Remove this once you make SetDeploymentVersion and SetVersioningBehavior methods with nil checks
if ms.executionInfo.VersioningInfo == nil {
ms.executionInfo.VersioningInfo = &workflowpb.WorkflowExecutionVersioningInfo{}
}
ms.executionInfo.VersioningInfo.DeploymentVersion = event.GetInheritedAutoUpgradeInfo().GetSourceDeploymentVersion()
// Assume AutoUpgrade behavior for the first workflow task.
ms.executionInfo.VersioningInfo.Behavior = enumspb.VERSIONING_BEHAVIOR_AUTO_UPGRADE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm slightly confused - any specific reason of moving this to the top compared to where it was before?

Comment on lines 3422 to 3424
// Sets TemporalWorkerDeployment to the override DeploymentName if present, or`ms.executionInfo.WorkerDeploymentName`.
// Sets TemporalWorkerDeploymentVersion to the override PinnedVersion if present, or `ms.executionInfo.VersioningInfo.Version`.
// Sets TemporalWorkflowVersioningBehavior to the override Behavior if present, or `ms.executionInfo.VersioningInfo.Behavior` if specified.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could update comment here because we are now adding a new SA

Comment on lines +3664 to +3673
if deployment == "" {
saPayloads[sadefs.TemporalWorkerDeployment] = nil
} else {
deploymentPayload, err := searchattribute.EncodeValue(deployment, enumspb.INDEXED_VALUE_TYPE_KEYWORD)
if err != nil {
return err
}
if len(deploymentPayload.GetData()) <= maxSearchAttributeValueSize { // we know the string won't really be over, but still check
saPayloads[sadefs.TemporalWorkerDeployment] = deploymentPayload
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: a lot of the code here seems to be following the pattern of setting the SA value to be nil if a passed arg is nil. If it's not, you encode it with the INDEXED_VALUE_TYPE_KEYWORD.

Could def make a helper function here for clarity

Copy link
Member

@Shivs11 Shivs11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small nits and one question - not blocking tho

@ShahabT ShahabT merged commit 882268c into main Jan 5, 2026
59 checks passed
@ShahabT ShahabT deleted the shahab/used-versions branch January 5, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants