Skip to content

Remove nil search attributes from history events / mutable state / ch… - #9091

Merged
awln-temporal merged 11 commits into
mainfrom
remove-nil-search-attributes
Apr 1, 2026
Merged

awln-temporal merged 11 commits into
mainfrom
remove-nil-search-attributes

Conversation

@awln-temporal

Copy link
Copy Markdown
Contributor

What changed?

Remove nil search attributes from history events / mutable state / chasm node

Why?

Search attributes can be explicitly set as null on the following events:

  • Workflow Start

  • Upsert Search Attributes

  • Continue-as-new

Starting a workflow or continuing a workflow as new with a nil search attribute records the {key: nil} mapping in mutable state and the history event.

Upserting search attributes erases any current search attribute value from persistence (mutable state and visibility record).

Upserting the search attribute as nil in the SDK retains the mapping in the WorkflowInfo as a {key: nil} mapping. On a continue-as-new event, SDK sends this mapping to Server, and the search attribute gets repopulated with the null search attribute in the history event and mutable state.

This last scenario can cause inconsistency between the expected search attributes and what is recorded in history. After upserting a nil search attribute, the mutable state and visibility record no longer shows this search attribute. But, once continuing as new, the search attribute reappears, leading to unexpected NDE if the search attribute is also deregistered.

CHASM change

This also removes nil search attributes from CHASM nodes on replacement. This mirrors the change to Workflow History Events and Mutable State.

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)

@awln-temporal
awln-temporal requested review from a team as code owners January 21, 2026 00:42
@awln-temporal
awln-temporal requested a review from yycptt January 21, 2026 00:42
@awln-temporal
awln-temporal force-pushed the remove-nil-search-attributes branch from 4d9aa43 to f71cea1 Compare January 21, 2026 19:23
Comment thread chasm/visibility_test.go Resolved
Comment thread common/payload/payload.go Resolved
@awln-temporal
awln-temporal requested a review from cretz January 27, 2026 20:44
@awln-temporal
awln-temporal force-pushed the remove-nil-search-attributes branch from d75bf9d to f5d204a Compare January 27, 2026 22:05
Comment thread chasm/visibility.go Resolved
Comment thread chasm/visibility.go Resolved
@awln-temporal
awln-temporal force-pushed the remove-nil-search-attributes branch from 97f1346 to f5fc7dd Compare February 19, 2026 23:15
@awln-temporal
awln-temporal force-pushed the remove-nil-search-attributes branch from 6201cf4 to 409c692 Compare February 26, 2026 17:53
Comment on lines +486 to +489
// Filter nil values here rather than in the API layer because not all
// creation paths go through the frontend (continue-as-new, child workflows, replication).
Memo: payload.FilterNilMemo(command.Memo),
SearchAttributes: payload.FilterNilSearchAttributes(command.SearchAttributes),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This event is added to the source workflow. Please update the comment accordingly.

Comment on lines +855 to +858
// Filter nil values here rather than in the API layer because not all
// creation paths go through the frontend (continue-as-new, child workflows, replication).
Memo: payload.FilterNilMemo(command.Memo),
SearchAttributes: payload.FilterNilSearchAttributes(command.SearchAttributes),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto

@awln-temporal
awln-temporal requested a review from a team as a code owner March 25, 2026 21:11
@awln-temporal
awln-temporal requested a review from a team as a code owner March 26, 2026 18:46
@awln-temporal
awln-temporal merged commit 6d1c05c into main Apr 1, 2026
67 of 69 checks passed
@awln-temporal
awln-temporal deleted the remove-nil-search-attributes branch April 1, 2026 19:21
chaptersix pushed a commit that referenced this pull request Apr 2, 2026
#9091)

## What changed?
Remove nil search attributes from history events / mutable state / chasm
node

## Why?
Search attributes can be explicitly set as null on the following events:

* Workflow Start

* Upsert Search Attributes

* Continue-as-new

Starting a workflow or continuing a workflow as new with a nil search
attribute records the `{key: nil}` mapping in mutable state and the
history event.

Upserting search attributes erases any current search attribute value
from persistence (mutable state and visibility record).

Upserting the search attribute as nil in the SDK retains the mapping in
the WorkflowInfo as a {key: nil} mapping. On a continue-as-new event,
SDK sends this mapping to Server, and the search attribute gets
repopulated with the null search attribute in the history event and
mutable state.

This last scenario can cause inconsistency between the expected search
attributes and what is recorded in history. After upserting a nil search
attribute, the mutable state and visibility record no longer shows this
search attribute. But, once continuing as new, the search attribute
reappears, leading to unexpected NDE if the search attribute is also
deregistered.

## CHASM change
This also removes nil search attributes from CHASM nodes on replacement.
This mirrors the change to Workflow History Events and Mutable State.

## How did you test it?
- [X] built
- [X] run locally and tested manually
- [X] covered by existing tests
- [X] added new unit test(s)
- [X] added new functional test(s)
xepozz added a commit to temporalio/sdk-php that referenced this pull request Oct 21, 2026
#836)

Server 1.31 (temporalio/temporal#9091) drops an empty search attribute map
from the start event, so the child workflow gets null for [].
Run the tests on CLI 1.9 (Server 1.32).
xepozz added a commit to temporalio/sdk-php that referenced this pull request Oct 21, 2026
* test: accept null for empty search attributes on Temporal Server 1.31+

Server 1.31 (temporalio/temporal#9091) drops an empty search attribute map
from the start event, so the child workflow gets null for [].
Run the tests on CLI 1.9 (Server 1.32).

* feat: add WorkerOptions::$disablePayloadErrorLimit

The RoadRunner worker fails the Workflow Task with PAYLOADS_TOO_LARGE
when a payload exceeds the namespace limit. The option turns this check off.
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