CJ is right; you must disclose, to protect both you and the buyer.
There are things you can do to bring the home back into compliance, probably at a minimum cost. But, what if you found an all cash buyer who actually wanted to keep what you've done? So there's a balance of when to do what...
There is a clause in the California Association of REALTORS purchase agreement (10-A) which addresses your question about how buyers who sign that contract may handle investigations with government officials...it's designed to protect you.
You're right, there are a lot of unpermitted improvements made to homes here, and they are purchased and sold with full disclosure all the time. It is a delicate, but by all means possible, situation to handle with care.
The county records are often incomplete, but they can discover things at any time, often prompted by a complaint, or when a new permit is drawn.