Skip to content

Commit 6fe87ed

Browse files
committed
Drop the Buffer/Uint8Array injection workarounds
Both protobuf data converter features reached into the Node realm to overwrite a global inside the workflow sandbox: binary_protobuf replaced Uint8Array, and json_protobuf replaced Buffer. They date back to #286 and reference an unnamed SDK bug around how `bytes` fields cross the sandbox boundary. The SDK now normalizes protobufjs's `Buffer` allocations to `Uint8Array` when decoding, so neither injection is needed; both features pass without them.
1 parent 036113d commit 6fe87ed

2 files changed

Lines changed: 0 additions & 10 deletions

File tree

features/data_converter/binary_protobuf/feature.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ import * as assert from 'assert';
22
import { Feature } from '@temporalio/harness';
33
import * as proto from '@temporalio/proto';
44

5-
// Inject Buffer and Uint8Array from the node context to the workflow context to workaround SDK bug
6-
// TODO(antlai-temporal) Remove when SDK bug is fixed
7-
const g = globalThis as any;
8-
g.Uint8Array = g.constructor.constructor('return globalThis.Uint8Array')();
9-
105
const expectedResult = proto.temporal.api.common.v1.DataBlob.create({
116
encodingType: proto.temporal.api.enums.v1.EncodingType.ENCODING_TYPE_UNSPECIFIED,
127
data: new Uint8Array([0xde, 0xad, 0xbe, 0xef]),

features/data_converter/json_protobuf/feature.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ import { decode } from '@temporalio/common/lib/encoding';
99
const patched = patchProtobufRoot(proto) as any;
1010
const dataBlobType = patched.lookupType('temporal.api.common.v1.DataBlob');
1111

12-
// Inject Buffer and Uint8Array from the node context to the workflow context to workaround SDK bug
13-
// TODO(antlai-temporal) Remove workaround when SDK bug is fixed
14-
const g = globalThis as any;
15-
g.Buffer = g.constructor.constructor('return globalThis.Buffer')();
16-
1712
const expectedResult = proto.temporal.api.common.v1.DataBlob.create({
1813
encodingType: proto.temporal.api.enums.v1.EncodingType.ENCODING_TYPE_UNSPECIFIED,
1914
data: new Uint8Array([0xde, 0xad, 0xbe, 0xef]),

0 commit comments

Comments
 (0)