There is no guarantee of anything. But every part has a sku and an inventory location, so once it arrives at the warehouse it goes to whatever inventory location in the warehouse needs it.
Its not actually on one shelf - Amazon spreads inventory all across their warehouse and mixes it. For example if there algorithm tells them your likely to buy notebooks and pencils together, they stock some of them near each other, and in multiple locations around the warehouse in case you buy Twinkies with your notebook and pencil.
So when they pull the filter you ordered, it depends on who's shipment was stocked near the twinkies you also ordered.
Only very high volume stuff is automated. That's why Amazon needs 700,000 warehouse workers, and a bunch of temporary extra ones around Christmas.