Fix the SDK vs Spec types test that is breaking CI #908
+38
−31
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.
Description
spec.types.test.ts
WithJSONRPC<T>
andWithJSONRPCRequest<T>
sdk
argument type wrapped byWithJSONRPC
sdk
argument type wrapped byWithJSONRPCRequest
Error
toMISSING_SDK_TYPES
array (inner error object of aJSONRPCError
)specTypes
length check to match current actual length (92)Motivation and Context
Tl;dr
A recent set of changes to the
schema.ts
file in the specification repo has broken a test in this repo which checks that our types all match the spec. This causes CI to fail and no further PRs can be merged until this is fixed.The core issue stemmed from a deliberate design choice in the SDK: internal types for requests and notifications omit the
jsonrpc
andid
properties for cleaner internal handling, while the specification-generated types define the full on-the-wire format, which includes them.This PR fixes that by addressing the mismatch with two helper types that wrap SDK types before comparing them to spec types.
Here's what happened:
src/spec.types.test.ts
similar to:src/spec.types.tst.ts
file, I replaced my version of it from local history removed thenpm run fetch:spec-types
from thetest
npm script and ran it. All passed.After further sleuthing with @felixweinberger in this Discord thread, we narrowed it down to this PR in the specification repo.
The author of the spec repo PR, @hesreallyhim did some looking into it last night and his response was:
How Has This Been Tested?
All tests now run locally:

This is the first PR since the problem occured that passes CI
Breaking Changes
Nope.
Types of changes
Checklist
Additional context