Skip to content

Add failing schema rebuild repros for issue 3384#4389

Closed
andimarek wants to merge 1 commit into
masterfrom
test-3384-rebuild-schema
Closed

Add failing schema rebuild repros for issue 3384#4389
andimarek wants to merge 1 commit into
masterfrom
test-3384-rebuild-schema

Conversation

@andimarek
Copy link
Copy Markdown
Member

Summary

This PR intentionally adds failing Spock tests for #3384.

It covers two paths:

  • rebuilding a schema with GraphQLSchema.newSchema(schema).mutation((GraphQLObjectType) null).build()
  • deleting the mutation root via SchemaTransformer.transformSchemaWithDeletes(...), which is the traversal-based schema modification API for delete operations

Both tests currently fail with the same NullPointerException in GraphQLTypeResolvingVisitor.visitGraphQLObjectType, reached from SchemaUtil.replaceTypeReferences.

Findings

The traversal-based variant does not avoid the problem. Even with transformSchemaWithDeletes(...), the rebuilt schema loses the Node interface from the type map while Person still has a resolved Node interface. During replaceTypeReferences, GraphQLTypeResolvingVisitor maps Person.getInterfaces() through the rebuilt type map and receives null for Node.

My current assumption is that the issue is in the schema rebuild/type collection path. In particular, GraphQLTypeCollectingVisitor accounts for dangling replaced strong references from fields, arguments, input fields, and applied directive arguments, but not from object/interface implemented interfaces. SchemaTransformer.DummyRoot.rebuildSchema(...) also only promotes changed extra types into additional types; in this repro Node is visited as an extra type but unchanged, so it is not retained as an additional type.

Verification

This command is expected to fail on this PR:

./gradlew test --tests "graphql.schema.impl.SchemaUtilTest.can rebuild schema after removing root type that made an implemented interface reachable" --tests "graphql.schema.impl.SchemaUtilTest.can transform schema after deleting root type that made an implemented interface reachable"

Observed result: 2 tests run, 2 failed, both in GraphQLTypeResolvingVisitor.visitGraphQLObjectType.

git diff --check passes.

@github-actions
Copy link
Copy Markdown
Contributor

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 5645 (-188 🔴) 5636 (-141 🔴) 2 (+2 🔴) 0 (±0) 7 (-49)
Java 17 5645 (-188 🔴) 5635 (-141 🔴) 2 (+2 🔴) 0 (±0) 8 (-49)
Java 21 5645 (-188 🔴) 5635 (-141 🔴) 2 (+2 🔴) 0 (±0) 8 (-49)
Java 25 5645 (-188 🔴) 5635 (-141 🔴) 2 (+2 🔴) 0 (±0) 8 (-49)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 22612 (-752 🔴) 22573 (-564 🔴) 8 (+8 🔴) 0 (±0) 31 (-196)

Updated: 2026-05-20 03:46:21 UTC

@andimarek andimarek closed this May 20, 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.

1 participant