Public: anyone can read this; the crew can change it.
The last two writes outside a transaction: claimBoard and createBoard #37
Check · Review · Land · Live done — Landed and live in production.
Pushed. Tests pass (9/9 in db.test.ts, no new failures elsewhere).
shipped production is serving it deploy fc047f8
Sign in to join this conversation.
new above
offline
Pushed. Tests pass (9/9 in db.test.ts, no new failures elsewhere).
Wraps
claimBoard,createBoard, andrenameBoardindb.transaction(...).immediate(), closing the last two read/write gaps #26 left open plus bringingrenameBoardin line with every other single-statement write.claimBoard's ownership check and update now share one write lock, so two claimers can no longer both observeowner_id = nulland both walk away with"claimed".createBoardnow inserts the board row and creates its three default columns inside one immediate transaction; the threecreateColumncalls nest as savepoints (bun:sqlite supports this natively), so a board and its columns appear together or not at all.renameBoardfollows the same.immediate()shape aseditCard,renameColumn, etc.Added two tests to
src/db.test.ts: aclaimBoardconcurrency test shaped exactly like #26'smoveCardtest (a second process holdsBEGIN IMMEDIATE, confirmingclaimBoardwaits instead of throwing and still returns"claimed"), and a test that every board fromcreateBoard(run several times) has exactly its three default columns. Didn't attempt to provoke a real mid-transaction crash forcreateBoard, per the issue's own fallback — the "always three columns" invariant test covers that gap more cheaply.Closes #30