Repository navigation
test: fix all test type errors and typecheck tests in CI - #298
Merged
Merged
Conversation
Swaps @modelcontextprotocol/sdk 1.x for the v2 packages
(@modelcontextprotocol/server and /core, plus /client and /node for tests
and scripts). Ran the official v1-to-v2 codemod, then:
- Replace the SDK output-validation patch with lenientOutputSchema, a
Standard Schema wrapper that keeps the real schema in tools/list but only
warns on a mismatch. Tools that return text only get structuredContent {}.
- Make publishJsonSchema2020 a deprecated no-op, since v2 publishes JSON
Schema 2020-12 natively. Kept for hosted's adapter.
- Remove OptimizationV2Tool, which was never registered and used the
experimental tasks API that v2 drops.
- Move test request contexts to the v2 shape (http.authInfo) so the token
checks actually run.
- Replace the patch tests, which never went through the SDK, with tests
that make a real tools/call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up to #296. Adds structuredOf/textOf/resourceTextOf test helpers, fixes the ~450 errors tsconfig.test.json reported (about 200 already on main, the rest from SDK v2's open structuredContent type), adds noEmit to tsconfig.test.json and runs `npm run typecheck` in CI. Fixes tests the errors exposed: the zod 4 tuple traversal that never looked inside arrays, a structured-content test importing a nonexistent file, a stale directions input shape, and a SimplifyTool comparison that couldn't fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ctufts
previously approved these changes
Oct 23, 2026
# Conflicts: # CHANGELOG.md # src/utils/versionUtils-cjs.cjs # src/utils/versionUtils-cjs.d.cts # test/prompts/BasePrompt.test.ts # test/tools/difference-tool/DifferenceTool.test.ts # test/tools/intersect-tool/IntersectTool.test.ts # test/tools/union-tool/UnionTool.test.ts
ctufts
approved these changes
Oct 26, 2026
This was referenced Oct 26, 2026
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.
Follow-up to #296, stacked on it (base is
feat/mcp-sdk-v2; retarget to main once #296 merges).tsconfig.test.jsoncoverssrc/andtest/, but nothing ran it, so test type errors piled up: about 200 on main, plus about 250 more from SDK v2 typingstructuredContentas an open object. This gets them to 0 and addsnpm run typecheckto CI so they stay there.What changed
test/utils/resultTestUtils.ts:structuredOf<ToolOutput>(result)reads structured content as the tool's own exported output type, so a test that checks a field the schema doesn't have won't compile.textOf/resourceTextOfread text content and throw on the wrong content type instead of quietly readingundefined.typecheckscript (tsc -p tsconfig.test.json) runs before the tests.tsconfig.test.jsongetsnoEmit. Without it a plaintsc -p tsconfig.test.jsonwrites.jsfiles next to the sources, which is likely how the files in chore: remove compiled versionUtils-cjs output from src #297 got committed.BasePrompt.test.tsuses a small subclass that exposesvalidateArgumentsinstead of reaching into a protected method.HttpRequestmocks are typed withvi.fn<HttpRequest>.Tests that turned out to be wrong
input-schema-validation.test.ts: the check that no tool schema usesz.tuple()never looked inside arrays. Under zod 4,ZodArray._def.typeis the string'array', not the item schema. It uses zod 4's accessors now, and the negative test covers a tuple nested in an array.structured-content.test.ts: it importedMapboxApiBasedTool.output.schema.js, which has never existed, and calledsuper()without the requiredhttpRequest.cleanResponseData.test.ts: it used an old directions input shape. It now builds the input withDirectionsInputSchema.parse, so it can't drift again.|| Infinityfallback meant one comparison could never fail.run(), which those tools don't take. That dead argument is removed.No other assertions changed. Reads through
structuredOfare a bit stricter than the old?.chains: a missingstructuredContentnow fails with a TypeError instead of comparing againstundefined.Testing
npm run typecheck: 0 errors (was about 450)npm test: 96 files, 1080 tests passing🤖 Generated with Claude Code