Cover the MCP metadata tools and transport edges (closes #83, closes #85) - #112
Merged
Conversation
) Both issues change server_test.go, so they land together rather than conflicting in one file. The three read-only metadata tools had no coverage through the stdio harness. Each success case asserts what makes the response useful rather than that a response arrived: get_schema's sha256 and bytes must describe the schema text actually served, not some other copy — a digest that does not describe the payload is worse than none, because a caller pins against it — describe_runtime must identify itself, list versions and state artifact provenance, and its claimed versions must include the one get_schema really serves. Bad arguments are asserted to be tool errors inside SUCCESSFUL JSON-RPC responses, which is what lets a client tell "your call was wrong" from "the transport broke". The transport table pins what must and must NOT produce a response: a parse error carrying a null id, blank and whitespace-only lines skipped, ping, the default protocol version, notifications and unknown notifications answered with nothing, and a valid request still processed after a malformed line. Three claims mutation-checked, and two of the three mutations initially did nothing while the tests reported ok — which proves nothing about the tests. The notification mutation was a genuine no-op because reply() already returns false whenever a message has no id, so breaking it requires bypassing reply altogether; redone that way it fails. Likewise the digest mutation had to corrupt the metadata after describe.Schema rather than at the call site. Both fail correctly once they actually take effect, as does ending the stream on a malformed line. Payload shapes were read from a live server rather than guessed: my first version asserted a schema field and an artifacts array that do not exist. Signed-off-by: kikashy <kikashy@hotmail.com>
kikashy
force-pushed
the
mcp-metadata-and-transport
branch
from
August 15, 2026 01:05
8d0f634 to
e1f39b9
Compare
|
🎉 Thank you for your contribution to Judgment Pack! If you’d like another task, choose a path that interests you: |
kikashy
added a commit
that referenced
this pull request
Aug 15, 2026
PR #110 covered the same stdio transport cases as #112 and was opened 43 minutes earlier. #112 merged first, which was my error: issue #85 carried no assignee and no comment, and I read the issue list without checking whether an open PR already closed it. One assertion in #110 is better than the one that merged. It checks that ping returns an EMPTY result object; #112 only checked that the id was echoed. An echoed id shows that something answered, so a ping returning a payload passes that check and is still wrong. Verified: making ping return {"pong": true} is caught by this assertion and was not caught before. Landing it here so the credit is a merged commit rather than an offer. Signed-off-by: kikashy <kikashy@hotmail.com> Co-authored-by: Bo Zhang <187063395+Tethys0@users.noreply.github.com>
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 #83. Closes #85.
Both issues change
internal/mcp/server_test.go, so they land together rather than conflicting in one file.The metadata tools (#83)
Each success case asserts what makes the response useful, not that a response arrived:
get_schema—sha256andbytesmust describe the schema text actually served. A digest that does not describe its payload is worse than no digest, because a caller pins against it. The served text is also asserted to be valid JSON.describe_runtime— identifies itself, lists supported versions, states artifact provenance — and its claimed versions must include the oneget_schemareally serves. Two payloads that disagree would otherwise both pass.test_conformance— the bundled corpus passes against its own runtime, withpassed == totaland the corpus digest and target version named.Bad arguments are asserted to be tool errors inside successful JSON-RPC responses, never top-level protocol errors — the distinction that lets a client tell "your call was wrong" from "the transport broke".
The transport table (#85)
Pins what must and must not produce a response: parse error with a null id, blank and whitespace-only lines skipped,
ping, the default protocol version, notifications and unknown notifications answered with nothing, and a valid request still processed after a malformed line.Two mutations that initially did nothing
Worth recording, because the tests reported
okand that proved nothing:reply()already returnsfalsewhenever a message has no id — breaking it requires bypassingreplyentirelyget_schemadigest wrongdescribe.Schema, not at the call siteRedone so they actually take effect, both fail correctly:
Ending the stream on a malformed line also fails, as it should.
Payload shapes read, not guessed
My first version asserted a
schemafield and anartifactsarray that do not exist. I read the real payloads from a live server and rewrote against the actual contract — the schema text arrives as tool content, and provenance is a singleartifactProvenancestring.go test ./internal/mcpandgo test ./...pass;gofmtclean. Test file only.🤖 Generated with Claude Code