Skip to content

test: cover isCompositeType identity across package entrypoints#4831

Closed
dosacha wants to merge 1 commit into
graphql:17.x.xfrom
dosacha:repro-4830-iscomposite-type-branding
Closed

test: cover isCompositeType identity across package entrypoints#4831
dosacha wants to merge 1 commit into
graphql:17.x.xfrom
dosacha:repro-4830-iscomposite-type-branding

Conversation

@dosacha

@dosacha dosacha commented Jun 29, 2026

Copy link
Copy Markdown

Summary

Adds integration coverage for isCompositeType identity across GraphQL.js package entrypoints and module conditions.

This is related to #4830, where upstream code using:

Object.values(schema.getTypeMap()).filter(isCompositeType)

can observe no composite types if GraphQL type instances and predicates come from different evaluated graphql module instances.

What changed

  • Extended the conditional exports integration check to verify that:
    • graphql and graphql/type share the same GraphQLObjectType
    • graphql and graphql/type share the same GraphQLString
    • graphql and graphql/type share the same isCompositeType
    • ESM and CJS imports share the same isCompositeType
    • object types constructed through root, subpath, ESM, and CJS entrypoints are accepted by all isCompositeType predicates
  • Added require('graphql/type') path checks alongside the existing require('graphql') path check.

Why

GraphQL.js v17 type predicates rely on internal __kind brand symbols. If supported package entrypoints or module conditions accidentally evaluate separate GraphQL.js module instances, a type created by one entrypoint can fail a predicate imported from another entrypoint.

This test does not change duplicate-module semantics. It only ensures that the supported package entrypoints and CJS/ESM conditions preserve predicate identity for the same built package.

Tests

Ran:

npm run node:test -- "src/type/__tests__/predicate-test.ts"
npm run node:test -- "src/jsutils/__tests__/instanceOf-test.ts"
npm run build:npm
npx prettier --check integrationTests/conditions/check.mjs integrationTests/conditions/cjs-importer.cjs
npx eslint --max-warnings 0 integrationTests/conditions/check.mjs integrationTests/conditions/cjs-importer.cjs
node --check integrationTests/conditions/check.mjs
node --check integrationTests/conditions/cjs-importer.cjs

Also ran a smoke check against the built npm package:

Module identity, subpath identity, and path checks passed.

Not run:

npm run check:integrations

because it requires the full Docker-based integration test environment.

Refs #4830

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 29, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: dosacha / name: dosacha (18d5a2f)

@dosacha dosacha force-pushed the repro-4830-iscomposite-type-branding branch from 2cf9bec to 18d5a2f Compare June 29, 2026 10:24
@dosacha dosacha marked this pull request as ready for review June 29, 2026 10:31
@yaacovCR

yaacovCR commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Hi, thanks for raising this PR and engaging with the repository. We appreciate it. In terms of this PR, I'm confused by #4830 => in the sense that although the internal mechanism of GraphQL schema element identify are now managed by symbols rather than instanceof, the underlying requirement to have a single graphql package in a given repo have not changed, see my comments there.

In terms of this PR, I do not think we need to add these tests. We need only a single test to prove we have imported the same package, which means our internal symbols are the same. Adding extra tests for just a single function does not do too much. Another way of thinking about this is that for completeness, we would then need to add every predicate.

Do you have any insight as to why #4830 apparently did not hit v16? That's where I'm at with this one, I have asked for a reproduction there.

Thanks again for contributing!

@yaacovCR yaacovCR closed this Jul 3, 2026
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.

2 participants