react + express · Hard · offline sync
A browser and API disagree at the optimistic workflow journal boundary. A board supports several rapid card moves. When one request fails, the current implementation restores the entire old board and erases later confirmed moves.
Task
Repair the shared browser-to-service contract. Reconcile move intents independently so failure restores only the affected intent while later confirmed order remains.
Contract
Input is {initialIds,events}. move has intentId,id,toIndex; success and failure have intentId. Return {ids,pending,failed}. Indices are clamped.
Acceptance criteria
- Apply each move immediately.
- Track the prior neighbor anchors for each intent.
- Success removes only that intent.
- Failure removes that move effect without discarding later intents.
- Keep browser-visible state consistent with the canonical service result.
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 boundarytests/candidate.test.js— Candidate-authored regression