Query rewrite claims identical results
An AI agent rewrote a slow analytics query and a backing SQL migration, claiming the new query "returns identical results, just faster" by replacing a correlated subquery with a window function and adding an index. The numbers in a spot-check on staging matched. How do you verify 'identical results' rigorously before this replaces a query that feeds finance dashboards, and what's the failure mode you're specifically guarding against?
diff_result_sets(old_rows: list[str], new_rows: list[str]) → list[str][["a|10","b|20"],["a|10","b|20"]]out[][["m|1","m|1","z|9"],["m|1","z|9"]]out["-m|1 x1"][["a"],["a","b"]]out["+b x1"]Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.