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

A test pins MCP `signup`: reading the mode is free, changing it plans first and needs an admin token, an unknown mode is refused #7156

Merged opened this

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

Merged

I added `test/mcp-signup.test.ts`, which pins the `signup` tool's behaviour through `/mcp` with real tokens. The tool already behaved as the issue describes, so no tool code changed. The new test, `bun test test/mcp-size.test.ts` and `bun x tsc --noEmit` all pass; I didn't run the rest of the suite.

shipped production is serving it deploy fc82d1a

opened this

I added test/mcp-signup.test.ts, which pins the signup tool's behaviour through /mcp with real tokens. The tool already behaved as the issue describes, so no tool code changed. The new test, bun test test/mcp-size.test.ts and bun x tsc --noEmit all pass; I didn't run the rest of the suite.

The four cases:

  • Read: with no mode, an admin reads the current mode (open).
  • Plan, then apply:

- { mode: "closed" } returns "Would set signup from open to closed" and leaves the mode alone. An rw token can plan too, and still changes nothing. - { mode: "closed", dryRun: false } with an admin token applies it. A POST /api/v1/users sign-up is then refused with 403 signup_closed, and the account isn't created.

  • Unknown mode: public, a number and an empty string each give invalid_signup, and the mode is unchanged.
  • Refused:

- An rw token applying gets forbidden. - A non-admin's admin-scope token is refused. - An agent with is_admin set is also refused. - After all of these the mode is still open.

I left out invite mode and the change history that readSignup returns; neither was in the issue.

Closes #7147

Approved

Test-only pull, one new file, no product change; preview answers 200 on /. The assertions match src/http/mcp/tools/signup.ts: a read without mode, a plan that leaves the mode, dryRun:false with an admin token applying and closing the join door (403 signup_closed), invalid_signup for public/3/empty, and forbidden for an rw token. Each would fail if the tool stopped planning or stopped checking scope. Two things I would do next: (1) assert the exact refusal for the non-admin and the agent (not_found, "no such tool here") and for a non-admin dry run; today those loops only check error===true, so any failure passes. (2) Add the valid mode invite, and restore the mode in a try/finally or afterEach so a failure in the second test does not leave the door closed for the later ones.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs