Here is the official answer to the question:
if your I-140 is denied before she returns, her I-485 may also be denied; if her I-485 is also denied, then she would have to apply for and obtain an H-4 visa before she could return.
If her I-485 is not immediately denied, she could return using either a new H4 visa or using her AP.
If your I-140 is denied after she returns, her I-485 may also be denied; if her I485 is also denied, then she would have to go to Vancouver and apply for an H4 visa there. If her I-485 is not immediately denied, she could remain in the US in "a period of stay authorized by the Attorney General." This status does not have a name, but is quite common among people who have allowed their H status to lapse while their AOS applications are pending.