Skip to content

Commit a283511

Browse files
authored
Do not enforce payload limits for system nexus endpoint (#9344)
Rely on the gRPC 4MB limit to enforce an upper bound. Operations may have embedded payloads that would be validated on a per operation basis.
1 parent c09c2b6 commit a283511

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

components/nexusoperations/workflow/commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (ch *commandHandler) HandleScheduleCommand(
148148
}
149149
}
150150

151-
if !validator.IsValidPayloadSize(attrs.Input.Size()) {
151+
if attrs.Endpoint != commonnexus.SystemEndpoint && !validator.IsValidPayloadSize(attrs.Input.Size()) {
152152
return workflow.FailWorkflowTaskError{
153153
Cause: enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_SCHEDULE_NEXUS_OPERATION_ATTRIBUTES,
154154
Message: "ScheduleNexusOperationCommandAttributes.Input exceeds size limit",

components/nexusoperations/workflow/commands_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,29 @@ func TestHandleScheduleCommand(t *testing.T) {
275275
require.Equal(t, 0, len(tcx.history.Events))
276276
})
277277

278+
t.Run("system endpoint skips payload size validation", func(t *testing.T) {
279+
tcx := newTestContext(t, defaultConfig)
280+
err := tcx.scheduleHandler(context.Background(), tcx.ms, commandValidator{maxPayloadSize: 1}, 1, &commandpb.Command{
281+
Attributes: &commandpb.Command_ScheduleNexusOperationCommandAttributes{
282+
ScheduleNexusOperationCommandAttributes: &commandpb.ScheduleNexusOperationCommandAttributes{
283+
Endpoint: commonnexus.SystemEndpoint,
284+
Service: "service",
285+
Operation: "op",
286+
Input: &commonpb.Payload{
287+
Data: []byte("ab"),
288+
},
289+
},
290+
},
291+
})
292+
// Should NOT get payload size error; instead gets ProcessInput validation error (service not found).
293+
var failWFTErr workflow.FailWorkflowTaskError
294+
require.ErrorAs(t, err, &failWFTErr)
295+
require.False(t, failWFTErr.TerminateWorkflow)
296+
require.Equal(t, enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_SCHEDULE_NEXUS_OPERATION_ATTRIBUTES, failWFTErr.Cause)
297+
require.NotContains(t, failWFTErr.Message, "Input exceeds size limit")
298+
require.Empty(t, tcx.history.Events)
299+
})
300+
278301
t.Run("exceeds max concurrent operations", func(t *testing.T) {
279302
tcx := newTestContext(t, defaultConfig)
280303
for range 2 {

0 commit comments

Comments
 (0)