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

A test pins MCP `teams`: a person admin changes a team's charter, dial or members, planned first, and a malformed change is refused #7194

Merged opened this

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

Merged

I added `test/mcp-teams.test.ts`, which pins the MCP `teams` tool. The new test, `bun x tsc --noEmit` and `bun test test/mcp-size.test.ts` all pass. `teams.ts` needed no change.

shipped production is serving it deploy b4d876b

opened this

I added test/mcp-teams.test.ts, which pins the MCP teams tool. The new test, bun x tsc --noEmit and bun test test/mcp-size.test.ts all pass. teams.ts needed no change.

Each case calls the tool through /mcp with a real admin-scope token, like test/mcp-orgteams.test.ts.

  • List and plan: without slug the tool lists the teams. With slug and a new dial, it plans, saying "Would change…", and the team is unchanged. That holds both when dryRun is left out and when it is true.
  • Apply: with dryRun: false, the charter, dial and members are all saved.
  • Malformed changes: a dial of "50", 101, -1 or 1.5, members that are a string, numbers or an unknown agent, and a charter that is a number are each refused. I ran them both planned and applied, and the team was unchanged every time. An unknown team slug is refused too. The test checks the invalid_body code only for the "50" case. The others are caught later, by the dial, member and charter checks.
  • Who may call it: an agent admin and a non-admin are refused for listing, planning and applying, and the team is unchanged. The agent admin is a test agent whose account I set as admin directly in the database.

Nothing else is in this pull, and no failing tests came up elsewhere. The forge's own check will run on this push.

🤖 Generated with Claude Code

Closes #7167

commented

I added test/mcp-teams.test.ts, which pins the MCP teams tool. The new test, bun x tsc --noEmit and bun test test/mcp-size.test.ts all pass. teams.ts needed no change.

Each case calls the tool through /mcp with a real admin-scope token, like test/mcp-orgteams.test.ts.

  • List and plan: without slug the tool lists the teams. With slug and a new dial, it plans, saying "Would change…", and the team is unchanged. That holds both when dryRun is left out and when it is true.
  • Apply: with dryRun: false, the charter, dial and members are all saved.
  • Malformed changes: a dial of "50", 101, -1 or 1.5, members that are a string, numbers or an unknown agent, and a charter that is a number are each refused. I ran them both planned and applied, and the team was unchanged every time. An unknown team slug is refused too. The test checks the invalid_body code only for the "50" case. The others are caught later, by the dial, member and charter checks.
  • Who may call it: an agent admin and a non-admin are refused for listing, planning and applying, and the team is unchanged. The agent admin is a test agent whose account I set as admin directly in the database.

Nothing else is in this pull, and no failing tests came up elsewhere. The forge's own check will run on this push.

🤖 Generated with Claude Code

Approved

Test-only pull, no change to the page, the terminal or the README, which suits a test that pins an existing tool. It matches the tool in src/http/mcp/tools/teams.ts: list, plan by default, apply with dryRun false, malformed input refused whether planned or applied, and agent-admin and non-admin callers refused with the team unchanged. Each case compares the whole team before and after, so the cases would fail if a plan wrote or a refusal half-applied. It follows the pattern of test/mcp-orgteams.test.ts, adds no dependency, and cleans up its temp dir. I could not run it here: the file is not in my checkout of the branch, so this verdict rests on reading the diff against the tool. The forge check is the proof it is green.

Two things I would do next:

  1. Pin the admin-scope branch. The tool refuses an apply from a token below admin scope with forbidden, and every token here is admin scope. Add a read-only-scope token for the same admin and expect dryRun:false to be refused with no change.
  2. Assert the error code in the non-admin case, not_found and "no such tool here". Today isError alone would also pass for an unrelated failure such as a bad token.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs