Code Room
Vibe codingHardvc-g180
Subject Ai code reviewLevel Senior–Staff~22 minCommon in Networking & APIs interviewsIndustries Software development, Technology

Question

An AI assistant wrote this SQS consumer in Python that processes payout messages. It treats each delivery as exactly-once. Review the concurrency/delivery assumptions.

python
def handle_payout(msg):    payout = json.loads(msg.body)    account = get_account(payout['account_id'])    account.balance += payout['amount']    save(account)    send_email(account.email, f"You received {payout['amount']}")    sqs.delete_message(QueueUrl=Q, ReceiptHandle=msg.receipt_handle)

What goes wrong in production, and how do you make it correct?

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.

Describe your solution

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.

Run or narrate your approach, then ask the coach.