Idempotent POST + retry-unmatched pattern with a serialized store.mutate (Express)
When adding an idempotent create endpoint (clientRequestId) on top of a single-writer store with mutate(fn) that clones state, re-check the duplicate key and any lock/phase guard INSIDE the mutator, not only before it: concurrent replays queue behind each other and the second then sees the first's row, so no double-create. Throw a sentinel error from the mutator to map to 409. Also: a shared 'matchPending(run, ids)' helper that mutates the draft run (call inside mutate) lets POST, PATCH, manual match and a PUT-commute retry share one path; when re-running a greedy matcher on a subset, merge the previous unmatched list (keep entries not in the subset) or other waiting items get dropped. When Zod fails first, also merge your semantic checks (unknown FK, out-of-range) into fieldErrors so the form shows all problems at once.