Data & Systems45 minutes

Canvas Undo and Redo

Build an editor reducer with undo and redo.

Task

Build undo and redo for a canvas editor that lets users add, move, and delete text elements.

Requirements

  1. State is {past, present, future}. present is an array of {id, x, y, text}; past and future hold earlier scene arrays.
  2. add appends action.shape unless its id already exists. move replaces x and y for action.id. delete removes action.id.
  3. A real edit appends the old present to past and clears future. Missing IDs, duplicate adds, and moves to the same coordinates are no-ops.
  4. undo pops the last past scene and pushes the current scene onto future; redo reverses that. Empty undo/redo is a no-op. Never mutate input. Unsupported actions throw an Error.
How you are graded
  • Decomposition 15%
  • Prompting the assistant 15%
  • Verification 20%
  • Judgment about AI output 15%
  • Correctness 25%
  • Communication 10%

Scores use evidence from your session. A short or incomplete session may not provide enough evidence for every skill. See a sample scorecard

Interview guidance

This canvas editor needs undo and redo. Use the assistant freely. I care about whether you can show me, with the checks or the preview, that a new edit after undo really discards the redo branch, and that no-op actions leave history alone.

  • AI is allowed and expected: your own Claude, OpenAI or Gemini key, or the free in-browser model.
  • You are graded on how you drive and check the AI, not on how much you prompt.
  • Run the checks; read what fails.
  • A new requirement will arrive partway through.
  • Too little AI use is reported as “not enough to grade”, never as a fail.
You will answer 7 debrief questions at the end
  • What did you delegate to the AI, and why?
  • Name one AI suggestion you rejected or changed, and why.
  • Choose one block the AI helped write. Explain what each line does and which test verifies it.
  • What is still risky, and what would you test or ship next?
  • Which part of the assistant's batch implementation did you keep, and which did you rewrite?
  • How did you confirm that undo after a batch restores the scene from before the whole batch?
  • How would you cap memory for a long editing session without breaking undo?