What type of thing was not to code? Is it things that are structural or safety issues? Like faulty wiring? I’d be worried about not bringing it up to at least a minimum safety standard.
As far as the unpermitted work – I don’t have any advice. I’ve heard of people getting “forgiveness” after the fact *if* it passes current code… but if it doesn’t you may be screwed.
It’s never good when you have to go to court and have lawyers involved.