Bun's Million-Line AI Rewrite Passed All Tests, Still Shipped 19 Bugs
Bun's AI-driven Zig-to-Rust rewrite passed every test yet shipped 19 regressions, exposing the gap between test coverage and true verification.
In May, Bun—the JavaScript runtime bundled with Claude Code—replaced roughly a million lines of Zig with Rust, most of it written by AI rather than humans. Press coverage framed it as merging at the speed of AI, but the aftermath split into three competing narratives: Bun framed the move as a memory-safety necessity, Zig's creator argued the relationship had already collapsed for unrelated reasons, and critics called the decision a marketing showcase for the underlying model.
The real engineering lesson sits underneath the noise. Bun's test suite—roughly 60,000 tests, 1.38 million assertions—passed cleanly across six platforms, yet 19 regressions still reached production. None came from sloppy code; each was a faithful, line-for-line translation that carried different semantics between the two languages: a debug assertion whose side effect vanished in release builds, a slice cast that now panics instead of silently truncating, and a format-string parser whose evaluation order flipped. Tests verify the behaviors you thought to check; rewrite bugs live exactly where you didn't think to check.
The contrast comes from Ladybird's earlier C++-to-Rust port, which used the same AI tooling but a stricter bar: byte-for-byte identical output between old and new pipelines, diffed live against real traffic. Assertion coverage confirms the new code matches what you remembered; output equivalence confirms it matches everything the old system actually did, remembered or not. For teams weighing similar rewrites, the takeaway is blunt: the cost of an AI-assisted language migration has collapsed, but a green test suite is not the same thing as verification.