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

A test pins MCP `asked`: `show` and `order` take only their known values, and a repository the caller cannot read lists nothing #7180

Merged opened this

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

Merged

I added `test/mcp-asked-args.test.ts`. It passes, along with `test/mcp-size.test.ts`, and `bun x tsc --noEmit` is clean. The test found no wrong behaviour, so I changed no module. I did not run the whole suite; the forge's check does that on this push.

shipped production is serving it deploy 9ac397e

opened this

I added test/mcp-asked-args.test.ts. It passes, along with test/mcp-size.test.ts, and bun x tsc --noEmit is clean. The test found no wrong behaviour, so I changed no module. I did not run the whole suite; the forge's check does that on this push.

Each case calls the asked tool through /mcp with a real read-only token, in a repository with one public and one private repo of three asks each, one of them closed.

  • Defaults: with no arguments the tool lists unshipped asks, oldest first, and leaves out the closed one. The result equals what askedIn returns, which is what the /asked page reads.
  • Known values: all six show × order combinations equal the same call to askedIn. show: "all" includes the closed ask, and order: "newest" is the exact reverse of the default.
  • Refusals: show: "everything" gives invalid_show and order: "random" gives invalid_order. A valid show with a bad order is still invalid_order.
  • Unreadable repo: a token for a user who can't write alice/secret gets not_found for it, with no ask titles in the reply. Without a repo argument that user's list is empty. The owner sees all three asks in the same repo.

I did not test repo with a malformed value, or the 200-row limit.

Closes #7168

commented

I added test/mcp-asked-args.test.ts. It passes, along with test/mcp-size.test.ts, and bun x tsc --noEmit is clean. The test found no wrong behaviour, so I changed no module. I did not run the whole suite; the forge's check does that on this push.

Each case calls the asked tool through /mcp with a real read-only token, in a repository with one public and one private repo of three asks each, one of them closed.

  • Defaults: with no arguments the tool lists unshipped asks, oldest first, and leaves out the closed one. The result equals what askedIn returns, which is what the /asked page reads.
  • Known values: all six show × order combinations equal the same call to askedIn. show: "all" includes the closed ask, and order: "newest" is the exact reverse of the default.
  • Refusals: show: "everything" gives invalid_show and order: "random" gives invalid_order. A valid show with a bad order is still invalid_order.
  • Unreadable repo: a token for a user who can't write alice/secret gets not_found for it, with no ask titles in the reply. Without a repo argument that user's list is empty. The owner sees all three asks in the same repo.

I did not test repo with a malformed value, or the 200-row limit.

Approved

Test-only pull. It exercises the real /mcp door with real tokens, pins both refusal words, all six show×order combinations against askedIn (what the page reads), and the unreadable-repo case, whose reply carries no titles. Matches the tool source (invalid_show / invalid_order). No new dependency, no dead code. Two things to do next: (1) the unreadable case only uses a private repo; add the public repo alice/open for bob, since asked lists writable repos and a public read-only repo should also answer not_found. (2) Add a malformed repo value (alice, a/b/c) and the 200-row limit, which the description says are untested. The file header says cannot write in one place and the title says cannot read; make the wording match.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs