Repository navigation
Pin how type extensions behave before merging definitions - #948
Merged
Merged
Conversation
Characterization tests for what a user sees when types have extensions: the built types for every kind, lone and orphan extensions, wrong-kind warnings, error order and source names, union cycles and diamonds through extensions, and three edge cases (a type defined twice, an ignored scalar extension on an input, a reused TypeName in type errors). They pass on the current code, so merging each type with its extensions once can show it changed nothing.
|
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why
Agents working in graphql-java-tools keep repeating the same mistakes, and the repo should change so a change that looks right from one file is right for the whole repo. With extensions it's always the same one. A type and its extensions travel separately, so every reader of a type's fields, members or interfaces has to remember
withExtensions, and a reader that forgets still compiles and passes every test that has no extensions. The next PR merges each type with its extensions once. Before it moves anything, these tests pin what a user sees today, so that PR can show it changed nothing.Description
Tests only, nothing in
src/mainchanges.Query. It checks the built types printed in declaration order, thedefinitionandextensionDefinitionsgraphql-java gets, and a query through every extension field, member, value and input field, including an input that refers to itself through its extensionextend scalaron an input object still counts the input as a scalar, so aMapargument gets graphql-java's coerced values (enum constants) instead of Jackson's (strings)TypeDefinitionFactoryreuses oneTypeNamenode, a type error names its first use in a definition before any use in an extension, even when the extension is the one being builtThe last two look like bugs to me, and the first one is odd at best. I pinned them instead of fixing them since this PR shouldn't change behaviour, so fixing one later is a deliberate test change.
No release note, nothing changes for library users.
Checklist
To check the tests actually catch what they claim, I ran 38 one-line mutations of
src/mainagainst the 5 test classes. Each one drops awithExtensionsor an extension's directives, reverses the input field order, changes the wrong-kind WARN, reverts the extension merge, or undoes one of the edge cases above. Every new test fails under at least one of them, and every mutation fails at least one test. Six of them only fail existing tests, which already cover those spots: the two sealed-subclass lookups, nested-union discovery, implementors added by object extensions, the union repeat check and the type-error lookup in extensions.mvn clean verifypasses on JDK 17 with 452 tests, 12 more thanagent-friendly.