Depends on size, thread fineness, thread tolerance range and obviously materials quite a lot.
There are programs and standard calcs to estimate these things of course, and a main criteria to avoid inadvertant/unseen partial thread stripping during assembly is that tensile failure of the bolt/stud should occur well before thread stripping..
For very small diameters, 2 X D is adopted as a standard I've seen, unless thread is very fine.
1.5 x D is often quoted
1x D is often used
These are general rules of thumb for safety
But the load usually comes out of the thread (depending on tolerance of male and female parts) between 3 and 5 threads from the stressed face.
Aircraft use what look like half-nuts quite a bit to reduce weight and space, but these are all individually stressed , tested and assembled under tight control. Of course if we're talking 'pins' in shear, rather than bolts, then anything to just hold it in place.
A quick Google wrote:
Can anyone point me in the right direction of a Minimum thread depth chart?. I am tapping a m2x0.4 hole into a piece of HE15 (commercial dural) but am limited on depth what is the minimum length of thread neaded to have contact in the tapped hole?
no apologies for stating the obvious, but the minimum thread depth is "as small as you can design".
the next question is how strong do you need it to be ?
the rule of thumb is three threads develop the full strength of the bolt.
if i was designing something with minimal thread engagment i'd either consider the effects of vibration VERY carefully, even if you don't think you'll have vibration, or consider the effects if this thread backs out, or add positive retention device (lock washer) ... but i doubt you've got room for this.
5 threads!
M2x0.4 means 1X Diameter engagement is only 5 threads, as harrisj stated a standard corner break 0.2-0.4 x 45° removes a full thread from that.
Our corporate standard is 2X Diameter for anything smaller than M5..
An M2 hole is pretty small. Controlling depth of full thread to 2mm is asking for trouble (de-burr the hole and you've lost 25% of your thread). In a soft aluminium alloy you won't be able to inspect or measure it effectively. Maybe if it's screwing on a maker's nameplate it would be OK but I wouldn't rely on a 2mm deep M2 hole in Al for anything worthwhile