There was an event at the forge involving magma crabs. The dwarves were smelting hematite, gold and platinum and magma crabs tried to interfere. Two of them came out of the channel from the volcano and lucky for us the dwarves reacted quickly; by the time I noticed, there was only miasma and I dumped the corpses forthwith; the health screen reveals only some dogs require diagnosis...
This was built quickly early in the game so there are no floodgate or fortification in the channel. The tile with the yellow X is not dug (the tile is dug one Z-level below on that cursor; as you can see it's all channels). There are 9 workshops built on the channel. Building magma-safe floors all over the unused part of the channel before and after the shops, or even using floodgates and such, is insufficient...
That's because even though it's not clear whether magma crabs can crawl through the shop's exposed single tile (from within the 3x3) i.e. through the forges/smelters, building destroyers certainly can, including through floors and certainly workshops (but not an artifact door). Magma crabs are not building destroyers but there are other creatures. The complexity is compounded by the angle of attack so to speak and the fact this is magma. Following the "underneath" logic, I would have needed to have initially set up the forge so as to isolate the channel atop with a forbidden1 hatch from a connection below, yet since this is in magma the hatch has to be controlled by mechanism so you can't have manual access to set the property to "forbidden" (or rather have it open all by itself if you don't link it to a mechanism)?? I can't seem to connect the dots here... is it about removing ramps or something I'm missing (I have poor spatial sense).
The question is how do I prevent future attacks, if possible, and how do you design this in the first place so as to avoid them?