All practice tasks

Coding (Platform)

Draft autosave without stale confirmations

angular · Medium · autosave state machine

An editor saves drafts in the background. A slow confirmation for an older revision currently marks the latest text as saved, and an older failure can replace the current status.

Task

Reduce edit, save, success and failure events into a truthful draft status.

Contract

Input is {events}. edit carries revision and text; save, success and failure carry revision. Return {text,revision,status,error}. Status is idle, dirty, saving, saved or failed.

Acceptance criteria

  • Only the latest revision may become saved or failed.
  • Saving an old revision does not change current status.
  • Editing clears the previous error.
  • Success must match both the current revision and latest save attempt.

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

Draft autosave without stale confirmations 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.