Code RoomTransaction holds external calls
HardPrep Room Coding #4070

Transaction holds external calls

Vibe & agenticDatabases & SQLSenior–Staff~18 min

An AI agent wrote this Java service method to create an order, charge the card, and send a confirmation email — all wrapped in one transaction for 'consistency'. Under load, the team sees database connection-pool exhaustion and occasional orders with no payment.

What's wrong with the transaction boundary, and how should this be structured?

Implement
external_ms_in_transaction(steps: list[str]) → int
Examples
in[["begin","db|save_order|5","http|charge|800","http|email|400","db|save_order|5","commit"]]out1200
in[["begin","db|save_order|5","commit","http|charge|800","begin","db|record_payment|4","commit","queue|enqueue_email|2"]]out0
in[["begin","begin","http|charge|800","commit","http|email|400","commit"]]out1200
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 18 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.