This is a story about paying down the most expensive kind of technical debt in a query engine — duplicated semantics — and the testing harness that made it safe. It comes from building MoteDB , an embedded multimodal database in Rust for robotics workloads, but the pattern applies to any engine that grew fast.
The bug that kept coming back
Through four rounds of pre-release bug hunting on v0.17, we kept landing on the same shape of bug:
The same SQL predicate, evaluated by different code paths, returned different answers.
WHERE emb = '[1.0, 2.0]' matched rows on one path and not another. DELETE filtered differently than SELECT for the identical WHERE . A JOIN with the predicate as its condition disagreed with the comma-join form of the same query. Every fix was correct; every fix was also whack-a-mole, because the root cause wasn't any single bug.…