All practice tasks

Coding (Platform)

Concurrent payload validation

fastify · Hard · validation concurrency

A production API needs a concurrent payload validation repair at its service boundary. A React form runs local and remote validation while fields keep changing. Remote errors from an older revision currently block submission of newer values.

Task

Implement the concurrent payload validation contract used by the supplied HTTP adapter. Reconcile field edits and remote validation by form revision, preserving only current evidence.

Contract

Input is {initialValues,events}. edit carries field and value; request/result carry revision, result also carries errors. Return {values,revision,errors,pending,canSubmit}.

Acceptance criteria

  • Every edit increments revision and clears that field error.
  • Only current-revision results may commit.
  • Pending is true only for a current request without a settlement.
  • canSubmit requires no pending work and no errors.
  • Return a deterministic JSON-serializable result for the HTTP adapter.

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

Concurrent payload validation 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 hard 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.