All practice tasks

Coding (Platform)

Bounded retry policy

express · Medium · retry policy

A service retries every failure with the same delay. Permanent errors consume capacity while transient errors synchronize into a retry storm.

Task

Return a deterministic retry decision with bounded exponential backoff and server-delay support.

Contract

Input is {attempt,status,retryAfterMs,jitterSeed}. Return {retry,delayMs,reason}. Attempts are zero-based; at most four retries are allowed.

Acceptance criteria

  • Retry only 408, 429 and 5xx responses.
  • Respect a larger valid retryAfterMs.
  • Apply deterministic jitter from jitterSeed.
  • Cap delay at 30000 ms and stop after attempt 3.

Constraints

  • Do not mutate caller-owned input.
  • Keep the supplied framework adapter and public contract unchanged.
  • Add candidate tests for at least one boundary not covered by the public cases.

Editable files

  • src/repair.js — Task-specific state or service boundary
  • tests/candidate.test.js — Candidate-authored regression

What this task practices

Bounded retry policy is a coding (platform) interview exercise that trains prompt interpretation, explicit assumptions, a concrete response, and a clear explanation of tradeoffs. The catalog marks it as medium difficulty. It focuses on State Modeling, Regression Testing, Technical Reasoning. The signed-in workspace provides the tools for the round and evaluates the attempt against task-specific criteria. Reference solutions, hidden checks, evaluator instructions, and candidate work remain private.

Sign in to startThe workspace and evaluation open after sign in.