Skip to content

💥 filter nil values from SearchAttributes for workflow start and continue-as-new#2274

Draft
eamsden wants to merge 1 commit intomainfrom
eamsden/dont-send-null-search-attribute
Draft

💥 filter nil values from SearchAttributes for workflow start and continue-as-new#2274
eamsden wants to merge 1 commit intomainfrom
eamsden/dont-send-null-search-attribute

Conversation

@eamsden
Copy link
Copy Markdown

@eamsden eamsden commented Apr 7, 2026

What was changed

💥 Start-like requests now omit unset search attributes instead of sending binary/null payloads in SearchAttributes.

Added sanitizeSearchAttributesForStart and applied it to:

  • workflow start serialization
  • continue-as-new requests
  • workflow test environment start setup

Also added regression coverage to verify that:

  • nil / MetadataEncodingNil search attributes are removed from start requests
  • non-nil payloads that happen to have Data == nil (for example []byte(nil) encoded as binary/plain) are preserved
  • continue-as-new no longer carries over a search attribute after it has been unset

Why?

Unset search attributes are represented in workflow state as nil payloads so upserts can remove them, but start-like requests should not resend those unset values.

Without this change, a workflow that unset a search attribute and then continued as new could carry that removed attribute forward incorrectly. The sanitization is intentionally keyed to MetadataEncodingNil so we only drop true nil payloads and do not accidentally strip other payloads that may have Data == nil.

💥 Behavior change details

  • Workflow start and signal-with-start requests now omit search attributes encoded as MetadataEncodingNil (binary/null) instead of sending them to the server.
  • Continue-as-new now applies the same sanitization, so a search attribute removed in the current run is not carried into the next run.
  • The filtering is based on payload encoding, not payload.Data == nil, so values like []byte(nil) encoded as binary/plain are still sent.
  • The workflow test environment start helpers now mirror this behavior so tests match production request construction.

Checklist

  1. Closes Stop sending null search attribute values on workflow start and continue as new #2150

  2. How was this tested:
    Added/updated tests in:

  • internal/internal_workflow_client_test.go
  • test/integration_test.go
  • test/workflow_test.go

Ran:

go test ./internal -run 'TestWorkflowClientSuite/(TestStartWorkflowWithMemoAndSearchAttr|TestSignalWithStartWorkflowWithMemoAndSearchAttr|TestSerializeSearchAttributesOmitsNilValuesOnStart)$'

The broader integration suite was not run in this session.

  1. Any docs updates needed?
    No.

@eamsden eamsden requested a review from a team as a code owner April 7, 2026 21:25
@eamsden eamsden marked this pull request as draft April 7, 2026 21:26
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.

Stop sending null search attribute values on workflow start and continue as new

2 participants