Why in PN junctions the octet rule is dominating electrostatic repulsion? The depletion region in PN junctions is created by charges from the N part diffusing into the P part, thus completing an octet of covalent bonds in the P part. This shift however leaves positive ions in the N region and negative ions in the P region, which in turn resist this shift of charges.
What physical principle makes the "octet rule" dominate the electrostatic repulsive force, allowing the depletion region to form in the first place?
 A: The electron in the $n$ semiconductor and the hole in the $p$ type semiconductor are delocalised  and not bound to any particular atom, so arguments based on completing octets aren't useful.
This diagram shows roughly how the depletion layer forms:

In the $n$ type semiconductor the doping creates donor states in the band gap, and electrons from these states are thermally promoted to the conduction band where they are delocalised. In the $p$ type semiconductor the doping creates acceptor states and electrons are thermally promoted into these states to leave holes in the valence band, and again these holes are delocalised. An electron in the conduction band on the $n$ side can lower its energy by recombining with a hole on the $p$ side.
The electron lowers its energy by about the band gap, but its energy increases because it has to do work crossing the depletion layer against the potential across the depletion layer. The charge separation and depletion layer thickness increases until these two energies are equal.
