Your third pattern includes a typo, should be ‘type’ instead of ‘test’. BTW a shorter writing would be defining the type in the template:
(
~template = Pbind(\dur, 0.3, \midiout, m, \chan, 1, \type, \midi);
~noteOn = Pn(Plazy{Pbind(\midinote, Pseq((30..90).scramble.keep(rrand(1, 25)), rrand(2, 15)))}, inf);
~prgChange = Pn(Plazy{Pbind(\program, rrand(1, 15))});
Ppar([~noteOn <> ~template, ~prgChange <> ~template]).trace.play;
)
Also please see this parallel thread with the almost same problem, with a dedicated event type you could write it even more simple. Though I see, redefining Patterns via Event types is a bit advanced.