Skip to content

test: cover isCompositeType identity across package entrypoints#4831

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

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
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.

1 participant