Pulse flour, baking powder, salt, butter, and egg yolk in a food processor until breadcrumb texture forms.
Mix in grated Parmesan, then gradually add water until a dough forms.
Roll dough into a ball, wrap in cling film, and chill for one hour.
Boil potato cubes in salted water for 10-15 minutes until tender, then drain.
Boil sliced onions for 2-3 minutes until softened and drain well.
Coat onions with flour, add milk and cream, then heat until thickened.
Stir in potatoes, Cheddar, mustard, and cayenne, then season with salt and pepper.
Preheat oven to 180°C and grease a 20cm pie tin with butter and flour.
Roll out two-thirds of the pastry to line the tin, then prick the base with a fork.
Blind bake with greaseproof paper and beans for 10-15 minutes at 180°C.
Remove beans, let pastry cool, and pour in the filling mixture.
Roll remaining pastry, seal the lid with egg wash and a fork, and make two steam holes.
Brush with egg and bake for 25-30 minutes until golden-brown.