Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix "Unknown fragment" validation error #3861

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

motemen
Copy link

@motemen motemen commented Feb 5, 2025

fixes #3620

Above error occurs because it tries to parse already-parsed GraphQL documents as languages like TypeScript or so. This PR fixes this behavior.

Copy link

changeset-bot bot commented Feb 5, 2025

🦋 Changeset detected

Latest commit: 9975944

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
graphql-language-service-server Patch

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

Copy link

linux-foundation-easycla bot commented Feb 5, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@wenchienchen-asana
Copy link

@acao @dimaMachina apologies for the tag, but is there anything non-maintainers can do to help get this fix merged and released? I believe this fixes a longstanding issue that has prevented many people from using the latest version of the VS Code plugin. Thanks!

@VinceBT-BG
Copy link

@wenchienchen-asana Can you take a look at the two check errors ?

@wenchienchen-asana
Copy link

wenchienchen-asana commented Feb 21, 2025

I don't think they're related to this change... The Jest tests pass when I run them locally, so maybe they're flaky or there's some issue specific to the CI setup?

@acao
Copy link
Member

acao commented Feb 27, 2025

I am also getting test failures as well, it seems that there were some changes to to the integration tests since I last worked on them and they are failing for me locally and in CI here. The fs mocking appears to be the culprit, which can be quite flaky. Thus this nonsensical error, which was fixed last year:

  EEXIST, file already exists '/tmp/graphql-language-service'

      141 |
      142 |     if (!existsSync(this._tmpDirBase)) {
    > 143 |       void mkdirSync(this._tmpDirBase);
          |                     ^
      144 |     }
      145 |   }

The change makes sense, but I need to get these tests working, because these tests are already designed to test for this bug, if you see the other fragment related tests in this file!

update: good news!

it appears related to this issue:
tschaub/mock-fs#380

funny thing, in MessageProcessor.ts if i just change the existsSync import from node:fs to fs, the tests pass, including yours!

@dimaMachina are we going to run into runtime/build issues if we change from node:fs to fs to import in this one file? perhaps we should patch fs-mock if so?

@acao
Copy link
Member

acao commented Feb 27, 2025

@motemen I've confirmed the fix behaviorally, and the new test fails if I revert the change, looks awesome!

the fix for mock-fs should pass in CI i hope, the delta may be node version related

`mock-fs` uses `process.binding('fs')`, so it cannot support mocking the `node:fs` import alias it seems. this should fix test failures in CI (for node 22 at least)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[lsp-server] 🐞 VSCode validation error Unknown fragment in v0.11.0
4 participants