Code Room
Vibe codingHardvc-g157
Subject Ai test reviewLevel Senior–Staff~19 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

An AI agent tested a retry wrapper around an HTTP client (Java) — it should retry on 5xx and network errors with backoff, but NOT retry on 4xx, and give up after maxAttempts. The agent mocked the client and wrote:

java
@Test void retriesOnFailure() {  when(client.send(any())).thenThrow(new IOException())      .thenReturn(resp(200));  Response r = retrier.execute(req);  assertEquals(200, r.status());  verify(client, times(2)).send(any());}

This is the only retry test and it passes. What does it fail to verify about the retry contract, and how would you close the gaps?

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.