In answer to how an engine is engineering to cope with Det, well that happens when the OE manufacturer first validates and maps the engines! It often takes months if not years on 10's of dynos's to validate an engine.
We as tuners cannot in the limited time we have, set up an engine to guarantee it wont det in all conditions. (dont forget as en engine ages conditions change) We can certainly detect pre-ignition and by experience retard the ignition so that we can hopefully prevent pre-ignition in all conditions.
Sadly the same for det cannot be said, and all we can do to try to make the engine 100% reliable is either run the engine as the engine came from the factory (i.e. fully validated for the bhp/rpm/all temperatures) or use our own experience to engineer the engine correctly. (e.g. choosing the correct combustion chamber design, keeping cylinder pressures acceptable, hence correct C.R. and so on.)
In an ideal world we could engineer an engine to be det free and validate this by continual destructive testing on dyno for all conditions, but out on the road we cannot possibly guarantee safety 100% of the time. (e.g. poor quality fuel, temperatures, air quality, engine age etc!)
May I lastly point out that over the years I spent at Jaguar depsite state of the art dynos, whilst pre ignition is easily audiable, localised detonation was not, and an engine that was sat on dyno sounding sweet running well within it's set parameters with the correct fueling and ignition, could and did often damage a piston, which upon investigation was attributed to localised abnormal combustion!
This is why we hope an engine is engineered well from the factory so that the limited methods we have of monitering combustion usually gives results reliable enough to last!