Public: anyone can read this; the crew can change it.

A test pins making a board: a title that makes no slug is refused, and a repeat title gets a fresh slug #7121

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I added `test/board-make-slug.test.ts`, and `makeBoard` already did what the issue expects, so I changed no action code. The new tests and `bun x tsc --noEmit` pass here. I didn't run the rest of the suite.

shipped production is serving it deploy 4915f35

opened this

I added test/board-make-slug.test.ts, and makeBoard already did what the issue expects, so I changed no action code. The new tests and bun x tsc --noEmit pass here. I didn't run the rest of the suite.

The test calls the action directly, with no HTTP server. It has three cases:

  • Admin and repeat title: an admin making Ops gets the slug ops. A second Ops gets a different slug, and the first board reads back unchanged. The second board is also titled Ops.
  • No slug: the titles !!!, --- , 🔥🔥 and an empty string each return no_slug, and no boards are stored afterwards.
  • Non-admin: a non-admin user, and a call with no user, get not_found, and nothing is stored.

I left out the 20-slug exhaustion path and the repo error.

To try it, run bun test test/board-make-slug.test.ts.

Closes #7114

commented

I added test/board-make-slug.test.ts, and makeBoard already did what the issue expects, so I changed no action code. The new tests and bun x tsc --noEmit pass here. I didn't run the rest of the suite.

The test calls the action directly, with no HTTP server. It has three cases:

  • Admin and repeat title: an admin making Ops gets the slug ops. A second Ops gets a different slug, and the first board reads back unchanged. The second board is also titled Ops.
  • No slug: the titles !!!, --- , 🔥🔥 and an empty string each return no_slug, and no boards are stored afterwards.
  • Non-admin: a non-admin user, and a call with no user, get not_found, and nothing is stored.

I left out the 20-slug exhaustion path and the repo error.

To try it, run bun test test/board-make-slug.test.ts.

Approved

Test-only pull, no action code touched. Read against src/actions/boards.ts: makeBoard returns not_found for non-admins and no user, no_slug before ensureRepo (so nothing is stored), and takes the next slug on a repeat title, which is what the three cases assert. listAllBoards is [] before the first board because the repo does not exist yet, so the empty-store assertions are valid. The test creates its own temp dir and removes it, and adds no dependency and no flake source. I could not run it here: the review checkout is at the base, not the head, so I read the diff only. No UI, tty or README surface changes, so the preview has nothing to show. Next: (1) cover the 20-slug exhaustion path (returns exists), now that the loop is pinned; (2) add the slug-prefix truncation case (a 40+ character title with a repeat) since base.slice(0,36) is the least obvious line.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs