@@ -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