Code Room
Vibe codingMedium
Question
This Lambda (Python) was generated to count rows in a CSV that S3 events deliver. It works for sample files and crashes with out-of-memory on real uploads. Identify the bug and the fix.
import boto3s3 = boto3.client("s3") def handler(event, context): rec = event["Records"][0]["s3"] bucket, key = rec["bucket"]["name"], rec["object"]["key"] obj = s3.get_object(Bucket=bucket, Key=key) data = obj["Body"].read().decode("utf-8") rows = data.splitlines() return {"row_count": len(rows)}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.
Learn the concepts
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.