That is not an engineering challenge but rather the natural state of nuclear warheads. If your device works perfectly, you get a nuclear explosion, if it does not, you don't, at best you get a fizzle that does a tiny fraction of the intended output. Of course, you do scatter some radioactive material around.
It would be a very interesting engineering challenge to design a nuclear warhead that can do a partial detonation even if damaged by some AA, but I don't think anyone has done that.