Repository navigation
Conversation
`requestReverification` forwarded the caller's arguments to
`request_reverification` without checking them. Every other local
refusal in the SDK happens before a request: `readCoverageFiles`
refuses a malformed commit SHA, a report count outside 1 to 50,
duplicate names and an oversized body, and the transport refuses an
MCP body over 8,192 bytes.
The documented arguments of `request_reverification` are checkable
without a round trip: `commit_sha` matches `^[0-9a-fA-F]{40}$`,
`finding_ids` holds 1 to 20 distinct findings of one review, and an
optional `note` holds 1 to 2,000 characters. Sending a request that
fails one of them costs the three-request MCP handshake, and
`request_reverification` is a write whose allowance the server keeps
per finding and per pull request. A write that is refused after the
server records it is also not proof that nothing happened, so a
request the server would refuse on its arguments alone is never worth
sending.
Build the tool arguments through a checked helper. The note's limit
counts characters, so count code points rather than the two UTF-16
units a surrogate pair spends; a note of 1,500 astral characters is
within the limit even though its `length` is 3,000. The commit accepts
either case, unlike the lowercase `tested_sha` a coverage upload takes.
An omitted note or organization stays absent rather than arriving as
null, and the forwarded finding list is a copy of the caller's.
`requestReverification` becomes `async` so an invalid request rejects
with a `TypeError` rather than throwing synchronously, matching
`uploadCoverageFiles`.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #126.
FixesClient.requestReverificationforwarded the caller's arguments to therequest_reverificationMCP tool unchecked, so a request the tool documents as invalid was still sent over the wire. This builds the tool arguments through a checked helper instead.Why this is worth refusing locally
The SDK already refuses locally what the server would refuse.
readCoverageFilessays so in its own docstring, andTransport.requestrefuses an MCP body over 8,192 bytes before sending it.request_reverificationwas the gap.Sending a request that the tool will reject on its arguments alone costs more than a wasted round trip:
request_reverificationis a write with an allowance the server keeps per finding and per pull request, documented as 3 requests per finding per head and 10 per pull request per hour.What is checked
Taken from the MCP tools reference and this repository's README, not inferred:
commit_shafinding_idsreview_idnoteTwo details the checks get right rather than approximately:
^[0-9a-fA-F]{40}$, so an uppercase commit is accepted. This deliberately does not reuse the lowercase rulereadCoverageFilesapplies totested_sha, which is a different field with a different documented contract.length3,000 and is within the documented limit; measuring withlengthwould refuse a request the server accepts. There is a test for exactly this.An omitted
noteororganization_idstays absent rather than arriving as null, and the forwarded finding list is a copy of the caller's array.requestReverificationbecomesasyncso an invalid request rejects with aTypeErrorrather than throwing synchronously, which is howuploadCoverageFilesreports the same class of refusal. It already returned a promise, so this is not a signature change for callers.Scope
No generated code, OpenAPI contract, or workflow is touched, per the README's contribution note. Behaviour is unchanged for any request that is already valid: the existing
fix helpers preserve unavailable context and never retry a verification requesttest passes without modification.The forwarded
finding_idscopy is a by-product of building the arguments, not a fix for the general nested-argument snapshot inMcpTools.call. That is a separate concern already covered by #68 and #66, and this change does not touchsrc/mcp.ts.Verification
The new test asserts that each invalid case rejects with
TypeErrorand that the server observed no request at all, so no handshake and no request allowance is spent. It also asserts the accepted cases are sent unchanged.Removing
src/fixes.tsfrom the working tree and rebuilding makes the new test fail withMissing expected rejection (TypeError): no findings, so it covers the change rather than restating it.Local run on Node 22, mirroring
.github/workflows/ci.yml: