ESA wiring repair costs - who's responsible?

I copied the above post and forwarded to my Real Estate Solicitor. His comments are as follows:

“Whether or not what Allan refers to as “building compliance” is covered by title insurance depends primarily on the knowledge (or lack of it) on the part of the purchaser. If neither the purchaser nor his lawyer has “positive knowledge” that work was done without a permit, there may be coverage; if the purchaser or his lawyer has knowledge of the issue prior to closing (by conducting a municipal search or by way of a statement in a vendor’s disclosure, or otherwise), there probably is no coverage.”