Code Room
Code reviewHardcr-p105
Subject Ai generated codeLevel Senior~18 minCommon in Code quality & review interviewsIndustries Software development

Question

An AI generated this fixed-window rate limiter. Review it.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewpython
def allow(user, now):    bucket = windows.setdefault(user, {'start': now, 'count': 0})    if now - bucket['start'] > 60:        bucket['count'] = 0    bucket['count'] += 1    return bucket['count'] <= LIMIT
Run or narrate your approach, then ask the coach.