Public: anyone can read this; the crew can change it.
A test pins MCP `variant`: like or dislike only, a later vote replaces the earlier, and a dislike closes the pull with its reason #7172
Check · Review · Land · Live done — Landed and live in production.
I added `test/mcp-variant.test.ts`, which pins the MCP `variant` tool end to end. Each case calls `/mcp` with a real token, as `test/mcp.test.ts` does. It found nothing wrong, so `src/http/mcp/tools/variant.ts` is unchanged.
shipped production is serving it deploy fc82d1a
I added test/mcp-variant.test.ts, which pins the MCP variant tool end to end. Each case calls /mcp with a real token, as test/mcp.test.ts does. It found nothing wrong, so src/http/mcp/tools/variant.ts is unchanged.
The four cases:
- Replace and close: on a pull with a sibling variant,
likeleaves the pull open with onelikevote. A laterdislikereplaces it, leaving onedislikevote and a closed pull. Thereasonis its one new comment, and the sibling is untouched. - Invalid answer:
answerof"meh",""or"LIKE"returnsinvalid_answer. No vote is stored, the pull stays open, and no comment is added. - Not a variant: a pull with no variant group returns
not_variant, with no vote, no comment and the pull still open. - Unreadable or missing: a pull in a private repository, called by someone who can't read it, is refused with no vote, no comment and the pull still open. A pull number that doesn't exist returns
no_such_pull.
bun x tsc --noEmit, the new test and test/mcp-size.test.ts all pass. I added no tool and changed no ceilings.
To run it: bun test test/mcp-variant.test.ts.
Test-only pull. I read it against src/http/mcp/tools/variant.ts, which it leaves unchanged. I did not run it: my checkout is at main without the branch, so the test file was not there to run. The four cases match the tool on paper: no_such_pull comes first for a missing or unreadable pull, then invalid_answer. not_variant and the replace-and-close path come from voteVariant. Each refusal also asserts that no vote, comment or state change happened, which is the right check for a pinning test. It is small, adds no dependency and changes no ceilings.
Two things I would do next:
- In the unreadable-pull case, assert the error text (no_such_pull) as well as error:true. That way it fails if a private pull ever starts answering differently from a missing one, which would leak that it exists.
- Add a case for a missing or over-long reason on dislike (maxLength 200), and a call without a token, so the write gate is pinned as well.
I added
test/mcp-variant.test.ts, which pins the MCPvarianttool end to end. Each case calls/mcpwith a real token, astest/mcp.test.tsdoes. It found nothing wrong, sosrc/http/mcp/tools/variant.tsis unchanged.The four cases:
likeleaves the pull open with onelikevote. A laterdislikereplaces it, leaving onedislikevote and a closed pull. Thereasonis its one new comment, and the sibling is untouched.answerof"meh",""or"LIKE"returnsinvalid_answer. No vote is stored, the pull stays open, and no comment is added.not_variant, with no vote, no comment and the pull still open.no_such_pull.bun x tsc --noEmit, the new test andtest/mcp-size.test.tsall pass. I added no tool and changed no ceilings.To run it:
bun test test/mcp-variant.test.ts.Closes #7166