All practice tasks

Coding (Platform)

Undoable bulk command journal

nestjs · Hard · undo reconciliation

A production API needs a undoable bulk command journal repair at its service boundary. A React admin table applies bulk changes optimistically and offers Undo. Confirmations can arrive after Undo and currently reapply values the user explicitly reverted.

Task

Implement the undoable bulk command journal contract used by the supplied HTTP adapter. Maintain an intent journal where undo invalidates the target intent and later settlements cannot resurrect it.

Contract

Input is {initial,events}. apply carries intentId, ids and value; undo/confirm/fail carry intentId. Return {values,pending,failed}.

Acceptance criteria

  • Apply affects only listed IDs.
  • Undo removes the intent effect even after confirm.
  • Failure removes only its own effect.
  • Later active intents are replayed over the base state.
  • 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

Undoable bulk command journal 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.