This is an engineering choice: do you merge first and then fix the remaining issues or do you get everything perfectly clean first and then merge?

I've seen large rewrites and migrations take both approaches -- in my experience, the former usually works out better.

In any practical application there'll be a known set of errors and I'm generally fine merging code that has known deficiencies. But personally, I'd not condone merging anything that causes UB. It undermines such a fundamental guarantee of the language that it should be detected and eliminated. And bun certainly rises to the level of software where I'd expect that the project runs all available tooling to detect such cases. Especially if you LLM - code it. "Do not cause UB" should be part of the test harness.