Skip to content

Fix(RequestMapper): Correctly map all fields #1000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ public static RequestCancelWorkflowExecutionRequest requestCancelWorkflowExecuti
.setDomain(t.getDomain())
.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()))
.setRequestId(t.getRequestId());
if (t.getCause() != null) {
builder.setCause(t.getCause());
}
if (t.getFirstExecutionRunID() != null) {
builder.setFirstExecutionRunId(t.getFirstExecutionRunID());
}
if (t.getIdentity() != null) {
builder.setIdentity(t.getIdentity());
}
Expand Down Expand Up @@ -437,7 +443,8 @@ public static SignalWithStartWorkflowExecutionRequest signalWithStartWorkflowExe
.setRequestId(t.getRequestId())
.setMemo(memo(t.getMemo()))
.setSearchAttributes(searchAttributes(t.getSearchAttributes()))
.setHeader(header(t.getHeader()));
.setHeader(header(t.getHeader()))
.setJitterStart(secondsToDuration(t.getJitterStartSeconds()));
if (t.getRetryPolicy() != null) {
builder.setRetryPolicy(retryPolicy(t.getRetryPolicy()));
}
Expand Down Expand Up @@ -521,7 +528,8 @@ public static StartWorkflowExecutionRequest startWorkflowExecutionRequest(
.setMemo(memo(t.getMemo()))
.setSearchAttributes(searchAttributes(t.getSearchAttributes()))
.setHeader(header(t.getHeader()))
.setDelayStart(secondsToDuration(t.getDelayStartSeconds()));
.setDelayStart(secondsToDuration(t.getDelayStartSeconds()))
.setJitterStart(secondsToDuration(t.getJitterStartSeconds()));
if (t.getRetryPolicy() != null) {
request.setRetryPolicy(retryPolicy(t.getRetryPolicy()));
}
Expand Down Expand Up @@ -561,6 +569,9 @@ public static TerminateWorkflowExecutionRequest terminateWorkflowExecutionReques
if (t.getIdentity() != null) {
builder.setIdentity(t.getIdentity());
}
if (t.getFirstExecutionRunID() != null) {
builder.setFirstExecutionRunId(t.getFirstExecutionRunID());
}
return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,16 @@ public final class ProtoObjects {
.setRequestId("requestId")
.setIdentity("identity")
.build();
public static final RequestCancelWorkflowExecutionRequest
REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST_FULL =
RequestCancelWorkflowExecutionRequest.newBuilder()
.setDomain("domain")
.setWorkflowExecution(WORKFLOW_EXECUTION)
.setRequestId("requestId")
.setIdentity("identity")
.setFirstExecutionRunId("firstExecutionRunID")
.setCause("cancel cause")
.build();
public static final ResetStickyTaskListRequest RESET_STICKY_TASK_LIST_REQUEST =
ResetStickyTaskListRequest.newBuilder()
.setDomain("domain")
Expand Down Expand Up @@ -1005,6 +1015,7 @@ public final class ProtoObjects {
.setSearchAttributes(SEARCH_ATTRIBUTES)
.setHeader(HEADER)
.setDelayStart(seconds(3))
.setJitterStart(seconds(0))
.build();

public static final SignalWithStartWorkflowExecutionRequest SIGNAL_WITH_START_WORKFLOW_EXECUTION =
Expand Down Expand Up @@ -1044,6 +1055,16 @@ public final class ProtoObjects {
.setIdentity("identity")
.build();

public static final TerminateWorkflowExecutionRequest TERMINATE_WORKFLOW_EXECUTION_REQUEST_FULL =
TerminateWorkflowExecutionRequest.newBuilder()
.setDomain("domain")
.setWorkflowExecution(WORKFLOW_EXECUTION)
.setReason("reason")
.setDetails(payload("details"))
.setIdentity("identity")
.setFirstExecutionRunId("firstExecutionRunID")
.build();

public static final DeprecateDomainRequest DEPRECATE_DOMAIN_REQUEST =
DeprecateDomainRequest.newBuilder()
.setName("domain")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,15 @@ public final class ThriftObjects {
.setWorkflowExecution(WORKFLOW_EXECUTION)
.setRequestId("requestId")
.setIdentity("identity");
public static final RequestCancelWorkflowExecutionRequest
REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST_FULL =
new RequestCancelWorkflowExecutionRequest()
.setDomain("domain")
.setWorkflowExecution(WORKFLOW_EXECUTION)
.setRequestId("requestId")
.setIdentity("identity")
.setFirstExecutionRunID("firstExecutionRunID")
.setCause("cancel cause");
public static final ResetStickyTaskListRequest RESET_STICKY_TASK_LIST_REQUEST =
new ResetStickyTaskListRequest().setDomain("domain").setExecution(WORKFLOW_EXECUTION);
public static final ResetWorkflowExecutionRequest RESET_WORKFLOW_EXECUTION_REQUEST =
Expand Down Expand Up @@ -863,6 +872,7 @@ public final class ThriftObjects {
.setMemo(MEMO)
.setSearchAttributes(SEARCH_ATTRIBUTES)
.setHeader(HEADER)
.setJitterStartSeconds(0)
.setDelayStartSeconds(3);
public static final com.uber.cadence.SignalWithStartWorkflowExecutionRequest
SIGNAL_WITH_START_WORKFLOW_EXECUTION =
Expand All @@ -885,7 +895,8 @@ public final class ThriftObjects {
.setMemo(MEMO)
.setSearchAttributes(SEARCH_ATTRIBUTES)
.setHeader(HEADER)
.setDelayStartSeconds(3);
.setDelayStartSeconds(3)
.setJitterStartSeconds(0);

public static final StartWorkflowExecutionAsyncRequest START_WORKFLOW_EXECUTION_ASYNC_REQUEST =
new StartWorkflowExecutionAsyncRequest().setRequest(START_WORKFLOW_EXECUTION);
Expand Down Expand Up @@ -913,6 +924,15 @@ public final class ThriftObjects {
.setDetails(utf8("details"))
.setIdentity("identity");

public static final TerminateWorkflowExecutionRequest TERMINATE_WORKFLOW_EXECUTION_REQUEST_FULL =
new TerminateWorkflowExecutionRequest()
.setDomain("domain")
.setWorkflowExecution(WORKFLOW_EXECUTION)
.setReason("reason")
.setDetails(utf8("details"))
.setIdentity("identity")
.setFirstExecutionRunID("firstExecutionRunID");

public static final DeprecateDomainRequest DEPRECATE_DOMAIN_REQUEST =
new DeprecateDomainRequest().setName("domain").setSecurityToken("securityToken");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ public static Iterable<Object[]> cases() {
ThriftObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST,
ProtoObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST,
RequestMapper::requestCancelWorkflowExecutionRequest,
"firstExecutionRunID",
"cause"),
"firstExecutionRunID", // optional field
"cause"), // optional field
testCase(
ThriftObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST_FULL,
ProtoObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST_FULL,
RequestMapper::requestCancelWorkflowExecutionRequest),
testCase(
ThriftObjects.RESET_STICKY_TASK_LIST_REQUEST,
ProtoObjects.RESET_STICKY_TASK_LIST_REQUEST,
Expand Down Expand Up @@ -157,13 +161,11 @@ public static Iterable<Object[]> cases() {
testCase(
ThriftObjects.START_WORKFLOW_EXECUTION,
ProtoObjects.START_WORKFLOW_EXECUTION,
RequestMapper::startWorkflowExecutionRequest,
"jitterStartSeconds"),
RequestMapper::startWorkflowExecutionRequest),
testCase(
ThriftObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION,
ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION,
RequestMapper::signalWithStartWorkflowExecutionRequest,
"jitterStartSeconds"),
RequestMapper::signalWithStartWorkflowExecutionRequest),
testCase(
ThriftObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST,
ProtoObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST,
Expand All @@ -180,7 +182,11 @@ public static Iterable<Object[]> cases() {
ThriftObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST,
ProtoObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST,
RequestMapper::terminateWorkflowExecutionRequest,
"firstExecutionRunID"),
"firstExecutionRunID"), // optional field
testCase(
ThriftObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST_FULL,
ProtoObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST_FULL,
RequestMapper::terminateWorkflowExecutionRequest),
testCase(
ThriftObjects.DEPRECATE_DOMAIN_REQUEST,
ProtoObjects.DEPRECATE_DOMAIN_REQUEST,
Expand All @@ -189,12 +195,12 @@ public static Iterable<Object[]> cases() {
ThriftObjects.DESCRIBE_DOMAIN_BY_ID_REQUEST,
ProtoObjects.DESCRIBE_DOMAIN_BY_ID_REQUEST,
RequestMapper::describeDomainRequest,
"name"),
"name"), // Not needed for query by ID
testCase(
ThriftObjects.DESCRIBE_DOMAIN_BY_NAME_REQUEST,
ProtoObjects.DESCRIBE_DOMAIN_BY_NAME_REQUEST,
RequestMapper::describeDomainRequest,
"uuid"),
"uuid"), // Not needed for query by name
testCase(
ThriftObjects.LIST_DOMAINS_REQUEST,
ProtoObjects.LIST_DOMAINS_REQUEST,
Expand Down Expand Up @@ -227,7 +233,7 @@ public static Iterable<Object[]> cases() {
ThriftObjects.REGISTER_DOMAIN_REQUEST,
ProtoObjects.REGISTER_DOMAIN_REQUEST,
RequestMapper::registerDomainRequest,
"emitMetric"),
"emitMetric"), // Thrift has this field but proto doens't have it
testCase(
ThriftObjects.UPDATE_DOMAIN_REQUEST,
// Data and replicationConfiguration are copied incorrectly due to a bug :(
Expand Down