Skip to content

Commit 2dad3d4

Browse files
authored
feat: Delete search attributes with empty array values in describe() response (#878)
1 parent 966d51d commit 2dad3d4

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
with:
4646
repository: temporalio/docker-compose
4747
path: docker-compose
48-
ref: v1.17.5 # TODO: Upgrade to 1.18 - has a bug where search attributes are not deleted
4948
if: ${{ startsWith(matrix.os, 'ubuntu') }}
5049

5150
- name: Start Temporal Server

packages/client/src/workflow-client.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,10 +877,14 @@ export class WorkflowClient {
877877
executionTime: optionalTsToDate(raw.workflowExecutionInfo!.executionTime),
878878
closeTime: optionalTsToDate(raw.workflowExecutionInfo!.closeTime),
879879
memo: await decodeMapFromPayloads(this.client.dataConverter, raw.workflowExecutionInfo!.memo?.fields),
880-
searchAttributes: mapFromPayloads(
881-
searchAttributePayloadConverter,
882-
raw.workflowExecutionInfo!.searchAttributes?.indexedFields ?? {}
883-
) as SearchAttributes,
880+
searchAttributes: Object.fromEntries(
881+
Object.entries(
882+
mapFromPayloads(
883+
searchAttributePayloadConverter,
884+
raw.workflowExecutionInfo!.searchAttributes?.indexedFields ?? {}
885+
) as SearchAttributes
886+
).filter(([_, v]) => v && v.length > 0) // Filter out empty arrays returned by pre 1.18 servers
887+
),
884888
parentExecution: raw.workflowExecutionInfo?.parentExecution
885889
? {
886890
workflowId: raw.workflowExecutionInfo.parentExecution.workflowId!,

packages/test/src/integration-tests.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,6 @@ export function runIntegrationTests(codec?: PayloadCodec): void {
668668
const { BinaryChecksums, ...rest } = searchAttributes;
669669
t.deepEqual(rest, {
670670
CustomBoolField: [true],
671-
CustomIntField: [], // clear
672671
CustomKeywordField: ['durable code'],
673672
CustomTextField: ['is useful'],
674673
CustomDatetimeField: [date],

0 commit comments

Comments
 (0)