Make a fragrant, savoury base for the filling by peeling the onion, chopping it roughly and leaving it to cook slowly with the butter in a heavy casserole over moderate heat.
Pull the rosemary needles from their stems (you’ll need about a tablespoonful of them), chop them finely and stir them into the onions.
Scrub the potatoes, but don’t peel them. Cut them into large dice, and once the onions are pale gold and glossy, stir them in. Cover with a lid and leave to colour for 10 minutes, stirring them after 7 or 8.
Chop the courgette into dice, as with the potatoes, and add to the pan along with the mushrooms ( if using) and salt and black pepper. Cover once more and leave to cook for a few minutes.
Pour in the stock, let it bubble and steam briefly. Set the oven at 185¡C/gas mark 4.
Make the crumble by reducing the bread to crumbs in a food processor, adding the walnuts, stirring in a little rosemary and adding the cheese in small pieces.
Remove the lid from the filling, turn off the heat and crumble the 45g of cheese over the top. Tip the crumble on top and bake for 35-40 minutes, till the top is crisp.