Question
You're auditing a batch of agent-generated data-pipeline PRs as the reviewer-of-record for a team that's leaning hard on AI. This Postgres-targeting query keeps recurring across several PRs, generated to 'deduplicate and keep the latest record per user':
SELECT DISTINCT ON (user_id) user_id, status, updated_atFROM eventsORDER BY user_id, updated_at DESC NULLS LASTLIMIT 1000;The agent claims it returns the latest row per user. As someone auditing many of these at once, what's specifically wrong, and what review pattern do you put in place so this class of bug doesn't keep slipping through?
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 coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.