Code Room
Vibe codingMediumvc-g391
Subject Ai system comprehensionLevel Mid–Senior~16 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

You ask an AI to summarize what this Python order-processing function does before you reuse it elsewhere. The agent gives a tidy three-bullet summary: "(1) validates the order, (2) charges the card, (3) returns a confirmation object." It reads as pure and reusable. What's the risk in that summary, and how do you confirm there isn't a critical side effect it omitted?

python
def process_order(order):    validate(order)    charge = gateway.charge(order.card, order.total)    db.execute("UPDATE inventory SET qty = qty - %s WHERE sku = %s", (order.qty, order.sku))    cache.invalidate(f"product:{order.sku}")    emit_event("order.completed", order.id)    return Confirmation(charge.id)
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.