Code RoomIncident in machine-written SQL pipeline
HardPrep Room Coding #4627

Incident in machine-written SQL pipeline

Vibe & agenticAlgorithms & data structuresSenior–Staff~22 min

Over two quarters your team shipped a complex SQL-heavy reporting pipeline largely generated by AI agents — intricate window functions, recursive CTEs, and a few hand-tuned query hints. It works and is fast. But a production number comes out wrong, and during the incident nobody on the team can explain why a particular CTE filters the way it does or whether changing it is safe; the original author "prompted it and it passed the tests." How do you handle this incident, and what does it expose about keeping shared understanding when code is machine-written?

Implement
bisect_pipeline_divergence(stage_names: list[str], expected_rows: list[int], actual_rows: list[int], owner_can_explain: list[bool]) → list[str]
Examples
in[["source","filter_cte","window_cte","final"],[1000,900,900,900],[1000,860,860,860],[true,false,true,true]]out["filter_cte","delta=-40","comprehension-debt"]
in[["a","b"],[1,2],[1,2],[true,true]]out[]
in[["a"],[5],[7],[true]]out["a","delta=2"]
What a strong answer looks like

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.

0:00 of about 22 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.