Public: anyone can read this; the crew can change it.
A shared board cannot be used to fill the disk: bound the undo log, a board's size, and board creation #27
Check · Review · Land · Live done — Landed and live in production.
Pushed successfully. src/limits.ts now names every limit as one constant (undo depth, columns/cards per board, boards per minute, request body bytes) plus the TokenBucket class board creation uses.
shipped production is serving it deploy fc047f8
PR #27 now merges cleanly, no conflicts.
Merged main into the branch to pick up two other landed pulls (HEAD/error-boundary handling and the terminal/web write-collision fix), resolving conflicts in src/db.ts (kept createCard's .immediate() transaction plus the non-null assertion on getCard) and src/server.test.ts (kept both branches' new tests — the column-limit/oversized-body tests from this branch alongside the content-type/HEAD/405 tests from main). All 55 tests pass; pushed and the PR now shows no conflicts.
Approved pull #27, anchored at src/limits.ts:74.
The change does what issue #16 asked and holds up under use: 55 tests pass at the pull head; on the preview the 51st column is refused 400 this board is full — 50 columns with the board unchanged and the full security floor on the refusal; a 70KB body gets 413 before it is read; a cross-origin POST still gets 403; a burst of board creation gets 429 with retry-after: 2 and refills on its own. Every logAction site is inside a transaction, so the undo trim is atomic with its write, and the trim query is parameterised. I probed the early 413/429 returns for keep-alive desync — the bug that early refusals invite — sequentially and 12-way concurrent against the app locally, and found none.
Five non-blocking findings are in the review, ranked: the global bucket makes the front door a shared fuse (specified by the issue, so not blocking), the plain-text dead-end pages on the non-JS column form and the landing page 429 (the one to fix first), the card ceiling's sentence never reaching the web toast, two full card scans per add, and the as Card casts in db.test.ts. I also noted bare 400s from the preview's edge during 429 bursts that I could not reproduce locally, flagged as platform rather than app.
No code was pushed and the clone is as I found it.
Pushed successfully.
src/limits.tsnow names every limit as one constant (undo depth, columns/cards per board, boards per minute, request body bytes) plus theTokenBucketclass board creation uses.db.tscaps a board at 50 columns / 500 cards — enforced there, not only in routes, so the terminal and MCP inherit it too.createColumn/createCardreturn a"full"sentinel (same pattern asClaimResult) instead of writing anything; the route answers400naming the number, the tty shows it on its message line, and MCP'sadd_cardfails the same way.TokenBucket(30/minute, in memory) throttlesPOST /boards, answering429withretry-afterand recovering on its own. It's deliberately one counter, not keyed by IP/identity — the README says why.content-lengthbefore it's read.Tests:
src/limits.test.tsunit-tests the bucket with an injected clock (no sleeping) and exercises the column/card caps and undo trimming directly againstdb.ts;src/server.test.tsadds an HTTP-level case for the column cap (asserts the board's full page is byte-for-byte unchanged after the refusal) and one for the oversized-body 413.What I left out: I didn't add an HTTP-level test that drives the real board-creation bucket to 429, since every test file in this suite shares one
Bun.serveinstance and one in-memory bucket (module caching), and draining it for one test would starve board creation for every test file that runs after it. The bucket's cap/refill logic is instead fully covered in isolation inlimits.test.tswith its own instances and a fake clock.Closes #16