fix(graphql-language-service-server): import Logger from vscode-jsonrpc#4331
Conversation
Logger is defined and exported by vscode-jsonrpc (a direct dependency) and only reached vscode-languageserver through a transitive re-export. tsgo failed to resolve that re-export on CI, breaking types:check with "Module 'vscode-languageserver' has no exported member 'Logger'". Import Logger from the package that owns the type to avoid the fragile re-export chain. Closes graphql#4330.
🦋 Changeset detectedLatest commit: f0e2a93 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
trevor-scheer
left a comment
There was a problem hiding this comment.
Fix LGTM but is the PR description correct?
My understanding is that this is a turbo cache issue, but the description also says not reproducible on Mac / platform-specific. Are both things true? Platform-specific would be surprising to me.
|
@trevor-scheer Both are true, and they answer two different questions:
To be fully transparent: I'm confident about the Turbo cache behavior and the fix. The platform mechanism is my best inference, since I only have macOS to test on and can't directly inspect the Linux Happy to tighten the PR description to separate these two points more clearly if that helps. |
Summary
graphql-language-service-serverimported theLoggertype fromvscode-languageserver, butLoggeris defined invscode-jsonrpcand only reachesvscode-languageserverthrough a transitive re-export (export * from 'vscode-languageserver-protocol/'). On CI this breakstypes:check:This imports
Loggerfromvscode-jsonrpcinstead, which owns the type and is already a direct dependency of the package (vscode-jsonrpc: ^8.0.1), avoiding the fragile re-export chain.Fixes #4330.
Two separate things are going on
These answer different questions and are both true:
Why it surfaced now (Turborepo cache).
graphql-language-service-server#types:checkis a cache hit for any PR that does not invalidate it, so the stale green result is reused. Only a PR that changesgraphql-language-service(a dependency) busts that cache and forces a real re-run. That is when the latent error becomes visible (it surfaced on #4329, agraphql-language-servicechange).Where the type error manifests (platform). When
types:checkactually runs, it fails on CI (Linux) but passes locally (macOS). The lockfile pins identical dependency versions in both places (vscode-languageserver@8.0.1 -> vscode-languageserver-protocol@3.17.1), so resolution is the only variable.tsgois@typescript/native-preview, which ships a separate compiled native binary per OS/arch (native-preview-linux-x64on CI vsnative-preview-darwin-arm64locally), and the pre-release binaries appear to resolve the trailing-slash re-export differently.I am confident about the cache behavior and the fix. The platform mechanism is my best inference, since I can only test on macOS and cannot directly inspect the Linux
tsgo's resolution. Either way the fix is robust because it importsLoggerfrom the package that owns it.Verification
tsgo --noEmitandoxlintpass locally on the changed package.types:checkand forces a fresh run on Linux, andTypes Check(along with all other checks) passes.