Skip to content

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

Merged
eamsden merged 5 commits into
mainfrom
eamsden/dont-send-null-search-attribute
Jun 2, 2026
Merged

馃挜 filter nil values from SearchAttributes for workflow start and continue-as-new#2274
eamsden merged 5 commits into
mainfrom
eamsden/dont-send-null-search-attribute

Conversation

@eamsden

@eamsden eamsden commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

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
@eamsden
eamsden marked this pull request as ready for review May 22, 2026 20:59
@eamsden
eamsden force-pushed the eamsden/dont-send-null-search-attribute branch from b96f180 to 1b2f0fa Compare May 22, 2026 21:55
@eamsden

eamsden commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Please do not merge until @yuandrew can review

Comment thread internal/internal_search_attributes.go Outdated
@alexshtin

Copy link
Copy Markdown
Contributor

I faced this problem recently. Thanks for fixing it. Left you some minor comments.

Comment thread internal/internal_search_attributes.go Outdated
Comment thread internal/internal_search_attributes.go Outdated
Comment thread internal/internal_search_attributes.go Outdated
eamsden and others added 3 commits June 2, 2026 15:45
Co-authored-by: Alex Shtin <alex@temporal.io>
Co-authored-by: Alex Shtin <alex@temporal.io>
@eamsden
eamsden force-pushed the eamsden/dont-send-null-search-attribute branch from e2727cd to a814926 Compare June 2, 2026 20:45
eamsden and others added 2 commits June 2, 2026 15:51
without nil entry.

Co-authored-by: Alex Shtin <alex@temporal.io>
@eamsden
eamsden enabled auto-merge (squash) June 2, 2026 20:55
@eamsden
eamsden merged commit b5c3a62 into main Jun 2, 2026
63 of 64 checks passed
@eamsden
eamsden deleted the eamsden/dont-send-null-search-attribute branch June 2, 2026 21:31
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

4 participants