From 32f3ebc512e8294751d578588e6ec98737f1f9e4 Mon Sep 17 00:00:00 2001 From: Oryan Date: Wed, 4 Nov 2026 13:49:49 -0500 Subject: [PATCH 1/7] Add the verify-tools skill The probe runs from each checkout's own copy, hashes with sha256sum and leaves Maven JVM flags to the machine. --- .claude/skills/verify-tools/SKILL.md | 83 ++++++++ .../skills/verify-tools/features/README.md | 45 +++++ .../features/arguments-and-inputs.md | 95 ++++++++++ .../features/async-and-subscriptions.md | 35 ++++ .../features/context-and-environment.md | 58 ++++++ .../features/directives-and-relay.md | 99 ++++++++++ .../verify-tools/features/generic-wrappers.md | 58 ++++++ .../features/interfaces-and-unions.md | 41 ++++ .../features/optional-data-fetcher-results.md | 35 ++++ .../skills/verify-tools/features/proxies.md | 36 ++++ .../verify-tools/features/schema-building.md | 53 ++++++ .../verify-tools/features/schema-options.md | 21 +++ .../verify-tools/features/type-extensions.md | 62 ++++++ .claude/skills/verify-tools/probe.sh | 177 ++++++++++++++++++ .claude/skills/verify-tools/probe/pom.xml | 95 ++++++++++ .../src/main/kotlin/probe/DirectiveDump.kt | 65 +++++++ .../probe/src/main/kotlin/probe/Main.kt | 125 +++++++++++++ .../probe/src/main/kotlin/scenarios/Async.kt | 48 +++++ .../src/main/kotlin/scenarios/Bookstore.kt | 70 +++++++ .../kotlin/scenarios/ContextAndEnvironment.kt | 59 ++++++ .../main/kotlin/scenarios/ContextMisbound.kt | 35 ++++ .../main/kotlin/scenarios/DirectiveDrift.kt | 65 +++++++ .../src/main/kotlin/scenarios/Directives.kt | 42 +++++ .../kotlin/scenarios/DirectivesInvalid.kt | 22 +++ .../kotlin/scenarios/GenericInputResolver.kt | 23 +++ .../probe/src/main/kotlin/scenarios/Inputs.kt | 44 +++++ .../src/main/kotlin/scenarios/JdkProxy.kt | 45 +++++ .../src/main/kotlin/scenarios/NestedUnions.kt | 24 +++ .../main/kotlin/scenarios/NestedWrappers.kt | 110 +++++++++++ .../kotlin/scenarios/NestedWrappersExact.kt | 85 +++++++++ .../main/kotlin/scenarios/OptionalResults.kt | 72 +++++++ .../src/main/kotlin/scenarios/Options.kt | 27 +++ .../src/main/kotlin/scenarios/Polymorphism.kt | 37 ++++ .../main/kotlin/scenarios/ReadOnlySchema.kt | 41 ++++ .../main/kotlin/scenarios/RecursiveInputs.kt | 28 +++ .../src/main/kotlin/scenarios/ScalarArgs.kt | 100 ++++++++++ .../main/kotlin/scenarios/ScalarDirectives.kt | 43 +++++ .../src/main/kotlin/scenarios/Scenario.kt | 32 ++++ .../src/main/kotlin/scenarios/Sourceless.kt | 98 ++++++++++ .../main/kotlin/scenarios/TypeExtensions.kt | 45 +++++ .../scenarios/TypeExtensionsInputOrder.kt | 23 +++ .../scenarios/TypeExtensionsRepeatedFields.kt | 55 ++++++ .../kotlin/scenarios/TypeExtensionsSealed.kt | 36 ++++ .../main/kotlin/scenarios/UnmappedInputs.kt | 38 ++++ .../src/main/kotlin/scenarios/WiringShapes.kt | 67 +++++++ .../probe/src/main/resources/logback.xml | 21 +++ .../scenarios/async/01-query.graphql | 5 + .../scenarios/async/02-subscription.graphql | 3 + .../resources/scenarios/async/schema.graphqls | 14 ++ .../extension.graphqls | 3 + .../scenarios/bookstore/01-books.graphql | 9 + .../scenarios/bookstore/02-book-by-id.graphql | 7 + .../bookstore/02-book-by-id.variables.json | 1 + .../scenarios/bookstore/schema.graphqls | 24 +++ .../context-and-environment/01-query.graphql | 7 + .../context-and-environment/schema.graphqls | 12 ++ .../01-without-argument.graphql | 3 + .../context-misbound/02-with-argument.graphql | 3 + .../03-context-and-correct.graphql | 4 + .../context-misbound/04-type-resolver.graphql | 3 + .../context-misbound/schema.graphqls | 11 ++ .../schema.graphqls | 3 + .../scenarios/directive-drift/schema.graphqls | 79 ++++++++ .../directives-invalid/01-query.graphql | 8 + .../directives-invalid/schema.graphqls | 20 ++ .../scenarios/directives/01-uppercase.graphql | 4 + .../directives/02-deprecated.graphql | 9 + .../directives/03-connection.graphql | 14 ++ .../scenarios/directives/schema.graphqls | 13 ++ .../generic-input-resolver/01-plain.graphql | 1 + .../generic-input-resolver/02-generic.graphql | 1 + .../generic-input-resolver/schema.graphqls | 8 + .../scenarios/inputs/01-search.graphql | 4 + .../scenarios/inputs/02-nickname.graphql | 5 + .../scenarios/inputs/03-add-book.graphql | 14 ++ .../inputs/03-add-book.variables.json | 1 + .../scenarios/inputs/04-invalid-enum.graphql | 3 + .../scenarios/inputs/schema.graphqls | 34 ++++ .../scenarios/jdk-proxy/01-query.graphql | 1 + .../scenarios/jdk-proxy/schema.graphqls | 5 + .../nested-unions/01-results.graphql | 9 + .../scenarios/nested-unions/schema.graphqls | 15 ++ .../nested-wrappers-exact/01-dates.graphql | 1 + .../02-tried-dates.graphql | 1 + .../03-plain-future-items.graphql | 1 + .../04-batched-items.graphql | 1 + .../05-boxed-items.graphql | 1 + .../06-later-items.graphql | 1 + .../07-suspend-plain-future-items.graphql | 1 + .../nested-wrappers-exact/schema.graphqls | 15 ++ .../01-nullable-items.graphql | 1 + .../02-non-null-items.graphql | 1 + .../03-type-variable-strings.graphql | 1 + .../nested-wrappers-suspend/schema.graphqls | 9 + .../nested-wrappers/01-payload.graphql | 1 + .../nested-wrappers/02-payloads.graphql | 1 + .../03-payload-strings.graphql | 1 + .../nested-wrappers/04-items.graphql | 1 + .../nested-wrappers/05-item-names.graphql | 1 + .../06-future-of-future.graphql | 1 + .../07-future-of-tries.graphql | 1 + .../08-tries-of-futures.graphql | 1 + .../nested-wrappers/09-loaded-items.graphql | 1 + .../10-failed-try-in-list.graphql | 1 + .../11-failed-future-in-list.graphql | 1 + .../nested-wrappers/12-controls.graphql | 1 + .../scenarios/nested-wrappers/schema.graphqls | 23 +++ .../01-optional-result-list.graphql | 1 + .../optional-results-list/schema.graphqls | 7 + .../01-optional-result.graphql | 1 + .../02-result-of-optional.graphql | 1 + .../optional-results-mixed/schema.graphqls | 8 + .../01-optional-result-of-result.graphql | 1 + .../optional-results-nested/schema.graphqls | 7 + .../01-optional-result.graphql | 1 + .../02-optional-result-name.graphql | 1 + .../03-empty-optional-result.graphql | 1 + .../optional-results/schema.graphqls | 9 + .../scenarios/options/01-fields.graphql | 5 + .../options/02-schema-introspection.graphql | 3 + .../options/03-type-introspection.graphql | 3 + .../scenarios/options/schema.graphqls | 4 + .../scenarios/polymorphism/01-node.graphql | 11 ++ .../scenarios/polymorphism/02-union.graphql | 7 + .../scenarios/polymorphism/schema.graphqls | 20 ++ .../read-only-schema/01-interface.graphql | 3 + .../read-only-schema/02-union.graphql | 3 + .../read-only-schema/03-no-mutation.graphql | 3 + .../read-only-schema/schema.graphqls | 29 +++ .../recursive-inputs/01-describe.graphql | 5 + .../01-describe.variables.json | 1 + .../recursive-inputs/02-introspect.graphql | 6 + .../recursive-inputs/schema.graphqls | 29 +++ .../scalar-args/01-custom-scalar.graphql | 1 + .../scenarios/scalar-args/02-id.graphql | 1 + .../scalar-args/03-nested-sets.graphql | 1 + .../scalar-args/04-nested-lists.graphql | 1 + .../05-empty-kotlin-scalar.graphql | 1 + .../06-marked-empty-kotlin-scalars.graphql | 1 + ...tional-marked-empty-kotlin-scalars.graphql | 4 + .../scenarios/scalar-args/schema.graphqls | 27 +++ .../01-introspect-scalars.graphql | 3 + .../scalar-directives/02-use-scalars.graphql | 6 + .../scalar-directives/schema.graphqls | 17 ++ .../sourceless-misbound/01-thumbnail.graphql | 3 + .../sourceless-misbound/schema.graphqls | 12 ++ .../sourceless-shadowed/01-shadowed.graphql | 3 + .../sourceless-shadowed/schema.graphqls | 12 ++ .../01-helper.graphql | 3 + .../sourceless-unimplemented/schema.graphqls | 13 ++ .../sourceless/01-local-context.graphql | 3 + .../scenarios/sourceless/02-contexts.graphql | 3 + .../scenarios/sourceless/schema.graphqls | 18 ++ .../01-count.graphql | 3 + .../schema.graphqls | 15 ++ .../01-kept-declarations.graphql | 10 + .../02-introspection.graphql | 9 + .../schema.graphqls | 72 +++++++ .../01-pets-and-animals.graphql | 11 ++ .../type-extensions-sealed/schema.graphqls | 30 +++ .../scenarios/type-extensions/01-node.graphql | 16 ++ .../02-search-and-enums.graphql | 10 + .../type-extensions/03-introspection.graphql | 13 ++ .../scenarios/type-extensions/schema.graphqls | 73 ++++++++ .../unmapped-inputs/01-ignored.graphql | 3 + .../scenarios/unmapped-inputs/02-typo.graphql | 3 + .../scenarios/unmapped-inputs/schema.graphqls | 21 +++ .../scenarios/wiring-shapes/01-trees.graphql | 3 + .../scenarios/wiring-shapes/02-person.graphql | 4 + .../scenarios/wiring-shapes/schema.graphqls | 32 ++++ 170 files changed, 3678 insertions(+) create mode 100644 .claude/skills/verify-tools/SKILL.md create mode 100644 .claude/skills/verify-tools/features/README.md create mode 100644 .claude/skills/verify-tools/features/arguments-and-inputs.md create mode 100644 .claude/skills/verify-tools/features/async-and-subscriptions.md create mode 100644 .claude/skills/verify-tools/features/context-and-environment.md create mode 100644 .claude/skills/verify-tools/features/directives-and-relay.md create mode 100644 .claude/skills/verify-tools/features/generic-wrappers.md create mode 100644 .claude/skills/verify-tools/features/interfaces-and-unions.md create mode 100644 .claude/skills/verify-tools/features/optional-data-fetcher-results.md create mode 100644 .claude/skills/verify-tools/features/proxies.md create mode 100644 .claude/skills/verify-tools/features/schema-building.md create mode 100644 .claude/skills/verify-tools/features/schema-options.md create mode 100644 .claude/skills/verify-tools/features/type-extensions.md create mode 100755 .claude/skills/verify-tools/probe.sh create mode 100644 .claude/skills/verify-tools/probe/pom.xml create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/probe/DirectiveDump.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Async.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Bookstore.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextAndEnvironment.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextMisbound.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectiveDrift.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Directives.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectivesInvalid.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/GenericInputResolver.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Inputs.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/JdkProxy.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedUnions.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappers.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappersExact.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/OptionalResults.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Options.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Polymorphism.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ReadOnlySchema.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/RecursiveInputs.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarArgs.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarDirectives.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Scenario.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Sourceless.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensions.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsInputOrder.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsRepeatedFields.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsSealed.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/UnmappedInputs.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/kotlin/scenarios/WiringShapes.kt create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/logback.xml create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/async/01-query.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/async/02-subscription.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/async/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore-missing-resolver/extension.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/01-books.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/02-book-by-id.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/02-book-by-id.variables.json create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/context-and-environment/01-query.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/context-and-environment/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/01-without-argument.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/02-with-argument.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/03-context-and-correct.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/04-type-resolver.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/directive-drift-undeclared/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/directive-drift/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/directives-invalid/01-query.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/directives-invalid/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/01-uppercase.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/02-deprecated.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/03-connection.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/01-plain.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/02-generic.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/01-search.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/02-nickname.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/03-add-book.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/03-add-book.variables.json create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/04-invalid-enum.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/jdk-proxy/01-query.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/jdk-proxy/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-unions/01-results.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-unions/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/01-dates.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/02-tried-dates.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/03-plain-future-items.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/04-batched-items.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/05-boxed-items.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/06-later-items.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/07-suspend-plain-future-items.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/01-nullable-items.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/02-non-null-items.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/03-type-variable-strings.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/01-payload.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/02-payloads.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/03-payload-strings.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/04-items.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/05-item-names.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/06-future-of-future.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/07-future-of-tries.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/08-tries-of-futures.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/09-loaded-items.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/10-failed-try-in-list.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/11-failed-future-in-list.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/12-controls.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-list/01-optional-result-list.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-list/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/01-optional-result.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/02-result-of-optional.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-nested/01-optional-result-of-result.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-nested/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/01-optional-result.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/02-optional-result-name.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/03-empty-optional-result.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/options/01-fields.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/options/02-schema-introspection.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/options/03-type-introspection.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/options/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/01-node.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/02-union.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/01-interface.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/02-union.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/03-no-mutation.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/01-describe.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/01-describe.variables.json create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/02-introspect.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/01-custom-scalar.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/02-id.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/03-nested-sets.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/04-nested-lists.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/05-empty-kotlin-scalar.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/06-marked-empty-kotlin-scalars.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/07-optional-marked-empty-kotlin-scalars.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/01-introspect-scalars.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/02-use-scalars.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-misbound/01-thumbnail.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-misbound/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-shadowed/01-shadowed.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-shadowed/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-unimplemented/01-helper.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-unimplemented/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/01-local-context.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/02-contexts.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-input-order/01-count.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-input-order/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/01-kept-declarations.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/02-introspection.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-sealed/01-pets-and-animals.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-sealed/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/01-node.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/02-search-and-enums.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/03-introspection.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/01-ignored.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/02-typo.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/schema.graphqls create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/01-trees.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/02-person.graphql create mode 100644 .claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/schema.graphqls diff --git a/.claude/skills/verify-tools/SKILL.md b/.claude/skills/verify-tools/SKILL.md new file mode 100644 index 00000000..e05f506c --- /dev/null +++ b/.claude/skills/verify-tools/SKILL.md @@ -0,0 +1,83 @@ +--- +name: verify-tools +description: Prove a graphql-java-tools behavior the way a consuming app sees it. Installs this checkout into a private Maven repo, builds a schema from SDL files and resolver classes in a separate probe project through the public API, runs GraphQL operations, and saves the printed schema, JSON results and library warnings as evidence. Use to confirm a fix or feature works from the outside (not just in the library's own unit tests), or to reproduce an issue report. Run it before pushing any schema-building change to an open PR, including refactors and new or changed library warnings, whose only proof is the probe's log. +--- + +# Verify graphql-java-tools from a consumer + +`probe/` is a separate Maven project that depends on the jar installed from a checkout, so it sees only the public API, +unlike `src/test`. `mvn verify` still runs for every change. This skill proves one behavior end to end in minutes, and is +where bugfixes and small features stop. + +## Run + +`probe.sh` sits next to this file and verifies the checkout of the current directory. Every clone and worktree has its +own copy, so run it from the checkout root. To verify a commit that predates this skill, check it out in its own worktree +and run another checkout's `probe.sh` from inside it. + +```bash +.claude/skills/verify-tools/probe.sh doctor # checkout, branch, install state, lock +.claude/skills/verify-tools/probe.sh list # scenario names +.claude/skills/verify-tools/probe.sh run [--graphql-java ] # build the schema, run every operation +.claude/skills/verify-tools/probe.sh clean # remove this checkout's work dir, keep evidence +``` + +- `run` first installs the checkout into a private Maven repo under `$TMPDIR/verify-tools/work/-/` when + the install is missing or stale, meaning HEAD or uncommitted `pom.xml`/`src/` changes differ from the last install. It + reads `~/.m2` but never writes it. The work dir is keyed on the checkout's path, so clones and worktrees run in parallel, + even when two share a folder name. If `doctor` shows the + lock held by a live pid, wait for that run. +- It builds the schema from the scenario's `parser()`, prints it, then executes every `*.graphql` in + `probe/src/main/resources/scenarios//` in name order, with `.variables.json` as variables. It collects + subscription events until the stream completes, for at most 10 seconds. +- Exit `0`: the schema built and every operation ran, though operations can still return GraphQL errors. `2`: the build + threw. `1`: harness failure (install log or `maven.log`). `64`: bad usage. +- `--graphql-java` swaps only the runtime graphql-java, like a user who pins another version. It doesn't recompile the + library against it. `--skip-install` runs a stale install on purpose and doesn't count as proof. + +## Evidence + +`run` prints its evidence directory, `$TMPDIR/verify-tools/evidence/-[-gj][-]/`, on its last +line. + +| File | Holds | +|---|---| +| `summary.txt` | Jars actually loaded, Java version, unused definitions, build result, errors per operation | +| `run.txt` | Checkout, commit, source fingerprint and install stamp, command, exit code | +| `schema.graphqls` | The executable schema as graphql-java prints it, generated types included | +| `.json` | The spec-shaped result, `events` for a subscription, or `threw` when `execute` threw | +| `probe.log` | WARN and above, plus INFO from `graphql.kickstart.tools`, where the library's build warnings land | +| `inspect.txt` | What the scenario's `inspect(schema)` returned | +| `build-error.txt` | Stack trace when the build threw | + +Proof standards: + +- `summary.txt`'s `graphql-java-tools jar` is inside the work dir, and `run.txt`'s fingerprint equals its install stamp. + Otherwise you tested another build. +- Quote the operation and the relevant part of `.json`. Cite `schema.graphqls` for schema shape, `probe.log` for + warnings, and `build-error.txt` with exit `2` for build failures. +- For a regression, a new warning or a clearer error, run the same scenario on the fix and on `master` (or the commit + before the fix), in two worktrees, and show both. They differ in exactly the way the issue describes. +- Report a sub-feature you didn't run as skipped, with the reason. Another scenario doesn't cover it. +- An expected value in `features/` that stops matching is a finding to report, not something to edit away. + +## Adding a scenario + +1. Write the SDL as `probe/src/main/resources/scenarios//schema.graphqls` and load it with `.file(...)`, unless the + behavior is about `schemaString`. +2. Add `object : Scenario` with `name` and `parser()` in `probe/src/main/kotlin/scenarios/.kt`. Being an + object in that package registers it. Classes share the package, so prefix resolver and data classes with the scenario. + Use only public API. If the probe needs `internal` or test classes, a user can't reach the behavior either, so report + that. +3. Add operations as `NN-.graphql`, plus `NN-.variables.json` when they take variables. graphql-java rejects + a second `__type` in one operation and still exits `0`, so read several types through `__schema { types { ... } }`. +4. Override what the scenario needs. `operations` reuses another scenario's operation directory. `schema(parser)` takes + another build path such as `toReadOnlySchema()`. `inspect(schema)` returns evidence the printer doesn't show, and + `probe.dumpDirectives(schema)` lists every element's applied and legacy directives. `graphQL(builder)` and + `input(builder)` add instrumentation, context or data loaders. +5. A scenario that doesn't compile breaks every checkout's run, so finish it before running. Keep a scenario that proves + a lasting feature and add its exact expected results to the matching file in `features/`. Delete a one-off + reproduction after reporting. + +`features/README.md` maps each feature to its scenarios and expected results. Delete evidence directories by hand once +reported. diff --git a/.claude/skills/verify-tools/features/README.md b/.claude/skills/verify-tools/features/README.md new file mode 100644 index 00000000..c16a73d1 --- /dev/null +++ b/.claude/skills/verify-tools/features/README.md @@ -0,0 +1,45 @@ +# graphql-java-tools verification map + +Each file below is one user-visible feature, with the scenarios that prove it and their exact expected results. The +commands and proof standards are in `../SKILL.md`. Scenario data is fixed, so expected values are literal. + +A feature file has an H1 title and one paragraph on the behavior a user sees, then three H2 sections: `Sub-features` (short +IDs, one line each), `Expected results` (each scenario's `run` command and what its evidence shows), and `Gotchas` (traps +that waste or invalidate a run, and how the result looked before the fix). + +## Features + +- [Schema building](./schema-building.md): SDL files, root and nested resolvers, property and getter discovery, custom + scalars, the unused-type warning, the missing-resolver error and the read-only schema (`bookstore`, + `bookstore-missing-resolver`, `read-only-schema`). +- [Arguments and input types](./arguments-and-inputs.md): SDL defaults, enums, lists, input objects mapped to classes, + omitted versus null, parameters typed by a type variable, custom scalar arguments, recursive input objects and the WARN + for unmapped input fields (`inputs`, `unmapped-inputs`, `generic-input-resolver`, `scalar-args`, `recursive-inputs`). +- [Async resolvers and subscriptions](./async-and-subscriptions.md): `CompletableFuture`, suspend functions, and + `Publisher` subscriptions (`async`). +- [Generic wrappers](./generic-wrappers.md): wrappers and futures nested in lists and other wrappers, with and without a + `ValueUnboxer`, and in suspend resolvers (`nested-wrappers`, `nested-wrappers-unboxer`, `nested-wrappers-suspend`). +- [DataFetcherResult inside an Optional](./optional-data-fetcher-results.md): data, errors, empty, a list, the same type + returned another way, and the nested-result rejection (`optional-results`, `optional-results-mixed`, + `optional-results-list`, `optional-results-nested`). +- [Interfaces and unions](./interfaces-and-unions.md): runtime type resolution through the dictionary, including a class + whose name differs from the type, and a union that is only a member of another union (`polymorphism`, + `nested-unions`). +- [Directives and relay connections](./directives-and-relay.md): `SchemaDirectiveWiring`, `@deprecated`, `@connection` + type generation, directives and `@specifiedBy` on scalars, wirings on recursive and cross-referencing types, applied + versus legacy directive lists, undeclared directives and invalid applications (`directives`, `scalar-directives`, + `wiring-shapes`, `directive-drift`, `directive-drift-undeclared`, `directives-invalid`). +- [Schema parser options](./schema-options.md): `missingResolverDataFetcherProvider` + (`options`). +- [Type extensions](./type-extensions.md): fields, interfaces, members, values and directives of every kind of extension, + the repeat and kind-mismatch warnings, repeated object and input fields, and sealed subclasses found through + extensions (`type-extensions`, `type-extensions-repeated-fields`, `type-extensions-sealed`). +- [Proxied resolvers](./proxies.md): Spring JDK dynamic and CGLIB proxies, and the warning for fields a JDK proxy can't + call (`jdk-proxy`, `jdk-proxy-cglib`, `jdk-proxy-plain`). +- [Context and environment parameters](./context-and-environment.md): `contextClass`, `GraphQLContext` and + `DataFetchingEnvironment` after the schema arguments, in any order, the misbound-argument warning, and resolver methods + without the source parameter (`context-and-environment`, `context-and-environment-invalid`, `context-misbound`, + `sourceless`, `sourceless-shadowed`, `sourceless-unimplemented`, `sourceless-misbound`). + +Not mapped yet: field visibility, per-field object mappers, the Guice, Javassist and Weld proxy handlers, +`includeUnusedTypes`, and comment descriptions. Add a scenario and a feature entry when a change touches one of them. diff --git a/.claude/skills/verify-tools/features/arguments-and-inputs.md b/.claude/skills/verify-tools/features/arguments-and-inputs.md new file mode 100644 index 00000000..de820272 --- /dev/null +++ b/.claude/skills/verify-tools/features/arguments-and-inputs.md @@ -0,0 +1,95 @@ +# Arguments and input types + +Resolver methods take GraphQL arguments as ordinary parameters, in SDL order. graphql-java-tools converts scalars, enums, +lists and input objects into the parameter's declared class, applies SDL default values, and passes +`DataFetchingEnvironment` when it is the last parameter. An input object can refer to itself, or to another input object +that refers back. With `inputArgumentOptionalDetectOmission`, an `Optional` parameter tells an omitted argument (`null`) +from an explicit `null` (`Optional.empty()`). + +## Sub-features + +- `args-defaults` applies an argument's SDL default when the operation omits it. +- `args-enum-list` converts `[Genre!]` literals into a `List` of a Kotlin enum. +- `args-env` passes `DataFetchingEnvironment` as the trailing parameter. +- `args-input-object` maps a nested input object into data classes, including input field defaults. +- `args-optional-omission` passes `null` for an omitted argument, `Optional.empty()` for an explicit null, and + `Optional.of` for a value. +- `args-invalid-enum` rejects an unknown enum literal during validation, before any resolver runs. +- `args-unmapped-warn` logs a WARN at build for an input field the argument's class has no property for, here a + misspelled property under an `Optional`. +- `args-unmapped-ignored` doesn't report a field the property's `@JsonIgnoreProperties` ignores, here on an `Optional` + property. +- `args-type-variable` converts an argument whose parameter is typed by the resolver superclass's type variable into the + class the subclass binds it to. +- `args-scalars` passes a custom scalar's coerced object through unconverted, also when it's a Kotlin class without visible + properties inside an input object, converts `ID` into a `Long` parameter, and converts `[[String]]` into a + `List>` parameter. +- `args-recursive` converts an input object that refers to itself, and two that refer to each other, through lists, nested + lists and non-null types into data classes at every depth. It also builds a directive whose arguments are an input + object, an enum with a default and a list. + +## Expected results + +- **Run.** `run inputs`. Exit `0`. `summary.txt` shows `errors=0` for `01` to + `03` and `errors=1` for `04-invalid-enum`. +- **Defaults, enums, env.** `01-search.json` has + `data.defaults = "term=dune limit=10 genres=null field=search"` and + `data.explicit = "term=dune limit=2 genres=[SCIENCE, HISTORY] field=search"`. +- **Omitted vs null.** `02-nickname.json` has `omitted = "omitted"`, `explicitNull = "explicit null"` and + `given = "value Bilbo"`. +- **Input objects.** `03-add-book.json` (variables in `03-add-book.variables.json`) has `data.addBook` equal to + `{"title": "Cosmos", "genre": "SCIENCE", "tags": ["space", "classic"], "pages": 396, "language": "en"}`. `language` + comes from the input field default. `data.defaults` is `{"genre": "FICTION", "tags": [], "pages": null}`. +- **Invalid enum.** `04-invalid-enum.json` has no `data`, and one error whose message starts with + `Validation error (WrongType@[search])` and names `POETRY`. +- **Unmapped input fields.** `run unmapped-inputs`. Exit `0`. `probe.log` has + exactly one `UnmappedInputFieldChecker` WARN, starting `Input field 'ItemInput.name' has no matching property in + scenarios.ItemInput` and listing `Known properties: nmae`. There is no WARN for `InnerInput.legacy`. + `01-ignored.json` has `data.ignored = "a"`. `02-typo.json` has one error containing + `Unrecognized property "name" (class scenarios.ItemInput)` (`Unrecognized field` before Jackson 3, in 14.x), which shows + the reported field really fails. +- **Type variable parameters.** `run generic-input-resolver`. Exit `0`. + `summary.txt` shows `errors=0` for both operations. `02-generic.json` has + `data.generic = "generic got GreetingInput(name=a)"`, and `01-plain.json` has + `data.plain = "plain got GreetingInput(name=a)"`. +- **Scalar arguments.** `run scalar-args`. Exit `0`. `summary.txt` shows + `errors=0` for the first five operations. `01-custom-scalar.json` has `data.tag = "tag kotlin"` and + `data.tags = "tags [a, b]"` (`Tag` has no constructor Jackson can use, so this only works when the value is passed + through). `02-id.json` has `data.id = "id 43 (long)"`. `03-nested-sets.json` has + `data.nestedSets = "sets [[a, b], [c]] sizes [2, 1]"`. `04-nested-lists.json` has + `data.nestedLists = "lists [[a, a, b], [c]]"`. `05-empty-kotlin-scalar.json` has `data.tokenInput = "token input"`. + `06-marked-empty-kotlin-scalars.json` has one error and `07-optional-marked-empty-kotlin-scalars.json` two, all containing + `missing type id property '@class'` or `Cannot deserialize value of type`. Those scalars fail rather than reach the resolver + as a default instance. +- **Recursive inputs.** `run recursive-inputs`. Exit `0`, `errors=0` for both operations and an empty `probe.log`. + `01-describe.json` (variables in `01-describe.variables.json`) has `data.names = ["a", "b"]`. `data.describe` starts + `TreeFilter(name=root, and=[TreeFilter(name=a,` and ends `siblings=[[ChildFilter(parent=null, siblings=null, depth=4)], + []], depth=3))`. `data.literal` is `TreeFilter(name=x, and=null, not=null, child=ChildFilter(parent=null, + siblings=[[ChildFilter(parent=null, siblings=null, depth=2)]], depth=1))`. `schema.graphqls` has `siblings: + [[ChildFilter!]!]` and `directive @limit(labels: [String!], range: RangeInput!, unit: LimitUnit = ITEMS) on + FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION`. In `02-introspect.json`, `limit` has `range` of + `RangeInput!`, `unit` of `LimitUnit` with default `ITEMS`, and `labels` of `[String!]`. + +## Gotchas + +- Arguments bind by position, not name. A resolver whose parameters are in a different order than the SDL still builds + when the types line up, and returns swapped values. +- Without `inputArgumentOptionalDetectOmission`, an omitted argument and an explicit null both arrive as + `Optional.empty()`. This scenario turns the option on. Prove the default behavior in a separate scenario. +- `04-invalid-enum` fails in graphql-java validation. It proves the generated enum type, not the resolver's conversion. +- The unmapped input field check comes from PR #857. On a checkout without it, `unmapped-inputs` still exits `0` with the + same JSON, but `probe.log` has no `UnmappedInputFieldChecker` lines. +- `02-typo` errors because the scenario uses the default `ObjectMapper`, which fails on unknown properties. It doesn't + cover a mapper that ignores them. +- The type variable fix comes from PR #882. On a checkout without it, `generic-input-resolver` still builds and exits + `0`, but `02-generic.json` has `data: null` and an error containing `TypeVariableImpl cannot be cast to class + java.lang.Class`. +- The nested list fix comes from PR #891. On a checkout without it, `scalar-args` still exits `0`, but + `03-nested-sets.json` has an error containing `ArrayList cannot be cast to class java.util.Set`. +- The fix for a Kotlin scalar class without visible properties comes from issue #926. On a checkout without it, + `05-empty-kotlin-scalar.json` has `data.tokenInput = "token default"`, since Jackson wrote the value as `{}` and read it + back as a new instance. The same scalar written with a type id or an object id comes from issue #932. On a checkout + without it, `07-optional-marked-empty-kotlin-scalars.json` has no errors and `"typed default"` and `"id default"`. The probe doesn't cover an `ObjectNode` parameter, which needs Jackson 3 on the probe's compile + path. `CustomScalarInputTest` does. +- `recursive-inputs` registers no directive wiring. `wiring-shapes` in `directives-and-relay.md` covers wirings on a + recursive input. diff --git a/.claude/skills/verify-tools/features/async-and-subscriptions.md b/.claude/skills/verify-tools/features/async-and-subscriptions.md new file mode 100644 index 00000000..b1d4e508 --- /dev/null +++ b/.claude/skills/verify-tools/features/async-and-subscriptions.md @@ -0,0 +1,35 @@ +# Async resolvers and subscriptions + +Resolvers can return a `CompletableFuture`, be Kotlin `suspend` functions (root resolvers and `GraphQLResolver` field +resolvers alike), or, for subscription fields, return a reactive-streams `Publisher`. The schema declares the plain +result type (`String!`, `Int!`), and graphql-java-tools unwraps the async wrapper. + +## Sub-features + +- `async-future` resolves a field from a `CompletableFuture`. +- `async-suspend-root` resolves a root field from a `suspend fun` that suspends (`delay`). +- `async-suspend-nested` resolves a list of objects from a `suspend fun`, and a field on each through a suspend + `GraphQLResolver` method. +- `async-subscription` streams a `Publisher` from a `GraphQLSubscriptionResolver`, one event per element, then + completes. + +## Expected results + +- **Run.** `run async`. Exit `0`. `summary.txt` has + `operation 01-query: errors=0` and `operation 02-subscription: errors=0 events=3`. +- **Futures and suspend.** `01-query.json` has `data.future = "from a future"`, + `data.suspended = "from a suspend function"`, and + `data.shipments = [{"id": "s1", "status": "s1: delivered"}, {"id": "s2", "status": "s2: delivered"}]`. +- **Subscription.** `02-subscription.json` is + `{"events": [{"data": {"ticks": 1}}, {"data": {"ticks": 2}}, {"data": {"ticks": 3}}]}`, with no `errors` key and no + `publisherError` entry. + +## Gotchas + +- Collection stops at stream completion or after 10 seconds. A publisher that never completes prints `subscription did + not complete within 10 seconds` and records only the events seen so far, which is a finding, not a pass. +- An error from the publisher shows up as a `{"publisherError": ...}` event, not under `errors`. +- `--graphql-java` changes only the runtime graphql-java. The library jar is still the one compiled against the version + in `pom.xml`. +- The suspend timing isn't asserted. To prove a dispatcher or `coroutineContextProvider` change, add a field that + reports `Thread.currentThread().name` or the coroutine context to a new scenario. diff --git a/.claude/skills/verify-tools/features/context-and-environment.md b/.claude/skills/verify-tools/features/context-and-environment.md new file mode 100644 index 00000000..ef0b1bb2 --- /dev/null +++ b/.claude/skills/verify-tools/features/context-and-environment.md @@ -0,0 +1,58 @@ +# Context and environment parameters + +After its schema arguments, a resolver method can take any of `DataFetchingEnvironment`, `graphql.GraphQLContext` and the +class set with `contextClass`, in any order. The custom context is read from the `GraphQLContext` map under its class. +Any other trailing parameter type fails the build with "No method found". + +## Sub-features + +- `ctx-env-both` passes the custom context and the environment to `greeting(name, context, env)`. +- `ctx-env-reversed` passes them to `farewell(name, env, context)`. +- `ctx-env-type-resolver` passes `graphql.GraphQLContext` and the environment to a `GraphQLResolver` method. +- `ctx-env-single` keeps a single environment or a single context parameter working. +- `ctx-env-invalid` rejects a trailing `String` parameter at build time. +- `ctx-env-misbound` warns at build when a schema argument lands on an environment or context parameter. +- `sourceless` binds a field resolver method that leaves out the source and takes only arguments, the environment or the + context, when no method with the source and no property matches. + +## Expected results + +- **Run.** `run context-and-environment`. Exit `0`, `01-query: errors=0`. +- **Results.** `01-query.json` has `data = {"greeting": "greeting: hi ada, from oryan", "farewell": "farewell: bye ada, + from oryan", "user": {"name": "oryan", "locale": "locale of oryan: en-CA"}, "environmentOnly": "environmentOnly", + "contextOnly": "en-CA"}`. +- **Invalid.** `run context-and-environment-invalid`. Exit `2`. + `build-error.txt` starts with `graphql.kickstart.tools.resolver.FieldResolverError: No method found ... (optionally + followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class + scenarios.AppContext])`. +- **Misbound.** `run context-misbound`. Exit `0`. `probe.log` has 3 `SchemaClassScanner` WARNs, for `Query.users`, + `Query.contextArgument` and `User.thumbnail`, none for `Query.greeting`. The first reads `Field 'Query.users' has no + parameter for its argument 'first: Int' in scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment + parameter gets the argument instead.` All four operations have `errors=1`. `01` fails with `Parameter specified as + non-null is null`, `02` and `04` with ``Cannot construct instance of `graphql.schema.DataFetchingEnvironment` ``, and + `03-context-and-correct.json` has `data = {"contextArgument": null, "greeting": "greeting: hi ada"}` with one error, for + `/contextArgument`. Before #890 the same run has the same four errors and an empty `probe.log`. +- **Without the source.** + - `run sourceless`: exit `0`, `errors=0` for both operations. In `01-local-context.json` each image has + `imageBlob = "blob for [png, jpg]"` (`imageBlob(env)` reads the `localContext` that `images` returned), + `thumbnail = "png@64"` and `caption = "caption of cat"` (`dog` for the second). In `02-contexts.json` each image has + `owner = "ada"`, `locale = "en-CA"` and `signature = "signature by oryan"`. + - `run sourceless-shadowed`: exit `0`. `01-shadowed.json` has `name = "cat"` and `title = "with source cat"`, so the + source's `name` property wins over `getName(env)` and `title(image)` over `title(env)`. + - `run sourceless-unimplemented`: exit `0`. `probe.log` has `Missing resolver for field: FieldDefinition{name='preview'` + next to the development-only warning for `allowUnimplementedResolvers`, so `preview(env)` is not bound. `execute` + throws, so `01-helper.json` is `{"threw": "java.util.concurrent.CompletionException: kotlin.NotImplementedError: An + operation is not implemented: Schema resolver not implemented"}`. + - `run sourceless-misbound`: exit `2`. `thumbnail(GraphQLContext, env)` for `thumbnail(size: Int)` still fails the build. + The signatures listed for `scenarios/sourceless-misbound/schema.graphqls:11` end with + `scenarios.MisboundImageResolver.thumbnail(~size, )` and + `scenarios.MisboundImageResolver.getThumbnail(~size, )`. + +## Gotchas + +- Before #888 only one trailing parameter was allowed, so `context-and-environment` fails to + build on older versions with the same "No method found" error. +- Before #904 `sourceless` fails the build (exit `2`) with `No method or field found ... imageBlob` and six listed + signatures, none ending in ``. `sourceless-shadowed` and `sourceless-unimplemented` give the + same results as after it. `sourceless-misbound` still fails the build, but its error lacks the two + `(~size, )` signatures. diff --git a/.claude/skills/verify-tools/features/directives-and-relay.md b/.claude/skills/verify-tools/features/directives-and-relay.md new file mode 100644 index 00000000..5a30a8a8 --- /dev/null +++ b/.claude/skills/verify-tools/features/directives-and-relay.md @@ -0,0 +1,99 @@ +# Directives and relay connections + +SDL directives reach the user's code in three ways. A named `SchemaDirectiveWiring` registered with `.directive(name, …)` +can wrap the data fetcher of every field that carries the directive. `@deprecated(reason:)` shows up in introspection. A +field marked `@connection(for: "Member")` gets its `MemberConnection`, `MemberConnectionEdge` and `PageInfo` types +generated, so the SDL never declares them, and a resolver returning `graphql.relay.Connection` fills them. A +wiring also runs on interfaces, unions, enums and input objects, including ones that refer to themselves or each other. +The build checks every applied directive against its definition. It logs a WARN with the source line for an invalid +application, and fails for a directive with no definition unless `allowUndeclaredDirectives(true)` is set. + +## Sub-features + +- `dir-wiring-field` uppercases `@uppercase` fields on `Query` and on a nested type (`Member.name`) through a wrapped + data fetcher. +- `dir-wiring-scope` leaves fields without the directive unchanged. +- `dir-deprecated` reports `isDeprecated` and `deprecationReason` through `__type(...).fields(includeDeprecated: true)`. +- `dir-connection-types` generates `MemberConnection`, `MemberConnectionEdge` and `PageInfo` from `@connection`. +- `dir-connection-paging` returns edges with cursors and `pageInfo` from `SimpleListConnection` for `first: 2`. +- `dir-scalar` applies the directives of a scalar and its extension, runs `onScalar`, and reports `specifiedByURL` from + the SDL `@specifiedBy` or else from the provided scalar (`scalar-directives`). +- `dir-scalar-undeclared` logs a WARN for an undeclared directive on a scalar and builds the scalar without it + (`scalar-directives`). +- `dir-wiring-recursive` hands a wiring on a field of a self-referencing input object the built `GraphQLInputObjectType`, + not a `GraphQLTypeReference` (`wiring-shapes`). +- `dir-wiring-shapes` runs wirings on an interface, a union, an enum and a self-referencing object type, and lets a wiring + make a self-referencing field non-null (`wiring-shapes`). +- `dir-applied-legacy` lists every applied directive, repeats and undeclared ones included, in `appliedDirectives`, and + only the declared ones in the legacy `directives`, keeping the first of a non-repeatable directive + (`directive-drift`). +- `dir-undeclared-fails` fails the build for an applied directive with no definition unless + `allowUndeclaredDirectives(true)` is set (`directive-drift-undeclared`). +- `dir-invalid-warn` logs a WARN with the source line and column for a directive applied where its definition doesn't + allow it, without a required argument, or twice when it isn't repeatable, and still builds (`directives-invalid`). + +## Expected results + +- The members are `m1` "ada", `m2` "grace", `m3` "barbara", in that order. + +- **Run.** `run directives`. Exit `0`, `errors=0` for all three operations, and + an empty `probe.log`. +- **Wiring.** `01-uppercase.json` has `data.motto = "KEEP IT SIMPLE"` and `data.oldMotto = "move fast"`. +- **Deprecated.** `02-deprecated.json` lists `motto` and `members` with `isDeprecated: false`, and `oldMotto` with + `isDeprecated: true` and `deprecationReason: "Use motto"`. +- **Connection.** `03-connection.json` has two edges, `{"id": "m1", "name": "ADA"}` and `{"id": "m2", "name": "GRACE"}`, + with non-empty cursors. `pageInfo` has `hasNextPage: true`, `hasPreviousPage: false`, `startCursor` equal to the first + edge's cursor, and `endCursor` equal to the second's. +- **Generated types.** `schema.graphqls` has `type MemberConnection { edges: [MemberConnectionEdge] pageInfo: PageInfo }` + and `type MemberConnectionEdge { cursor: String node: Member }`, and the SDL file declares neither. +- **Scalars.** `run scalar-directives`. Exit `0` and `errors=0` for both + operations. `schema.graphqls` has `"A calendar date, wired with @since(2020-01-01), wired with @unit(day)"` above + `scalar Date @since(date : "2020-01-01") @unit(name : "day") @specifiedBy(url : "https://example.com/date")`, and + `scalar DateTime @specifiedBy(url : "https://scalars.graphql.org/andimarek/date-time")`. In `01-introspect-scalars.json`, + `Date` has `specifiedByURL: "https://example.com/date"` and `DateTime` has + `"https://scalars.graphql.org/andimarek/date-time"`. `probe.log` has exactly `Scalar 'Money' is built without its + directives from the schema: Found applied directive currency without corresponding directive definition.` +- **Wirings on cycles.** `run wiring-shapes`. Exit `0`, `errors=0` for both operations and an empty `probe.log`. + `schema.graphqls` has `"sees GraphQLInputObjectType TreeFilter"` on `TreeFilter.children`, `friend: Person! @required` + and `state: State! @required` where the SDL declares both nullable, and `"described"` above `Named`, `Someone`, + `Person`, `State` and `TreeFilter`. `01-trees.json` has `data.trees = 4`. `02-person.json` has + `data.person = {"name": "ada", "friend": {"name": "ada"}, "state": "ALIVE", "someone": {"name": "ada"}}` and + `data.someone = {"name": "grace"}`. +- **Applied and legacy lists.** `run directive-drift`. Exit `0` and `schema build: OK`, with no operations. In + `inspect.txt`, `input field Meta.owner` has two `applied @once` (`reason` `"x"`, then `"because"`) and one `legacy @once` + with `reason = "x"`. `field Query.search` has two `applied @undeclared`, the first with arguments typed from their + literals (`i: Int`, `f: Float`, `b: Boolean`, `l: [Int]`), and no legacy one. `enum value Color.BLUE` has + `applied @deprecated` and `applied @undeclared` but only `legacy @deprecated`. +- **Drift warnings.** `probe.log` of `directive-drift` has 12 `SchemaParser` WARNs. Six are `isn't repeatable but is applied + more than once`, two are an extension of `Date` or `Query` applying `@once` again, two are `is missing its required + argument` (`@tag` and `@needs`), one is `Directive @fieldOnly at line 38, column 28 in + scenarios/directive-drift/schema.graphqls is applied to ARGUMENT_DEFINITION, but it's declared on FIELD_DEFINITION.`, and + one is `Scalar 'Money' is built without its directives from the schema: Found an unexpected directive argument tag#nam .` + None names `@undeclared`, because `directive-drift` sets `allowUndeclaredDirectives(true)`. +- **Undeclared.** `run directive-drift-undeclared`. Exit `2`. `summary.txt` has `schema build: FAILED + graphql.kickstart.tools.SchemaError: Found applied directive undeclared without corresponding directive definition.`, + and `build-error.txt` starts with the same message. +- **Invalid applications.** `run directives-invalid`. Exit `0` and `errors=0`. `01-query.json` has + `data.motto = "KEEP IT SIMPLE"`, so the misplaced `@uppercase` still wires. `probe.log` has exactly 5 `SchemaParser` + WARNs, each naming its line and column in `scenarios/directives-invalid/schema.graphqls`. + `Directive @uppercase at line 12, column 20 ... is applied to FIELD_DEFINITION, but it's declared on OBJECT.` + `Directive @deprecated at line 17, column 13 ... is applied to OBJECT, but it's declared on FIELD_DEFINITION | + ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION.` + `Directive @auth at line 13, column 20 ... is missing its required argument 'role'.` Two + `Directive @cached at line ... isn't repeatable but is applied more than once`, at line 14, column 32 (the second + `@cached` on `members`) and line 9, column 15 (`extend schema`). + +## Gotchas + +- `@connection` must be declared in the SDL like any applied directive. Without a definition, the build throws + `SchemaError: Found applied directive connection without corresponding directive definition.` unless + `allowUndeclaredDirectives(true)` is set. +- The uppercased `ADA` and `GRACE` names also prove the wiring reached a nested type's field. Lowercase names there mean + the wiring only ran on `Query`. +- `@since(2020-01-01)` proves `onScalar` reads an argument typed by the scalar the directive is applied to. `@since(null)` + means the wiring saw a type reference. +- Cursors are base64 of `simple-cursor` from graphql-java's `SimpleListConnection`. Don't hard-code them across + graphql-java versions. +- Before #895 (commit 21f3796e) `wiring-shapes` has the same `schema.graphqls`, except that `TreeFilter.children` reads + `"sees GraphQLTypeReference TreeFilter"`. +- Before #885 (commit 94a98a01) `directives-invalid` has an empty `probe.log` and the same `01-query.json`. diff --git a/.claude/skills/verify-tools/features/generic-wrappers.md b/.claude/skills/verify-tools/features/generic-wrappers.md new file mode 100644 index 00000000..88211778 --- /dev/null +++ b/.claude/skills/verify-tools/features/generic-wrappers.md @@ -0,0 +1,58 @@ +# Generic wrappers + +A resolver can return a value in a wrapper type registered with `genericWrappers(...)`, such as the scenario's `Try`, or +in a `CompletableFuture`, while the schema declares the plain type. The wrappers can sit inside a list or inside each +other, as in `List>` or `CompletableFuture>>`. graphql-java-tools unwraps every level, maps +the lists, and combines the futures below the outermost value into one, so one failed element fails the whole field. + +## Sub-features + +- `wrap-list` unwraps a `List>` into `[Payload!]!` and a `List>` into `[String!]!`. +- `wrap-future-list` unwraps a `List>` into `[Item]` and a + `List>` into `[String]`, including the futures that `DataLoader.load` returns. +- `wrap-nested` unwraps a `CompletableFuture>`, a `CompletableFuture>>` and + a `List>>`. +- `wrap-failed-element` fails the whole field, with the element's message, when one `Try` or future in a list failed. +- `wrap-controls` keeps a `List` and a `CompletableFuture>` working. +- `wrap-unboxer` gives the same results when the app's own `ValueUnboxer` already unwraps `Try` and joins futures + (`nested-wrappers-unboxer`). +- `wrap-suspend` builds and resolves suspend functions returning `List>` for `[Item]` and + `[Item!]!`, and `List` for `[String]`. The return type of a suspend function carries the wildcard + `List>` (`nested-wrappers-suspend`). + +## Expected results + +- **Run.** `run nested-wrappers`. Exit `0` and an empty `probe.log`. `summary.txt` has `errors=0` for `01` to `09` and `12`, + and `errors=1` for `10-failed-try-in-list` and `11-failed-future-in-list`. +- **Lists of wrappers.** `02-payloads.json` has `data.payloads = [{"data": "a"}, {"data": "b"}]` and + `03-payload-strings.json` has `data.payloadStrings = ["a", "b"]`. `04-items.json` has + `data.items = [{"id": "1"}, {"id": "2"}]`, one future already complete and one from `supplyAsync`, and + `05-item-names.json` has `data.itemNames = ["one", "two"]`. +- **Nested wrappers.** `06-future-of-future.json` has `data.futureOfFuture = {"id": "inner"}`. `07-future-of-tries.json` + has `data.futureOfTries = [{"data": "a"}, {"data": "b"}]` and `08-tries-of-futures.json` has + `data.triesOfFutures = [{"id": "1"}, {"id": "2"}]`. `09-loaded-items.json` has + `data.loadedItems = [{"id": "x"}, {"id": "y"}]`. +- **Failed element.** `10-failed-try-in-list.json` has `data.failedTryInList = null` and one error, + `Exception while fetching data (/failedTryInList) : payload failed`. `11-failed-future-in-list.json` has + `data.failedFutureInList = null` and one error, `Exception while fetching data (/failedFutureInList) : item failed`. +- **Controls.** `12-controls.json` has `data.plainItems = [{"id": "p1"}, {"id": "p2"}]` and `data.futureOfItems` equal to + it. +- **Unboxer.** `run nested-wrappers-unboxer`. Exit `0`. It runs the operations of `nested-wrappers`. The errors per + operation in `summary.txt` and every `.json` match the ones of `nested-wrappers`. +- **Suspend.** `run nested-wrappers-suspend`. Exit `0`, `errors=0` for all three operations and an empty `probe.log`. + `01-nullable-items.json` has `data.nullableItems = [{"id": "1"}, {"id": "2"}]`, `02-non-null-items.json` has the same + list as `data.nonNullItems`, and `03-type-variable-strings.json` has `data.typeVariableStrings = ["a", "b"]`. + +## Gotchas + +- Before #903 (commit a4736c9a) `nested-wrappers` still exits `0`. `02`, `07`, `08` and `10` have an error per element, + `Expected source object to be an instance of '' but instead got 'scenarios.Try$Success'`, and `04`, `06`, `09` + and `11` the same with `'java.util.concurrent.CompletableFuture'`. `03-payload-strings.json` has + `["Success(value=a)", "Success(value=b)"]` and `05-item-names.json` has + `java.util.concurrent.CompletableFuture@[Completed normally]` strings, both with `errors=0`. +- Before #903 `nested-wrappers-suspend` fails the build (exit `2`) with `SchemaClassScannerError: Two different classes used + for type Item`, naming `java.util.concurrent.CompletableFuture` for `nullableItems` and + `scenarios.NestedItem` for `nonNullItems`. +- Before #903 `nested-wrappers-unboxer` had `errors=0` for `01` to `09`, because the app's `ValueUnboxer` did the + unwrapping. `10` and `11` were `THREW java.lang.IllegalStateException` in `summary.txt`, with `{"threw": ...}` in the + JSON, because the failed element's exception left `execute`. Now they return `errors=1` like `nested-wrappers`. diff --git a/.claude/skills/verify-tools/features/interfaces-and-unions.md b/.claude/skills/verify-tools/features/interfaces-and-unions.md new file mode 100644 index 00000000..58bfe3fb --- /dev/null +++ b/.claude/skills/verify-tools/features/interfaces-and-unions.md @@ -0,0 +1,41 @@ +# Interfaces and unions + +A field can return an interface or a union while the resolver returns a supertype (`Entity`, `Any`). graphql-java-tools +can't learn the concrete classes from those return types, so the user registers them with `.dictionary(...)`. At runtime +the object's class decides the GraphQL type. When the class name differs from the type, the user registers it with an +explicit name: `.dictionary("Writer", WriterEntity::class.java)`. + +## Sub-features + +- `poly-interface` resolves `node(id): Node` to `Novel` or `Writer` from the returned class. +- `poly-union` resolves each element of `[SearchResult!]!` (`Novel | Writer`) from a `List`. +- `poly-dictionary-name` maps the type `Writer` to the class `WriterEntity` by an explicit dictionary name. +- `poly-dictionary-class` maps `Novel` to the class `Novel` by `.dictionary(Novel::class.java)`. +- `nested-union` builds `union Result = Book | Media` with `union Media = Movie` when no field returns `Media`, and flattens + `Result` to `Book | Movie` (scenario `nested-unions`). + +## Expected results + +- The data is `Novel("n1", "Solaris")` and `WriterEntity("w1", "Stanisław Lem")`. + +- **Run.** `run polymorphism`. Exit `0`, `errors=0` for both operations, and an + empty `probe.log`. A dictionary warning there means an entry went unused. +- **Interface.** `01-node.json` has `data.novel = {"__typename": "Novel", "id": "n1", "title": "Solaris"}` and + `data.writer = {"__typename": "Writer", "name": "Stanisław Lem"}`. +- **Union.** `02-union.json` has `data.search` equal to `[{"__typename": "Novel", "title": "Solaris"}, + {"__typename": "Writer", "name": "Stanisław Lem"}]`. +- **Schema.** `schema.graphqls` has `union SearchResult = Novel | Writer` and both types implementing `Node`. +- **Nested union.** `run nested-unions`. Exit `0`, `errors=0` and an empty + `probe.log`. `01-results.json` has `data.results` equal to `[{"__typename": "Book", "title": "Solaris"}, + {"__typename": "Movie", "title": "Stalker"}]`, the `Movie` reached through `... on Media`. `schema.graphqls` has + `union Media = Movie` and `union Result = Book | Movie`. + +## Gotchas + +- Without `.dictionary(Novel::class.java)`, the build fails (exit `2`) with `SchemaClassScannerError: Object type + 'Novel' implements a known interface, but no class could be found for that type name.` To prove a dictionary change, + use a separate scenario, because this one must keep building. +- `nested-unions` fails to build (exit `2`) on checkouts without #887, with `No object type found with name 'Media' for + union`. +- `__typename` is the assertion that matters. Fields selected through the wrong inline fragment are silently absent, not + errors. diff --git a/.claude/skills/verify-tools/features/optional-data-fetcher-results.md b/.claude/skills/verify-tools/features/optional-data-fetcher-results.md new file mode 100644 index 00000000..cf89577f --- /dev/null +++ b/.claude/skills/verify-tools/features/optional-data-fetcher-results.md @@ -0,0 +1,35 @@ +# DataFetcherResult inside an Optional + +A resolver can return `Optional>` for a nullable field. graphql-java gets the `DataFetcherResult`, so +the field resolves its data and the query keeps its errors. An empty `Optional` resolves to null. A `DataFetcherResult` or an +`Optional` twice in one value fails the build. + +## Sub-features + +- `opt-result` resolves `Optional>` for `Payload` with its error, and + `Optional>` for `String`. +- `opt-result-empty` resolves `Optional.empty()` to null. +- `opt-result-mixed` builds when the same object type is also returned as a `DataFetcherResult>`. +- `opt-result-list` resolves `Optional>>` for `[Payload]`. +- `opt-result-nested` rejects `Optional>>`. + +## Expected results + +- **Run.** `run optional-results`. Exit `0` and an empty `probe.log`. `01-optional-result.json` has + `data.optionalResult = {"data": "a"}` and one error, `partial`. `02-optional-result-name.json` has + `data.optionalResultName = "a"` and `03-empty-optional-result.json` has `data.emptyOptionalResult = null`, both without + errors. +- **Mixed.** `run optional-results-mixed`. Exit `0`. `01-optional-result.json` matches the one above and + `02-result-of-optional.json` has `data.resultOfOptional = {"data": "a"}`. +- **List.** `run optional-results-list`. Exit `0`. `01-optional-result-list.json` has + `data.optionalResultList = [{"data": "a"}, {"data": "b"}]`. +- **Nested.** `run optional-results-nested`. Exit `2`. `build-error.txt` ends in + `graphql.execution.DataFetcherResult cannot be nested within itself`. + +## Gotchas + +- Before the fix (master 3f022b91) `optional-results` still exits `0`. `01` has + `data.optionalResult = {"data": "scenarios.OptionalResultsPayload@"}` with no error, and `02` has + `"DataFetcherResult{data=a, errors=[], localContext=null, extensions=null}"`. `optional-results-mixed` exits `2` with + `Two different classes used for type Payload`, `optional-results-list` exits `2` with `Java class is not a List or generic + type information was lost`, and `optional-results-nested` exits `0` with the same `Payload@` string. diff --git a/.claude/skills/verify-tools/features/proxies.md b/.claude/skills/verify-tools/features/proxies.md new file mode 100644 index 00000000..b446eb25 --- /dev/null +++ b/.claude/skills/verify-tools/features/proxies.md @@ -0,0 +1,36 @@ +# Proxied resolvers + +A resolver wrapped in a Spring AOP proxy is scanned as its target class through `Spring4AopProxyHandler`. A CGLIB proxy +(`proxyTargetClass = true`) subclasses the target, so its methods work. A JDK dynamic proxy only implements the target's +interfaces, so every query of a field that resolves to the target's own method or field fails, and the build logs a +warning per field that suggests class-based proxies, plus a getter for a field. + +## Sub-features + +- `proxy-jdk-warning` logs a WARN per field that a JDK proxy can't call, naming the type, field, member and proxy class. +- `proxy-jdk-field-getter` suggests adding a getter when the field resolves to a public field. +- `proxy-jdk-query` still fails each such field at query time. +- `proxy-cglib` serves methods and getters through a CGLIB proxy with no warning, but a public field reads `0`. +- `proxy-plain` serves the same resolver without a proxy and with no warning. + +## Expected results + +- **JDK proxy.** `run jdk-proxy`. Exit `0`. `probe.log` has three + `SchemaClassScanner` WARNs starting `Field 'Query.test'`, `Field 'Query.count'` and `Field 'Query.total'`. The + `count` one ends `Add a getter for the field and use class-based proxies, e.g. proxyTargetClass = true in Spring.`, the + other two end `Use class-based proxies instead, e.g. proxyTargetClass = true in Spring.` `01-query.json` has + `data = {"test": null, "count": null, "total": null}` and three errors, `object of type jdk.proxy2.$ProxyN is not an + instance of scenarios.ProxiedQuery` for `test` and `total`, and `Can not get final int field scenarios.ProxiedQuery.count` + for `count`. +- **CGLIB proxy.** `run jdk-proxy-cglib`. Exit `0`, empty `probe.log`, + `01-query.json` has `data = {"test": "ok", "count": 0, "total": 2}`. +- **No proxy.** `run jdk-proxy-plain`. Exit `0`, empty `probe.log`, + `01-query.json` has `data = {"test": "ok", "count": 1, "total": 2}`. + +## Gotchas + +- The warning shipped with #853. On a checkout without it, `jdk-proxy` has the same query errors and an empty `probe.log`. +- The proxy number in `jdk.proxy2.$ProxyN` varies between runs. +- CGLIB can't override `final` members, so the resolver and its members must be `open`. A final getter is called on the + proxy itself and reads the proxy's empty field, like `count` does. +- The three scenarios share the schema and operations in `scenarios/jdk-proxy/`. diff --git a/.claude/skills/verify-tools/features/schema-building.md b/.claude/skills/verify-tools/features/schema-building.md new file mode 100644 index 00000000..177aa820 --- /dev/null +++ b/.claude/skills/verify-tools/features/schema-building.md @@ -0,0 +1,53 @@ +# Schema building + +A user points `SchemaParser.newParser()` at SDL files on the classpath and hands it resolver objects. graphql-java-tools +matches every SDL type to a class and every field to a resolver method, getter or property, and returns an executable +`GraphQLSchema`. When it can't find a field's implementation, it fails the build with a message that lists every +signature it tried. Types no root can reach get a warning and are dropped from the schema. + +## Sub-features + +- `build-files` loads SDL with `.file()` and `.files()` from the classpath, including `extend type`. +- `build-root-resolver` resolves `Query` fields through a `GraphQLQueryResolver`'s methods, with and without arguments. +- `build-nested-resolver` resolves a field through a `GraphQLResolver` method that takes the parent object. +- `build-properties` resolves fields through Kotlin properties and an `isX()` getter for a `Boolean!` field. +- `build-scalar` serializes a custom `GraphQLScalarType` registered with `.scalars()`. +- `build-unused-type` warns about a type no root can reach and leaves it out of the schema. +- `build-missing-resolver` fails the build with `FieldResolverError` and lists the signatures it searched. +- `build-read-only` builds a schema without mutation and subscription through `parseSchemaObjects().toReadOnlySchema()`, + with interfaces, unions and custom directives working as in the full schema. + +## Expected results + +- The `bookstore` books are `b1` "The Dispossessed" (a1, stock 3), `b2` "The Left Hand of Darkness" (a1, + stock 0) and `b3` "Use of Weapons" (a2, stock 1), and authors `a1` "Ursula K. Le Guin" and `a2` "Iain M. Banks". + +- **Build and list.** `run bookstore`. Exit `0`, and `summary.txt` has + `schema build: OK`, `unused definitions: Review`, and `operation 01-books: errors=0`. +- **Root, nested, properties, scalar.** In `01-books.json`, `data.books` has 3 entries in id order. `b1` has + `"published": "1974-05-01"` and `"inStock": true`, `b2` has `"inStock": false`, and every `author.name` matches the data + above. +- **Argument and null result.** `02-book-by-id.json` (variables `{"id": "b3"}`) has + `data.book = {"title": "Use of Weapons", "author": {"id": "a2", "name": "Iain M. Banks"}}` and `data.missing = null`, + with no `errors`. +- **Unused type.** `probe.log` contains `Schema type was defined but can never be accessed, and can be safely deleted: + Review`. `schema.graphqls` has no `type Review`. +- **Missing resolver.** `run bookstore-missing-resolver`. Exit `2`. `summary.txt` + has `schema build: FAILED graphql.kickstart.tools.resolver.FieldResolverError: No method or field found as defined in + schema scenarios/bookstore-missing-resolver/extension.graphqls:2`. The 8 listed signatures start with + `scenarios.AuthorResolver.isbn(scenarios.Book)`, have `scenarios.Book.isbn` sixth, and end with + `scenarios.AuthorResolver.getIsbn()`. `build-error.txt` has the stack trace. +- **Read-only schema.** `run read-only-schema`. Exit `0` and all three operations + have `errors=0`. `01-interface.json` has `data.animal = {"__typename": "Cat", "name": "Tom", "lives": 9}`, + `02-union.json` lists `Dog` Rex then `Cat` Tom, and `03-no-mutation.json` has `mutationType: null`. `schema.graphqls` + has `directive @tag` and `@tag(name : "public")` on the three `name` fields. Before the #896 fix the build failed with + `AssertException: There must be a type resolver for interface Animal`. + +## Gotchas + +- `bookstore-missing-resolver` loads `bookstore/schema.graphqls` too, so a change that breaks `bookstore` shows up here + first as a different build error. Run `bookstore` first. +- The signature list in the error is in search priority order. A change to resolver lookup order shows up there before + anything fails. +- `schema.graphqls` also lists graphql-java's built-in directives (`@defer`, `@oneOf`, ...). Their presence depends on + the graphql-java version, not on graphql-java-tools. diff --git a/.claude/skills/verify-tools/features/schema-options.md b/.claude/skills/verify-tools/features/schema-options.md new file mode 100644 index 00000000..94674e96 --- /dev/null +++ b/.claude/skills/verify-tools/features/schema-options.md @@ -0,0 +1,21 @@ +# Schema parser options + +`SchemaParserOptions` changes how the schema is built and what clients can see. A `missingResolverDataFetcherProvider` +builds a data fetcher for fields that have no resolver, where the build would otherwise fail. + +## Sub-features + +- `opt-missing-resolver-provider` serves a field that has no resolver method or property from the provider's data fetcher. + +## Expected results + +- **Run.** `run options`. Exit `0`. `summary.txt` has `01-fields: errors=0`. +- **Fields and typename.** `01-fields.json` has `data = {"name": "tools", "unimplemented": "no resolver for + unimplemented", "__typename": "Query"}`. + +## Gotchas + +- The provider doesn't log `Missing resolver for field`. Only `allowUnimplementedResolvers(true)` does, and it also logs + a development-only warning. Don't expect either in `probe.log` for this scenario. +- `missingResolverDataFetcher(...)` is the deprecated predecessor of the provider. Prove changes to it in a separate + scenario so this one stays free of deprecated API. diff --git a/.claude/skills/verify-tools/features/type-extensions.md b/.claude/skills/verify-tools/features/type-extensions.md new file mode 100644 index 00000000..51361af7 --- /dev/null +++ b/.claude/skills/verify-tools/features/type-extensions.md @@ -0,0 +1,62 @@ +# Type extensions + +`extend type`, `extend interface`, `extend union`, `extend enum`, `extend input` and `extend scalar` add to the type they +extend: fields, interfaces, members, values and directives are merged into one graphql-java type, base first. Where a type +declares an enum value, interface field or union member twice, or an extension applies a non-repeatable directive again, +the first one is kept and a WARN is logged. An object or input field declared twice keeps the last declaration, the type's +own for an input since its extensions are applied first, and logs a WARN that names that declaration. An extension of a different kind than its type is ignored with a WARN. A union, +enum, interface or scalar that only has extensions is built from them. + +## Sub-features + +- `ext-interface-fields` merges the fields of `extend interface`, keeping the base `id` and its description. +- `ext-implements` makes `extend type Video implements Node` take effect. +- `ext-union-members` merges the members of `extend union`. +- `ext-enum-values` merges the values of `extend enum`, keeping the base description of a repeated value. +- `ext-lone-enum` builds an enum that only has extensions, from all of them. +- `ext-directives` applies the directives of every extension after those of the type. +- `ext-non-repeatable` keeps the first of a non-repeatable directive that an extension applies again, with a WARN. +- `ext-repeats` warns about a repeated interface field, union member and enum value. +- `ext-repeated-fields` warns about an object or input field declared twice, between a type and its extension, between + two extensions and inside one definition, and keeps the last declaration, the type's own for an input. +- `ext-other-kind` ignores `extend union Note` of `type Note` with a WARN. +- `ext-sealed` finds the class of a union member added by `extend union`, and of an implementor added by + `extend type X implements Y`, among the subclasses of a sealed class or interface. + +## Expected results + +- **Run.** `run type-extensions`. Exit `0`, and `errors=0` for all three + operations. +- **Fields and implements.** `01-node.json` has `article` with `createdAt = "2026-10-01"` and `title = "We launched"`, and + `video` with `__typename = "Video"` and `seconds = 90`. +- **Members, values, lone enum.** `02-search-and-enums.json` has `search` with an `Article` and a `Video`, + `colors = ["RED", "BLUE", "GREEN"]` and `shades = ["LIGHT", "DARK"]`. +- **Shape.** In `03-introspection.json`, `Node` has fields `id` ("The base id"), `createdAt`, `name`. `Video` has + interfaces `["Node"]`, `SearchResult` has possible types `["Article", "Video"]`, and `Color.RED` has the description + "The first red". +- **Directives.** `schema.graphqls` has `@tag(name : "base") @tag(name : "extension")` on `Node`, `SearchResult`, `Color`, + `Filter` and `Article`, and `Article` has `@owner(team : "content")` once, before its `@tag`s. +- **Warnings.** `probe.log` has one WARN each for `Type 'Note' is defined as an object type, but extended as a union`, + `@owner isn't repeatable`, `Type 'Node' declares field 'id'`, `Type 'SearchResult' declares member 'Article'` and + `Type 'Color' declares value 'RED'`. +- **Repeated fields.** `run type-extensions-repeated-fields`. Exit `0`, `errors=0` for both operations, and the same + schema, operation results and `inspect.txt` as master. `01-kept-declarations.json` has `typeAndExtension.name = "a"`, + `twoExtensions = {"id": "b", "name": "c"}`, `oneDefinition.name = "d"` and `echo = "1,t,2,3"`. `inspect.txt` has + `TypeAndExtension.name: From the extension`, `TwoExtensions.name: From the second extension`, + `OneDefinition.name: The second`, `InputTypeAndExtension.id: From the type`, + `InputTwoExtensions.id: From the second extension` and `InputOneDefinition.id: The second`. `probe.log` has exactly six + WARNs, one per type, each `Type '' declares field '' more than once, only the one at line , column 5 in + scenarios/type-extensions-repeated-fields/schema.graphqls is kept.` with lines 18 (`TypeAndExtension`), 32 + (`TwoExtensions`), 39 (`OneDefinition`), 44 (`InputTypeAndExtension`), 63 (`InputTwoExtensions`) and 70 + (`InputOneDefinition`). On master `probe.log` is empty. +- **Sealed.** `run type-extensions-sealed`. `01-pets-and-animals.json` has + `pets = [{"__typename": "Dog", "name": "Rex"}, {"__typename": "Cat", "lives": 9}]` and `animals` with a `Cow` and a + `Horse`, with no WARN in `probe.log`. + +## Gotchas + +- Before extensions were merged (master before PR #855), `type-extensions` still builds but `01` and `02` return errors: + `Node` loses `createdAt`, `Video` isn't a `Node`, and `BLUE` and `LIGHT` fail to serialize. `type-extensions-sealed` + fails validation with `Unknown type 'Dog'`. Use that as the contrast run, not as a regression in this map. +- graphql-java allows only one `__type` per introspection query, so `03` reads `__schema` instead. +- The `Note` type is unreachable on purpose, so the "can be safely deleted" WARN for it is expected. diff --git a/.claude/skills/verify-tools/probe.sh b/.claude/skills/verify-tools/probe.sh new file mode 100755 index 00000000..b5f69a5b --- /dev/null +++ b/.claude/skills/verify-tools/probe.sh @@ -0,0 +1,177 @@ +#!/usr/bin/env bash +# Drives graphql-java-tools the way a consuming app does: installs the current directory's checkout into a private local +# Maven repository, compiles the probe project in probe/ against it, builds a scenario's schema and runs its operations. +# See SKILL.md for the commands. Evidence goes to $TMPDIR/verify-tools/evidence/ and survives `clean`. +set -euo pipefail + +SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO="$(git rev-parse --show-toplevel 2>/dev/null)" || REPO="$(git -C "$SKILL_DIR" rev-parse --show-toplevel)" +ROOT="${TMPDIR:-/tmp}" +ROOT="${ROOT%/}/verify-tools" +KEY="$(basename "$REPO")-$(printf '%s' "$REPO" | sha256sum | cut -c1-8)" +WORK="$ROOT/work/$KEY" +M2="$WORK/m2" +TAIL_M2="$HOME/.m2/repository" +EVIDENCE_ROOT="$ROOT/evidence" +STAMP="$WORK/installed.stamp" + +die() { echo "probe: $*" >&2; exit 1; } + +pom_value() { sed -n "s:.*<$1>\(.*\).*:\1:p" "$REPO/pom.xml" | head -1; } +TOOLS_VERSION="$(pom_value version)" +KOTLIN_VERSION="$(pom_value kotlin.version)" + +# Identifies the library sources: HEAD plus any uncommitted change to pom.xml or src/, tracked or not +fingerprint() { + { + git -C "$REPO" rev-parse HEAD + git -C "$REPO" diff HEAD -- pom.xml src + git -C "$REPO" ls-files --others --exclude-standard -- src | while IFS= read -r file; do + echo "$file" + cat "$REPO/$file" + done + } | sha256sum | cut -c1-16 +} + +installed_jar() { echo "$M2/io/github/graphql-java-kickstart/graphql-java-tools/$TOOLS_VERSION/graphql-java-tools-$TOOLS_VERSION.jar"; } + +install_state() { + if [[ ! -f "$STAMP" || ! -f "$(installed_jar)" ]]; then echo missing + elif [[ "$(cat "$STAMP")" == "$(fingerprint)" ]]; then echo fresh + else echo stale + fi +} + +lock() { + mkdir -p "$WORK" + if ! mkdir "$WORK/lock" 2>/dev/null; then + local pid + pid="$(cat "$WORK/lock/pid" 2>/dev/null || true)" + if [[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null; then + die "another probe run (pid $pid) is using $WORK; wait for it instead of sharing the work dir" + fi + rm -rf "$WORK/lock" + mkdir "$WORK/lock" + fi + echo $$ > "$WORK/lock/pid" + trap 'rm -rf "$WORK/lock"' EXIT +} + +mvn_isolated() { + mvn -B "-Dmaven.repo.local=$M2" "-Dmaven.repo.local.tail=$TAIL_M2" "$@" +} + +cmd_install() { + local fp log + fp="$(fingerprint)" + log="$WORK/install.log" + echo "probe: installing $TOOLS_VERSION from $REPO into $M2 (log: $log)" + if ! (cd "$REPO" && mvn_isolated install -DskipTests > "$log" 2>&1); then + grep -E '^\[ERROR\]' "$log" | head -30 >&2 || true + die "install failed, see $log" + fi + echo "$fp" > "$STAMP" + echo "probe: installed $(installed_jar)" +} + +cmd_doctor() { + local state lock_state="free" + state="$(install_state)" + if [[ -f "$WORK/lock/pid" ]] && kill -0 "$(cat "$WORK/lock/pid")" 2>/dev/null; then + lock_state="held by pid $(cat "$WORK/lock/pid")" + fi + echo "checkout: $REPO" + echo "branch: $(git -C "$REPO" rev-parse --abbrev-ref HEAD) @ $(git -C "$REPO" rev-parse --short HEAD)" + echo "tools version: $TOOLS_VERSION (kotlin $KOTLIN_VERSION)" + echo "work dir: $WORK" + echo "install: $state ($(installed_jar))" + echo "lock: $lock_state" + echo "evidence: $EVIDENCE_ROOT" + echo "java: $(java -version 2>&1 | head -1)" + echo "maven: $(mvn -v 2>/dev/null | head -1)" + [[ -d "$TAIL_M2" ]] || echo "WARNING: $TAIL_M2 does not exist, every dependency will be downloaded into the work dir" + [[ "$state" == "fresh" ]] || echo "note: run installs the checkout first because the install is $state" +} + +cmd_list() { + grep -h 'override val name = ' "$SKILL_DIR"/probe/src/main/kotlin/scenarios/*.kt | sed 's/.*= "\(.*\)"/\1/' +} + +cmd_run() { + local scenario="" gj="" skip_install=false + while [[ $# -gt 0 ]]; do + case "$1" in + --graphql-java) gj="$2"; shift 2 ;; + --skip-install) skip_install=true; shift ;; + -*) die "unknown option $1" ;; + *) [[ -z "$scenario" ]] || die "one scenario per run"; scenario="$1"; shift ;; + esac + done + [[ -n "$scenario" ]] || die "usage: probe.sh run [--graphql-java VERSION] [--skip-install]" + cmd_list | grep -qx "$scenario" || die "unknown scenario '$scenario', known: $(cmd_list | tr '\n' ' ')" + + lock + local state + state="$(install_state)" + if [[ "$state" != "fresh" ]]; then + if [[ "$skip_install" == true && "$state" == "stale" ]]; then + echo "probe: WARNING install is stale, running against the previously installed jar" + else + cmd_install + fi + fi + + local evidence base n=1 build mvn_args=() exit_code + base="$EVIDENCE_ROOT/$(date +%Y%m%d-%H%M%S)-$scenario${gj:+-gj$gj}" + evidence=$base + build="$WORK/probe-target${gj:+-gj$gj}" + mkdir -p "$EVIDENCE_ROOT" + # Another checkout can start the same scenario in the same second + until mkdir "$evidence" 2>/dev/null; do + n=$((n + 1)) + evidence="$base-$n" + done + mvn_args=(-f "$SKILL_DIR/probe/pom.xml" "-Dtools.version=$TOOLS_VERSION" "-Dkotlin.version=$KOTLIN_VERSION" + "-Dprobe.build.dir=$build" "-Dmdep.outputFile=$build/classpath.txt") + [[ -z "$gj" ]] || mvn_args+=("-Dgraphql-java.version=$gj") + # resources:resources only copies, so an operation deleted from a scenario would keep running + rm -rf "$build"/classes/scenarios/*/ + if ! mvn_isolated "${mvn_args[@]}" compile dependency:build-classpath > "$evidence/maven.log" 2>&1; then + grep -E '^\[ERROR\]|^e: ' "$evidence/maven.log" | head -30 >&2 || true + die "probe compile failed, see $evidence/maven.log" + fi + + { + echo "checkout: $REPO" + echo "commit: $(git -C "$REPO" rev-parse HEAD)" + echo "source fingerprint: $(fingerprint)" + echo "install stamp: $(cat "$STAMP")" + echo "command: probe.sh run $scenario${gj:+ --graphql-java $gj}" + } > "$evidence/run.txt" + + set +e + java "-Dprobe.out=$evidence" -cp "$build/classes:$(cat "$build/classpath.txt")" probe.MainKt "$scenario" "$evidence" \ + 2> "$evidence/stderr.txt" | tee "$evidence/stdout.txt" + exit_code="${PIPESTATUS[0]}" + set -e + echo "exit code: $exit_code" >> "$evidence/run.txt" + echo "probe: exit $exit_code, evidence in $evidence" + return "$exit_code" +} + +cmd_clean() { + if [[ -f "$WORK/lock/pid" ]] && kill -0 "$(cat "$WORK/lock/pid")" 2>/dev/null; then + die "a probe run (pid $(cat "$WORK/lock/pid")) is still using $WORK" + fi + rm -rf "$WORK" + echo "probe: removed $WORK; evidence kept in $EVIDENCE_ROOT" +} + +case "${1:-}" in + install) lock; cmd_install ;; + doctor) cmd_doctor ;; + list) cmd_list ;; + run) shift; cmd_run "$@" ;; + clean) cmd_clean ;; + *) echo "usage: probe.sh {doctor|list|install|run [--graphql-java VERSION] [--skip-install]|clean}" >&2; exit 64 ;; +esac diff --git a/.claude/skills/verify-tools/probe/pom.xml b/.claude/skills/verify-tools/probe/pom.xml new file mode 100644 index 00000000..c17028ce --- /dev/null +++ b/.claude/skills/verify-tools/probe/pom.xml @@ -0,0 +1,95 @@ + + + + 4.0.0 + + verify + graphql-java-tools-probe + 0 + + + UTF-8 + + UNSET + 2.3.10 + ${project.basedir}/target + + + + + io.github.graphql-java-kickstart + graphql-java-tools + ${tools.version} + + + + com.fasterxml.jackson.core + jackson-databind + 2.22.4 + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + org.springframework + spring-aop + 5.3.39 + + + ch.qos.logback + logback-classic + 1.6.5 + + + + + + + graphql-java-override + + + graphql-java.version + + + + + + com.graphql-java + graphql-java + ${graphql-java.version} + + + + + + + + ${probe.build.dir} + src/main/kotlin + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + 11 + + + + compile + + compile + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.8.1 + + + + diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/probe/DirectiveDump.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/probe/DirectiveDump.kt new file mode 100644 index 00000000..0c622e39 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/probe/DirectiveDump.kt @@ -0,0 +1,65 @@ +package probe + +import graphql.language.AstPrinter +import graphql.language.Node +import graphql.schema.GraphQLAppliedDirective +import graphql.schema.GraphQLArgument +import graphql.schema.GraphQLDirective +import graphql.schema.GraphQLDirectiveContainer +import graphql.schema.GraphQLEnumType +import graphql.schema.GraphQLFieldsContainer +import graphql.schema.GraphQLInputObjectType +import graphql.schema.GraphQLNamedType +import graphql.schema.GraphQLSchema +import graphql.schema.GraphQLTypeUtil +import graphql.schema.InputValueWithState + +/** Lists the applied and the legacy directives of every element that can carry them, in a stable order. */ +fun dumpDirectives(schema: GraphQLSchema): String = buildString { + @Suppress("DEPRECATION") + section("schema", schema.schemaAppliedDirectives, schema.schemaDirectives) + schema.directives.sortedBy { it.name }.forEach { definition -> + definition.arguments.forEach { container("directive @${definition.name}(${it.name})", it) } + } + schema.allTypesAsList.filter { !it.name.startsWith("__") }.sortedBy { it.name }.forEach { type -> + if (type is GraphQLDirectiveContainer) container("type ${type.name}", type) + when (type) { + is GraphQLFieldsContainer -> type.fieldDefinitions.forEach { field -> + container("field ${type.name}.${field.name}", field) + field.arguments.forEach { container("argument ${type.name}.${field.name}(${it.name})", it) } + } + is GraphQLInputObjectType -> type.fieldDefinitions.forEach { container("input field ${type.name}.${it.name}", it) } + is GraphQLEnumType -> type.values.forEach { container("enum value ${type.name}.${it.name}", it) } + } + } +} + +@Suppress("DEPRECATION") +private fun StringBuilder.container(label: String, element: GraphQLDirectiveContainer) = + section(label, element.appliedDirectives, element.directives) + +private fun StringBuilder.section(label: String, applied: List, legacy: List) { + if (applied.isEmpty() && legacy.isEmpty()) return + appendLine(label) + applied.forEach { directive -> + appendLine(" applied @${directive.name} description=${directive.description} definition=${directive.definition?.sourceLocation?.let { "${it.line}:${it.column}" }}") + directive.arguments.forEach { + appendLine(" ${it.name}: ${GraphQLTypeUtil.simplePrint(it.type)} = ${describe(it.argumentValue)} description=${it.description}") + } + } + legacy.forEach { directive -> + appendLine(" legacy @${directive.name} description=${directive.description} repeatable=${directive.isRepeatable} locations=${directive.validLocations()}") + directive.arguments.forEach { appendLine(" ${legacyArgument(it)}") } + } +} + +@Suppress("DEPRECATION") +private fun legacyArgument(argument: GraphQLArgument) = + "${argument.name}: ${GraphQLTypeUtil.simplePrint(argument.type)} = ${describe(argument.argumentValue)} description=${argument.description}" + +private fun describe(value: InputValueWithState): String = when { + value.isNotSet -> "" + value.isLiteral -> "literal ${AstPrinter.printAst(value.value as Node<*>)}" + value.isExternal -> "external ${value.value}" + else -> "internal ${value.value}" +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt new file mode 100644 index 00000000..33b3115d --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt @@ -0,0 +1,125 @@ +package probe + +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.SerializationFeature +import graphql.ExecutionInput +import graphql.ExecutionResult +import graphql.GraphQL +import graphql.kickstart.tools.SchemaParser +import graphql.schema.GraphQLSchema +import graphql.schema.idl.SchemaPrinter +import org.reactivestreams.Publisher +import org.reactivestreams.Subscriber +import org.reactivestreams.Subscription +import scenarios.SCENARIOS +import java.io.File +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit +import kotlin.system.exitProcess + +/** + * Builds the scenario's schema through the public API of the graphql-java-tools jar on the classpath, then runs every + * `.graphql` file under `scenarios//` against it. Everything it observes goes to the output directory. + * + * Exit codes: 0 schema built and all operations ran (operations may still have GraphQL errors, see summary.txt), + * 2 schema build threw, 64 bad arguments. + */ +fun main(args: Array) { + if (args.size != 2) usage("expected ") + val scenario = SCENARIOS.find { it.name == args[0] } ?: usage("unknown scenario '${args[0]}'") + val out = File(args[1]).apply { mkdirs() } + val summary = StringBuilder() + fun report(line: String) { + println(line) + summary.appendLine(line) + } + + report("scenario: ${scenario.name}") + report("graphql-java-tools jar: ${jarOf(SchemaParser::class.java)}") + report("graphql-java jar: ${jarOf(GraphQL::class.java)}") + report("java: ${System.getProperty("java.version")}") + + val schema: GraphQLSchema + try { + val parser = scenario.parser().build() + schema = scenario.schema(parser) + val unused = parser.getUnusedDefinitions().map { it.name }.sorted() + if (unused.isNotEmpty()) report("unused definitions: ${unused.joinToString()}") + } catch (e: Throwable) { + File(out, "build-error.txt").writeText(e.stackTraceToString()) + report("schema build: FAILED ${e.javaClass.name}: ${e.message}") + File(out, "summary.txt").writeText(summary.toString()) + exitProcess(2) + } + File(out, "schema.graphqls").writeText(SchemaPrinter().print(schema)) + scenario.inspect(schema)?.let { File(out, "inspect.txt").writeText(it) } + report("schema build: OK") + + val graphQL = scenario.graphQL(GraphQL.newGraphQL(schema)).build() + for (operation in operationFiles(scenario.operations)) { + val name = operation.nameWithoutExtension + val variablesFile = File(operation.parentFile, "$name.variables.json") + @Suppress("UNCHECKED_CAST") + val variables = if (variablesFile.exists()) json.readValue(variablesFile, Map::class.java) as Map else emptyMap() + val input = scenario.input(ExecutionInput.newExecutionInput().query(operation.readText()).variables(variables)).build() + + val result = try { + graphQL.execute(input) + } catch (e: Throwable) { + File(out, "$name.json").writeText(json.writeValueAsString(mapOf("threw" to e.toString()))) + report("operation $name: THREW $e") + continue + } + // A subscription's data is a Publisher of results + @Suppress("UNCHECKED_CAST") + val publisher = result.getData() as? Publisher + val written = LinkedHashMap() + var eventCount = "" + if (publisher != null) { + val events = collect(publisher) + written["events"] = events + result.toSpecification()["errors"]?.let { written["errors"] = it } + eventCount = " events=${events.size}" + } else { + written.putAll(result.toSpecification()) + } + File(out, "$name.json").writeText(json.writeValueAsString(written)) + report("operation $name: errors=${result.errors.size}$eventCount") + result.errors.forEach { report(" error: ${it.message}") } + } + File(out, "summary.txt").writeText(summary.toString()) +} + +private val json = ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT) + +private fun usage(problem: String): Nothing { + System.err.println("$problem\nusage: probe \nscenarios: ${SCENARIOS.joinToString { it.name }}") + exitProcess(64) +} + +private fun jarOf(clazz: Class<*>) = clazz.protectionDomain.codeSource?.location?.path ?: "unknown" + +private fun operationFiles(scenario: String): List { + val dir = Thread.currentThread().contextClassLoader.getResource("scenarios/$scenario") + ?: return emptyList() + return File(dir.toURI()).listFiles { file -> file.extension == "graphql" }!!.sortedBy { it.name } +} + +/** Subscribes the way a transport would and collects every event until completion, for up to 10 seconds. */ +private fun collect(publisher: Publisher): List> { + val events = mutableListOf>() + val done = CountDownLatch(1) + publisher.subscribe(object : Subscriber { + override fun onSubscribe(subscription: Subscription) = subscription.request(Long.MAX_VALUE) + override fun onNext(event: ExecutionResult) { + synchronized(events) { events.add(event.toSpecification()) } + } + override fun onError(error: Throwable) { + synchronized(events) { events.add(mapOf("publisherError" to error.toString())) } + done.countDown() + } + override fun onComplete() = done.countDown() + }) + if (!done.await(10, TimeUnit.SECONDS)) println(" subscription did not complete within 10 seconds") + return synchronized(events) { events.toList() } +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Async.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Async.kt new file mode 100644 index 00000000..535d8f4d --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Async.kt @@ -0,0 +1,48 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.GraphQLSubscriptionResolver +import graphql.kickstart.tools.SchemaParser +import kotlinx.coroutines.delay +import kotlinx.coroutines.reactive.publish +import org.reactivestreams.Publisher +import java.util.concurrent.CompletableFuture + +/** CompletableFuture and suspend resolvers, a suspend field resolver on a nested type, and a Publisher subscription. */ +object Async : Scenario { + override val name = "async" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/async/schema.graphqls") + .resolvers(AsyncQuery(), ShipmentResolver(), AsyncSubscription()) +} + +data class Shipment(val id: String) + +class AsyncQuery : GraphQLQueryResolver { + fun future(): CompletableFuture = CompletableFuture.supplyAsync { "from a future" } + + suspend fun suspended(): String { + delay(10) + return "from a suspend function" + } + + suspend fun shipments(): List = listOf(Shipment("s1"), Shipment("s2")) +} + +class ShipmentResolver : GraphQLResolver { + suspend fun status(shipment: Shipment): String { + delay(5) + return "${shipment.id}: delivered" + } +} + +class AsyncSubscription : GraphQLSubscriptionResolver { + fun ticks(count: Int): Publisher = publish { + repeat(count) { + delay(10) + send(it + 1) + } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Bookstore.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Bookstore.kt new file mode 100644 index 00000000..624ef070 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Bookstore.kt @@ -0,0 +1,70 @@ +package scenarios + +import graphql.GraphQLContext +import graphql.execution.CoercedVariables +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.SchemaParser +import graphql.language.StringValue +import graphql.language.Value +import graphql.schema.Coercing +import graphql.schema.GraphQLScalarType +import java.time.LocalDate +import java.util.Locale + +/** Root resolver, a GraphQLResolver for a nested type, data class properties, an is-getter and a custom scalar. */ +object Bookstore : Scenario { + override val name = "bookstore" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/bookstore/schema.graphqls") + .resolvers(BookstoreQuery(), AuthorResolver()) + .scalars(dateScalar) +} + +/** The same schema plus a field no resolver or class implements. */ +object BookstoreMissingResolver : Scenario { + override val name = "bookstore-missing-resolver" + + override fun parser() = SchemaParser.newParser() + .files("scenarios/bookstore/schema.graphqls", "scenarios/bookstore-missing-resolver/extension.graphqls") + .resolvers(BookstoreQuery(), AuthorResolver()) + .scalars(dateScalar) +} + +data class Author(val id: String, val name: String) + +class Book(val id: String, val title: String, val authorId: String, val published: LocalDate, private val stock: Int) { + fun isInStock() = stock > 0 +} + +private val authors = listOf(Author("a1", "Ursula K. Le Guin"), Author("a2", "Iain M. Banks")) +private val books = listOf( + Book("b1", "The Dispossessed", "a1", LocalDate.of(1974, 5, 1), 3), + Book("b2", "The Left Hand of Darkness", "a1", LocalDate.of(1969, 3, 1), 0), + Book("b3", "Use of Weapons", "a2", LocalDate.of(1990, 9, 1), 1), +) + +class BookstoreQuery : GraphQLQueryResolver { + fun books(): List = books + fun book(id: String): Book? = books.find { it.id == id } +} + +class AuthorResolver : GraphQLResolver { + fun author(book: Book): Author = authors.first { it.id == book.authorId } +} + +val dateScalar: GraphQLScalarType = GraphQLScalarType.newScalar() + .name("Date") + .description("ISO-8601 date") + .coercing(object : Coercing { + override fun serialize(dataFetcherResult: Any, graphQLContext: GraphQLContext, locale: Locale) = + (dataFetcherResult as LocalDate).toString() + + override fun parseValue(input: Any, graphQLContext: GraphQLContext, locale: Locale): LocalDate = + LocalDate.parse(input as String) + + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, graphQLContext: GraphQLContext, locale: Locale): LocalDate = + LocalDate.parse((input as StringValue).value) + }) + .build() diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextAndEnvironment.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextAndEnvironment.kt new file mode 100644 index 00000000..d569d63d --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextAndEnvironment.kt @@ -0,0 +1,59 @@ +package scenarios + +import graphql.ExecutionInput +import graphql.GraphQLContext +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.DataFetchingEnvironment + +/** Resolver methods that take the custom context class and DataFetchingEnvironment after the schema arguments. */ +object ContextAndEnvironment : Scenario { + override val name = "context-and-environment" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/context-and-environment/schema.graphqls") + .resolvers(ContextAndEnvironmentQuery(), UserResolver()) + .options(SchemaParserOptions.newOptions().contextClass(AppContext::class).build()) + + override fun input(builder: ExecutionInput.Builder): ExecutionInput.Builder = + builder.graphQLContext(mapOf(AppContext::class.java to AppContext("oryan", "en-CA"))) +} + +/** A trailing parameter that is neither a context nor the environment. */ +object ContextAndEnvironmentInvalid : Scenario { + override val name = "context-and-environment-invalid" + + override fun parser() = SchemaParser.newParser() + .schemaString("type Query { greeting(name: String!): String! }") + .resolvers(ContextAndEnvironmentInvalidQuery()) + .options(SchemaParserOptions.newOptions().contextClass(AppContext::class).build()) +} + +data class AppContext(val user: String, val locale: String) + +class AppUser(val name: String) + +class ContextAndEnvironmentQuery : GraphQLQueryResolver { + fun greeting(name: String, context: AppContext, env: DataFetchingEnvironment) = + "${env.field.name}: hi $name, from ${context.user}" + + fun farewell(name: String, env: DataFetchingEnvironment, context: AppContext) = + "${env.field.name}: bye $name, from ${context.user}" + + fun user(context: AppContext) = AppUser(context.user) + + fun environmentOnly(env: DataFetchingEnvironment) = env.field.name + + fun contextOnly(context: AppContext) = context.locale +} + +class UserResolver : GraphQLResolver { + fun locale(user: AppUser, context: GraphQLContext, env: DataFetchingEnvironment) = + "${env.field.name} of ${user.name}: ${context.get(AppContext::class.java)?.locale}" +} + +class ContextAndEnvironmentInvalidQuery : GraphQLQueryResolver { + fun greeting(name: String, context: AppContext, extra: String) = "hi $name" +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextMisbound.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextMisbound.kt new file mode 100644 index 00000000..10612981 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextMisbound.kt @@ -0,0 +1,35 @@ +package scenarios + +import graphql.ExecutionInput +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.DataFetchingEnvironment + +/** Resolver methods whose environment or context parameter takes the place of a schema argument. */ +object ContextMisbound : Scenario { + override val name = "context-misbound" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/context-misbound/schema.graphqls") + .resolvers(ContextMisboundQuery(), MisboundUserResolver()) + .options(SchemaParserOptions.newOptions().contextClass(AppContext::class).build()) + + override fun input(builder: ExecutionInput.Builder): ExecutionInput.Builder = + builder.graphQLContext(mapOf(AppContext::class.java to AppContext("oryan", "en-CA"))) +} + +class ContextMisboundQuery : GraphQLQueryResolver { + fun users(env: DataFetchingEnvironment) = listOf(AppUser(env.field.name)) + + fun user() = AppUser("ada") + + fun contextArgument(context: AppContext) = context.user + + fun greeting(name: String, env: DataFetchingEnvironment) = "${env.field.name}: hi $name" +} + +class MisboundUserResolver : GraphQLResolver { + fun thumbnail(user: AppUser, env: DataFetchingEnvironment) = "${env.field.name} of ${user.name}" +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectiveDrift.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectiveDrift.kt new file mode 100644 index 00000000..87dc56e5 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectiveDrift.kt @@ -0,0 +1,65 @@ +package scenarios + +import graphql.Scalars +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.GraphQLScalarType +import graphql.schema.GraphQLSchema +import probe.dumpDirectives + +/** + * Every place a directive can be applied, with repeated non-repeatable, undeclared, defaulted and described arguments, + * extensions, and a scalar whose directive has an unknown argument. inspect.txt lists the applied and legacy directives. + */ +object DirectiveDrift : Scenario { + override val name = "directive-drift" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/directive-drift/schema.graphqls") + .resolvers(DirectiveDriftQuery()) + .dictionary("Dog", DriftDog::class.java) + .scalars(stringScalar("Date"), stringScalar("Money")) + .options(SchemaParserOptions.newOptions().allowUndeclaredDirectives(true).build()) + + override fun inspect(schema: GraphQLSchema) = dumpDirectives(schema) +} + +/** An undeclared directive without allowUndeclaredDirectives. */ +object DirectiveDriftUndeclared : Scenario { + override val name = "directive-drift-undeclared" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/directive-drift-undeclared/schema.graphqls") + .resolvers(DirectiveDriftOneField()) +} + +private fun stringScalar(name: String) = GraphQLScalarType.newScalar().name(name).coercing(Scalars.GraphQLString.coercing).build() + +interface DriftAnimal { + val name: String +} + +class DriftDog(override val name: String) : DriftAnimal + +enum class DriftColor { RED, GREEN, BLUE } + +data class DriftMeta(val owner: String?) + +class DirectiveDriftQuery : GraphQLQueryResolver { + fun plain() = "plain" + fun wrongPlace(arg: String?) = arg + fun missing() = "missing" + fun old() = "old" + fun older() = "older" + fun search(filter: DriftMeta?, term: String?) = "${filter?.owner} $term" + fun animal(): DriftAnimal = DriftDog("rex") + fun pet(): Any = DriftDog("rex") + fun color() = DriftColor.RED + fun `when`() = "2026-10-22" + fun price() = "9.99" +} + +class DirectiveDriftOneField : GraphQLQueryResolver { + fun a() = "a" +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Directives.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Directives.kt new file mode 100644 index 00000000..179b0a2f --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Directives.kt @@ -0,0 +1,42 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.relay.Connection +import graphql.relay.SimpleListConnection +import graphql.schema.DataFetcherFactories +import graphql.schema.DataFetchingEnvironment +import graphql.schema.GraphQLFieldDefinition +import graphql.schema.idl.SchemaDirectiveWiring +import graphql.schema.idl.SchemaDirectiveWiringEnvironment + +/** A named SchemaDirectiveWiring that wraps a data fetcher, @deprecated, and a relay connection generated by @connection. */ +object Directives : Scenario { + override val name = "directives" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/directives/schema.graphqls") + .resolvers(DirectivesQuery()) + .directive("uppercase", UppercaseDirective()) +} + +data class Member(val id: String, val name: String) + +private val members = listOf(Member("m1", "ada"), Member("m2", "grace"), Member("m3", "barbara")) + +class DirectivesQuery : GraphQLQueryResolver { + fun motto() = "keep it simple" + + fun oldMotto() = "move fast" + + fun members(first: Int?, after: String?, env: DataFetchingEnvironment): Connection = + SimpleListConnection(members).get(env) +} + +class UppercaseDirective : SchemaDirectiveWiring { + override fun onField(environment: SchemaDirectiveWiringEnvironment): GraphQLFieldDefinition { + val original = environment.fieldDataFetcher + environment.fieldDataFetcher = DataFetcherFactories.wrapDataFetcher(original) { _, value -> (value as? String)?.uppercase() } + return environment.element + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectivesInvalid.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectivesInvalid.kt new file mode 100644 index 00000000..d641ffd3 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectivesInvalid.kt @@ -0,0 +1,22 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser + +/** Directives applied at a location their definition doesn't list, without a required argument, or twice when not repeatable. */ +object DirectivesInvalid : Scenario { + override val name = "directives-invalid" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/directives-invalid/schema.graphqls") + .resolvers(DirectivesInvalidQuery()) + .directive("uppercase", UppercaseDirective()) +} + +class DirectivesInvalidQuery : GraphQLQueryResolver { + fun motto() = "keep it simple" + + fun secret() = "42" + + fun members() = listOf(Member("m1", "ada")) +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/GenericInputResolver.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/GenericInputResolver.kt new file mode 100644 index 00000000..375ebc22 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/GenericInputResolver.kt @@ -0,0 +1,23 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser + +/** A query resolver inheriting a method whose parameter is its superclass's type variable. */ +object GenericInputResolver : Scenario { + override val name = "generic-input-resolver" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/generic-input-resolver/schema.graphqls") + .resolvers(GreetingQuery()) +} + +data class GreetingInput(val name: String) + +abstract class InputResolver : GraphQLQueryResolver { + fun generic(input: I): String = "generic got $input" +} + +class GreetingQuery : InputResolver() { + fun plain(input: GreetingInput): String = "plain got $input" +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Inputs.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Inputs.kt new file mode 100644 index 00000000..3172da5d --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Inputs.kt @@ -0,0 +1,44 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLMutationResolver +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.DataFetchingEnvironment +import java.util.Optional + +/** Scalar, list, enum and input object arguments, SDL default values, DataFetchingEnvironment and omitted vs null. */ +object Inputs : Scenario { + override val name = "inputs" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/inputs/schema.graphqls") + .resolvers(InputsQuery(), InputsMutation()) + .options(SchemaParserOptions.newOptions().inputArgumentOptionalDetectOmission(true).build()) +} + +enum class Genre { FICTION, SCIENCE, HISTORY } + +data class BookInput(val title: String, val genre: Genre, val tags: List?, val details: DetailsInput?) + +data class DetailsInput(val pages: Int, val language: String) + +data class SavedBook(val title: String, val genre: Genre, val tags: List, val pages: Int?, val language: String?) + +class InputsQuery : GraphQLQueryResolver { + fun search(term: String, limit: Int, genres: List?, env: DataFetchingEnvironment): String = + "term=$term limit=$limit genres=$genres field=${env.field.name}" + + /** null when the argument was omitted, Optional.empty() when it was passed as null. */ + @Suppress("OptionalAssignedToNull") + fun nickname(value: Optional?): String = when { + value == null -> "omitted" + value.isEmpty -> "explicit null" + else -> "value ${value.get()}" + } +} + +class InputsMutation : GraphQLMutationResolver { + fun addBook(input: BookInput): SavedBook = + SavedBook(input.title, input.genre, input.tags ?: emptyList(), input.details?.pages, input.details?.language) +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/JdkProxy.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/JdkProxy.kt new file mode 100644 index 00000000..fa417aa2 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/JdkProxy.kt @@ -0,0 +1,45 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import org.springframework.aop.framework.ProxyFactory +import org.springframework.aop.support.AopUtils + +/** Issue #822: the resolver behind a Spring JDK dynamic proxy, which only implements GraphQLQueryResolver. */ +object JdkProxy : Scenario { + override val name = "jdk-proxy" + + override fun parser() = proxyParser(proxy(proxyTargetClass = false).also { check(AopUtils.isJdkDynamicProxy(it)) }) +} + +/** The workaround: the same resolver behind a CGLIB proxy. */ +object JdkProxyCglib : Scenario { + override val name = "jdk-proxy-cglib" + override val operations = "jdk-proxy" + + override fun parser() = proxyParser(proxy(proxyTargetClass = true).also { check(AopUtils.isCglibProxy(it)) }) +} + +/** The same resolver without a proxy. */ +object JdkProxyPlain : Scenario { + override val name = "jdk-proxy-plain" + override val operations = "jdk-proxy" + + override fun parser() = proxyParser(ProxiedQuery()) +} + +open class ProxiedQuery : GraphQLQueryResolver { + open fun test() = "ok" + + @JvmField + val count = 1 + + open val total = 2 +} + +private fun proxy(proxyTargetClass: Boolean) = + ProxyFactory(ProxiedQuery()).apply { isProxyTargetClass = proxyTargetClass }.proxy as GraphQLQueryResolver + +private fun proxyParser(resolver: GraphQLQueryResolver) = SchemaParser.newParser() + .file("scenarios/jdk-proxy/schema.graphqls") + .resolvers(resolver) diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedUnions.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedUnions.kt new file mode 100644 index 00000000..0649a90b --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedUnions.kt @@ -0,0 +1,24 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser + +/** + * A union that is only a member of another union. No field returns `Media`. + */ +object NestedUnions : Scenario { + override val name = "nested-unions" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/nested-unions/schema.graphqls") + .resolvers(NestedUnionsQuery()) + .dictionary(NestedUnionsQuery.Book::class.java, NestedUnionsQuery.Movie::class.java) +} + +class NestedUnionsQuery : GraphQLQueryResolver { + fun results(): List = listOf(Book("Solaris"), Movie("Stalker")) + + data class Book(val title: String) + + data class Movie(val title: String) +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappers.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappers.kt new file mode 100644 index 00000000..854d19f6 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappers.kt @@ -0,0 +1,110 @@ +package scenarios + +import graphql.GraphQL +import graphql.execution.DefaultValueUnboxer +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserOptions +import graphql.ExecutionInput +import graphql.schema.DataFetchingEnvironment +import org.dataloader.BatchLoader +import org.dataloader.DataLoaderFactory +import org.dataloader.DataLoaderRegistry +import java.util.concurrent.CompletableFuture +import java.util.concurrent.CompletableFuture.completedFuture + +/** Generic wrappers and futures nested inside lists and inside other futures (issue 254). */ +object NestedWrappers : Scenario { + override val name = "nested-wrappers" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/nested-wrappers/schema.graphqls") + .resolvers(NestedWrappersQuery()) + .options(SchemaParserOptions.newOptions().genericWrappers(tryWrapper).build()) + + override fun input(builder: ExecutionInput.Builder): ExecutionInput.Builder = builder.dataLoaderRegistry( + DataLoaderRegistry().apply { + register("items", DataLoaderFactory.newDataLoader(BatchLoader { keys -> completedFuture(keys.map { NestedItem(it) }) })) + } + ) + + private val tryWrapper = SchemaParserOptions.GenericWrapper.withTransformer(Try::class, 0, { t -> t.get() }) +} + +/** The same resolvers, run by an app whose own graphql-java ValueUnboxer already unwraps Try and joins futures. */ +object NestedWrappersUnboxer : Scenario by NestedWrappers { + override val name = "nested-wrappers-unboxer" + + override fun graphQL(builder: GraphQL.Builder): GraphQL.Builder = builder.valueUnboxer { value -> + val unwrapped = when (value) { + is Try<*> -> value.get() + is CompletableFuture<*> -> value.join() + else -> value + } + unwrapped?.let { DefaultValueUnboxer.unboxValue(it) } + } +} + +sealed class Try { + abstract fun get(): T + + data class Success(val value: T) : Try() { + override fun get() = value + } + + data class Failure(val cause: Throwable) : Try() { + override fun get(): Nothing = throw cause + } +} + +data class Payload(val data: String) + +data class NestedItem(val id: String) + +class NestedWrappersQuery : GraphQLQueryResolver { + fun payload(): Try = Try.Success(Payload("single")) + + fun payloads(): List> = listOf(Try.Success(Payload("a")), Try.Success(Payload("b"))) + + fun payloadStrings(): List> = listOf(Try.Success("a"), Try.Success("b")) + + fun items(): List> = listOf(completedFuture(NestedItem("1")), CompletableFuture.supplyAsync { NestedItem("2") }) + + fun itemNames(): List> = listOf(completedFuture("one"), CompletableFuture.supplyAsync { "two" }) + + fun futureOfFuture(): CompletableFuture> = CompletableFuture.supplyAsync { completedFuture(NestedItem("inner")) } + + fun futureOfTries(): CompletableFuture>> = completedFuture(payloads()) + + fun triesOfFutures(): List>> = items().map { Try.Success(it) } + + fun loadedItems(env: DataFetchingEnvironment): List> = + listOf("x", "y").map { env.getDataLoader("items")!!.load(it) } + + fun failedTryInList(): List> = listOf(Try.Success(Payload("ok")), Try.Failure(IllegalStateException("payload failed"))) + + fun failedFutureInList(): List> = + listOf(completedFuture(NestedItem("ok")), CompletableFuture.failedFuture(IllegalStateException("item failed"))) + + fun plainItems(): List = listOf(NestedItem("p1"), NestedItem("p2")) + + fun futureOfItems(): CompletableFuture> = completedFuture(plainItems()) +} + +/** Suspend functions returning lists of an open class, which Kotlin reflection types as List. */ +object NestedWrappersSuspend : Scenario { + override val name = "nested-wrappers-suspend" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/nested-wrappers-suspend/schema.graphqls") + .resolvers(NestedWrappersSuspendQuery()) +} + +class NestedWrappersSuspendQuery : GraphQLQueryResolver { + suspend fun nullableItems(): List> = listOf(completedFuture(NestedItem("1")), CompletableFuture.supplyAsync { NestedItem("2") }) + + suspend fun nonNullItems(): List> = nullableItems() + + @Suppress("UNCHECKED_CAST") + suspend fun typeVariableStrings(): List = listOf("a", "b") as List +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappersExact.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappersExact.kt new file mode 100644 index 00000000..398f7acc --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappersExact.kt @@ -0,0 +1,85 @@ +package scenarios + +import graphql.GraphQLContext +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.Coercing +import graphql.schema.CoercingSerializeException +import graphql.schema.GraphQLScalarType +import org.apache.commons.lang3.reflect.TypeUtils +import java.time.OffsetDateTime +import java.util.Locale +import java.util.concurrent.CompletableFuture +import java.util.concurrent.CompletableFuture.completedFuture +import java.util.concurrent.Future +import java.util.concurrent.FutureTask + +/** + * Nested wrappers unwrapped exactly where the schema build matched them (issue 905): a custom scalar's futures and wrappers, a + * plain Future in a list (also from a wrapper's transformer and a suspend function), a wrapper only a schemaWrapper introduces, + * and a subclass registered as a wrapper of its own. + */ +object NestedWrappersExact : Scenario { + override val name = "nested-wrappers-exact" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/nested-wrappers-exact/schema.graphqls") + .resolvers(NestedWrappersExactQuery()) + .scalars(dateTime) + .options(SchemaParserOptions.newOptions().genericWrappers(tryWrapper, batchWrapper, boxWrapper, specialBoxWrapper, laterWrapper).build()) + + private val tryWrapper = SchemaParserOptions.GenericWrapper.withTransformer(Try::class, 0, { t -> t.get() }) + + private val batchWrapper = SchemaParserOptions.GenericWrapper.withTransformer(NestedWrappersExactBatch::class, 0, { batch -> batch.items }) { item -> + TypeUtils.parameterize(List::class.java, TypeUtils.parameterize(CompletableFuture::class.java, item)) + } + + private val boxWrapper = SchemaParserOptions.GenericWrapper.withTransformer(NestedWrappersExactBox::class, 0, { box -> box.content }) + + private val specialBoxWrapper = SchemaParserOptions.GenericWrapper.withTransformer( + NestedWrappersExactSpecialBox::class, 0, { _ -> throw IllegalStateException("unwrapped by the value's class") } + ) + + private val laterWrapper = SchemaParserOptions.GenericWrapper.withTransformer( + NestedWrappersExactLater::class, 0, { later -> FutureTask { later.value }.apply { run() } } + ) + + private val dateTime = GraphQLScalarType.newScalar() + .name("DateTime") + .coercing(object : Coercing { + override fun serialize(dataFetcherResult: Any, graphQLContext: GraphQLContext, locale: Locale): String = + (dataFetcherResult as? OffsetDateTime)?.toString() + ?: throw CoercingSerializeException("Expected an OffsetDateTime but got a ${dataFetcherResult.javaClass.name}") + }) + .build() +} + +class NestedWrappersExactBatch(val items: List>) + +open class NestedWrappersExactBox(val content: T) + +class NestedWrappersExactSpecialBox(content: T) : NestedWrappersExactBox(content) + +class NestedWrappersExactLater(val value: T) + +class NestedWrappersExactQuery : GraphQLQueryResolver { + private val first = OffsetDateTime.parse("2026-10-23T12:00Z") + private val second = OffsetDateTime.parse("2026-10-24T12:00Z") + + fun dates(): List> = listOf(completedFuture(first), CompletableFuture.supplyAsync { second }) + + fun triedDates(): List> = listOf(Try.Success(first), Try.Success(second)) + + fun plainFutureItems(): List> = listOf(FutureTask { NestedItem("f1") }.apply { run() }) + + fun batchedItems(): NestedWrappersExactBatch = + NestedWrappersExactBatch(listOf(completedFuture(NestedItem("b1")), CompletableFuture.supplyAsync { NestedItem("b2") })) + + fun boxedItems(): List> = + listOf(NestedWrappersExactBox(NestedItem("x1")), NestedWrappersExactSpecialBox(NestedItem("x2"))) + + fun laterItems(): List> = listOf(NestedWrappersExactLater(NestedItem("l1"))) + + suspend fun suspendPlainFutureItems(): List> = plainFutureItems() +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/OptionalResults.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/OptionalResults.kt new file mode 100644 index 00000000..6772d564 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/OptionalResults.kt @@ -0,0 +1,72 @@ +package scenarios + +import graphql.GraphQLError +import graphql.execution.DataFetcherResult +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import java.util.Optional + +/** + * A DataFetcherResult inside an Optional: its data, its errors, an empty Optional, the same object type returned another way, + * a list, and DataFetcherResult nested in itself under an Optional, which the build rejects like + * DataFetcherResult>. + */ +object OptionalResults : Scenario { + override val name = "optional-results" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/optional-results/schema.graphqls") + .resolvers(OptionalResultsQuery()) +} + +object OptionalResultsMixed : Scenario { + override val name = "optional-results-mixed" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/optional-results-mixed/schema.graphqls") + .resolvers(OptionalResultsMixedQuery()) +} + +object OptionalResultsList : Scenario { + override val name = "optional-results-list" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/optional-results-list/schema.graphqls") + .resolvers(OptionalResultsListQuery()) +} + +object OptionalResultsNested : Scenario { + override val name = "optional-results-nested" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/optional-results-nested/schema.graphqls") + .resolvers(OptionalResultsNestedQuery()) +} + +class OptionalResultsPayload(val data: String) + +private fun optionalResult(data: T, vararg errors: String): Optional> = Optional.of( + DataFetcherResult.newResult().data(data).errors(errors.map { GraphQLError.newError().message(it).build() }).build() +) + +class OptionalResultsQuery : GraphQLQueryResolver { + fun optionalResult(): Optional> = optionalResult(OptionalResultsPayload("a"), "partial") + fun optionalResultName(): Optional> = optionalResult("a") + fun emptyOptionalResult(): Optional> = Optional.empty() +} + +class OptionalResultsMixedQuery : GraphQLQueryResolver { + fun optionalResult(): Optional> = optionalResult(OptionalResultsPayload("a"), "partial") + fun resultOfOptional(): DataFetcherResult> = + DataFetcherResult.newResult>().data(Optional.of(OptionalResultsPayload("a"))).build() +} + +class OptionalResultsListQuery : GraphQLQueryResolver { + fun optionalResultList(): Optional>> = + optionalResult(listOf(OptionalResultsPayload("a"), OptionalResultsPayload("b"))) +} + +class OptionalResultsNestedQuery : GraphQLQueryResolver { + fun optionalResultOfResult(): Optional>> = + optionalResult(DataFetcherResult.newResult().data(OptionalResultsPayload("a")).build()) +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Options.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Options.kt new file mode 100644 index 00000000..6bb4ad3a --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Options.kt @@ -0,0 +1,27 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.resolver.MissingResolverDataFetcherProvider +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.DataFetcher + +/** A missing resolver provider standing in for a field nothing implements. */ +object Options : Scenario { + override val name = "options" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/options/schema.graphqls") + .resolvers(OptionsQuery()) + .options( + SchemaParserOptions.newOptions() + .missingResolverDataFetcherProvider(MissingResolverDataFetcherProvider { field, _ -> + DataFetcher { "no resolver for ${field.name}" } + }) + .build() + ) +} + +class OptionsQuery : GraphQLQueryResolver { + fun name() = "tools" +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Polymorphism.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Polymorphism.kt new file mode 100644 index 00000000..a97444b5 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Polymorphism.kt @@ -0,0 +1,37 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser + +/** + * Interface and union fields whose resolvers return a supertype, so the concrete classes are only known through the + * dictionary. `Writer` is backed by a class with a different name. + */ +object Polymorphism : Scenario { + override val name = "polymorphism" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/polymorphism/schema.graphqls") + .resolvers(PolymorphismQuery()) + .dictionary(Novel::class.java) + .dictionary("Writer", WriterEntity::class.java) +} + +interface Entity { + val id: String +} + +data class Novel(override val id: String, val title: String) : Entity + +data class WriterEntity(override val id: String, val name: String) : Entity + +private val entities: List = listOf(Novel("n1", "Solaris"), WriterEntity("w1", "Stanisław Lem")) + +class PolymorphismQuery : GraphQLQueryResolver { + fun node(id: String): Entity? = entities.find { it.id == id } + + fun search(term: String): List = entities.filter { + val text = if (it is Novel) it.title else (it as WriterEntity).name + text.contains(term, ignoreCase = true) + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ReadOnlySchema.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ReadOnlySchema.kt new file mode 100644 index 00000000..22212cfe --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ReadOnlySchema.kt @@ -0,0 +1,41 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLMutationResolver +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser + +/** + * Builds the schema with `parseSchemaObjects().toReadOnlySchema()` instead of `makeExecutableSchema()`, so the mutation + * type is left out. Covers an interface, a union, a custom field directive and a directive applied to the schema. + */ +object ReadOnlySchema : Scenario { + override val name = "read-only-schema" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/read-only-schema/schema.graphqls") + .resolvers(ReadOnlyQuery(), ReadOnlyMutation()) + .dictionary("Dog", ShelterDog::class.java) + .dictionary("Cat", ShelterCat::class.java) + + override fun schema(parser: SchemaParser) = parser.parseSchemaObjects().toReadOnlySchema() +} + +interface ShelterAnimal { + val name: String +} + +data class ShelterDog(override val name: String, val barks: Boolean) : ShelterAnimal + +data class ShelterCat(override val name: String, val lives: Int) : ShelterAnimal + +private val animals: List = listOf(ShelterDog("Rex", true), ShelterCat("Tom", 9)) + +class ReadOnlyQuery : GraphQLQueryResolver { + fun animal(name: String): ShelterAnimal? = animals.find { it.name == name } + + fun pets(): List = animals +} + +class ReadOnlyMutation : GraphQLMutationResolver { + fun adopt(name: String): ShelterAnimal = ShelterDog(name, false) +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/RecursiveInputs.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/RecursiveInputs.kt new file mode 100644 index 00000000..94d40fcc --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/RecursiveInputs.kt @@ -0,0 +1,28 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser + +/** Input objects that reference themselves and each other through lists and non-null types, and directive arguments of input object, enum and list types. */ +object RecursiveInputs : Scenario { + override val name = "recursive-inputs" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/recursive-inputs/schema.graphqls") + .resolvers(RecursiveInputsQuery()) + .dictionary(RangeInput::class, LimitUnit::class) +} + +data class RangeInput(val min: Int, val max: Int) + +enum class LimitUnit { ITEMS, PAGES } + +data class TreeFilter(val name: String?, val and: List?, val not: TreeFilter?, val child: ChildFilter?) + +data class ChildFilter(val parent: TreeFilter?, val siblings: List>?, val depth: Int) + +class RecursiveInputsQuery : GraphQLQueryResolver { + fun describe(filter: TreeFilter): String = filter.toString() + + fun names(first: Int?): List = listOf("a", "b", "c").take(first ?: 3) +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarArgs.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarArgs.kt new file mode 100644 index 00000000..c258d296 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarArgs.kt @@ -0,0 +1,100 @@ +package scenarios + +import com.fasterxml.jackson.annotation.JsonIdentityInfo +import com.fasterxml.jackson.annotation.JsonTypeInfo +import com.fasterxml.jackson.annotation.ObjectIdGenerators +import graphql.GraphQLContext +import graphql.execution.CoercedVariables +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.language.StringValue +import graphql.language.Value +import graphql.schema.Coercing +import graphql.schema.GraphQLScalarType +import java.util.Locale +import java.util.Optional + +/** + * Scalar arguments: a custom scalar Jackson can't build, a Kotlin scalar class without visible properties in an input object, + * the same written with a type id or an object id, ID converted to Long, and nested lists of strings. + */ +object ScalarArgs : Scenario { + override val name = "scalar-args" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/scalar-args/schema.graphqls") + .scalars(tagScalar, tokenScalar, typedTokenScalar, wrappedTokenScalar, idTokenScalar) + .resolvers(ScalarArgsQuery()) +} + +// no default constructor and no creator, so only the scalar's coercing can make one +class Tag private constructor(val value: String) { + companion object { + fun of(value: String) = Tag(value) + } +} + +private val tagScalar = GraphQLScalarType.newScalar() + .name("Tag") + .coercing(object : Coercing { + override fun serialize(dataFetcherResult: Any, context: GraphQLContext, locale: Locale) = (dataFetcherResult as Tag).value + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale) = Tag.of(input as String) + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, context: GraphQLContext, locale: Locale) = + Tag.of((input as StringValue).value.orEmpty()) + }) + .build() + +// Jackson writes it as {} and can read {} back as a new instance holding "default" +class ScalarArgsToken(private val value: String = "default") { + override fun toString() = value +} + +data class ScalarArgsTokenInput(val token: ScalarArgsToken? = null) + +@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY) +class ScalarArgsTypedToken(private val value: String = "default") { + override fun toString() = value +} + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) +class ScalarArgsWrappedToken(private val value: String = "default") { + override fun toString() = value +} + +@JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator::class) +class ScalarArgsIdToken(private val value: String = "default") { + override fun toString() = value +} + +data class ScalarArgsMarkedTokensInput( + val typed: ScalarArgsTypedToken? = null, + val wrapped: ScalarArgsWrappedToken? = null, + val ids: List? = null +) + +private val tokenScalar = stringScalar("Token") { ScalarArgsToken(it) } +private val typedTokenScalar = stringScalar("TypedToken") { ScalarArgsTypedToken(it) } +private val wrappedTokenScalar = stringScalar("WrappedToken") { ScalarArgsWrappedToken(it) } +private val idTokenScalar = stringScalar("IdToken") { ScalarArgsIdToken(it) } + +private fun stringScalar(name: String, parse: (String) -> T) = GraphQLScalarType.newScalar() + .name(name) + .coercing(object : Coercing { + override fun serialize(dataFetcherResult: Any, context: GraphQLContext, locale: Locale) = dataFetcherResult.toString() + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale) = parse(input as String) + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, context: GraphQLContext, locale: Locale) = + parse((input as StringValue).value.orEmpty()) + }) + .build() + +class ScalarArgsQuery : GraphQLQueryResolver { + fun tag(tag: Tag) = "tag ${tag.value}" + fun tags(tags: List) = "tags ${tags.map { it.value }}" + fun id(id: Long) = "id ${id + 1} (${id.javaClass.name})" + fun nestedSets(tags: List>) = "sets ${tags.map { it.sorted() }} sizes ${tags.map { it.size }}" + fun nestedLists(tags: List>) = "lists $tags" + fun tokenInput(input: ScalarArgsTokenInput) = "token ${input.token}" + fun markedTokens(input: ScalarArgsMarkedTokensInput) = "tokens ${input.typed} ${input.wrapped} ${input.ids}" + fun optionalTypedToken(token: Optional) = "typed ${token.orElse(null)}" + fun optionalIdToken(token: Optional) = "id ${token.orElse(null)}" +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarDirectives.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarDirectives.kt new file mode 100644 index 00000000..76501b7e --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarDirectives.kt @@ -0,0 +1,43 @@ +package scenarios + +import graphql.Scalars +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.schema.GraphQLScalarType +import graphql.schema.idl.SchemaDirectiveWiring +import graphql.schema.idl.SchemaDirectiveWiringEnvironment + +/** Directives and @specifiedBy on scalars from the SDL, on an extension and on the provided scalar, plus an undeclared one. */ +object ScalarDirectives : Scenario { + override val name = "scalar-directives" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/scalar-directives/schema.graphqls") + .resolvers(ScalarDirectivesQuery()) + .scalars( + string("Date"), + GraphQLScalarType.newScalar(string("DateTime")).description("An RFC-3339 date-time") + .specifiedByUrl("https://scalars.graphql.org/andimarek/date-time").build(), + string("Money") + ) + .directive("since", ArgumentWiring("date")) + .directive("unit", ArgumentWiring("name")) + + private fun string(name: String) = GraphQLScalarType.newScalar().name(name).coercing(Scalars.GraphQLString.coercing).build() +} + +/** Appends the directive and the value of [argument] that the wiring sees to the scalar's description. */ +class ArgumentWiring(private val argument: String) : SchemaDirectiveWiring { + override fun onScalar(environment: SchemaDirectiveWiringEnvironment): GraphQLScalarType { + val directive = environment.appliedDirective + val value = directive.getArgument(argument)?.getValue() + return environment.element.transform { it.description("${environment.element.description}, wired with @${directive.name}($value)") } + } +} + +class ScalarDirectivesQuery : GraphQLQueryResolver { + fun today(): String = "2026-10-19" + fun now(): String = "2026-10-19T12:00:00Z" + fun shift(from: String?): String? = from + fun price(): String = "9.99" +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Scenario.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Scenario.kt new file mode 100644 index 00000000..cfca8e40 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Scenario.kt @@ -0,0 +1,32 @@ +package scenarios + +import graphql.ExecutionInput +import graphql.GraphQL +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.schema.GraphQLSchema + +/** + * One way a user sets up graphql-java-tools: SDL and operations under `src/main/resources/scenarios//`, resolvers + * and options in an `object` in this package, which registers it. + */ +sealed interface Scenario { + val name: String + + /** The directory under `scenarios/` whose operations run against this scenario's schema. */ + val operations: String get() = name + + /** The configured builder. The probe calls `build()` on it and passes the result to [schema]. */ + fun parser(): SchemaParserBuilder + + fun schema(parser: SchemaParser): GraphQLSchema = parser.makeExecutableSchema() + + /** Extra evidence about the built schema, written to inspect.txt. */ + fun inspect(schema: GraphQLSchema): String? = null + + fun graphQL(builder: GraphQL.Builder): GraphQL.Builder = builder + + fun input(builder: ExecutionInput.Builder): ExecutionInput.Builder = builder +} + +val SCENARIOS: List = Scenario::class.sealedSubclasses.mapNotNull { it.objectInstance }.sortedBy { it.name } diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Sourceless.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Sourceless.kt new file mode 100644 index 00000000..1253d5c5 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Sourceless.kt @@ -0,0 +1,98 @@ +package scenarios + +import graphql.ExecutionInput +import graphql.GraphQLContext +import graphql.execution.DataFetcherResult +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.DataFetchingEnvironment + +/** Resolver methods that leave out the source object and take the environment or a context last (issue 304). */ +object Sourceless : Scenario { + override val name = "sourceless" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/sourceless/schema.graphqls") + .resolvers(SourcelessQuery(), SourcelessFolderResolver(), SourcelessImageResolver()) + .options(SchemaParserOptions.newOptions().contextClass(AppContext::class).build()) + + override fun input(builder: ExecutionInput.Builder): ExecutionInput.Builder = + builder.graphQLContext(mapOf(AppContext::class.java to AppContext("oryan", "en-CA"), "owner" to "ada")) +} + +/** A data class getter and a with-source method that share a name with a sourceless method. */ +object SourcelessShadowed : Scenario { + override val name = "sourceless-shadowed" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/sourceless-shadowed/schema.graphqls") + .resolvers(SourcelessQuery(), SourcelessFolderResolver(), ShadowedImageResolver()) +} + +/** A helper on the resolver that looks like a sourceless method for a field the app leaves unimplemented. */ +object SourcelessUnimplemented : Scenario { + override val name = "sourceless-unimplemented" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/sourceless-unimplemented/schema.graphqls") + .resolvers(SourcelessQuery(), SourcelessFolderResolver(), HelperImageResolver()) + .options(SchemaParserOptions.newOptions().allowUnimplementedResolvers(true).build()) +} + +/** Sourceless methods whose environment or context parameter would take the place of a schema argument. */ +object SourcelessMisbound : Scenario { + override val name = "sourceless-misbound" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/sourceless-misbound/schema.graphqls") + .resolvers(SourcelessQuery(), SourcelessFolderResolver(), MisboundImageResolver()) +} + +class SourcelessFolder(val supportedFileTypes: List) + +class SourcelessImage(val name: String) + +class SourcelessQuery : GraphQLQueryResolver { + fun folder() = SourcelessFolder(listOf("png", "jpg")) +} + +class SourcelessFolderResolver : GraphQLResolver { + fun images(folder: SourcelessFolder): DataFetcherResult> = DataFetcherResult.newResult>() + .data(listOf(SourcelessImage("cat"), SourcelessImage("dog"))) + .localContext(folder.supportedFileTypes) + .build() +} + +class SourcelessImageResolver : GraphQLResolver { + fun imageBlob(env: DataFetchingEnvironment) = "blob for ${env.getLocalContext>()}" + + fun thumbnail(size: Int, env: DataFetchingEnvironment) = "${env.getLocalContext>()?.first()}@$size" + + fun owner(context: GraphQLContext): String? = context.get("owner") + + fun locale(context: AppContext) = context.locale + + fun signature(context: AppContext, env: DataFetchingEnvironment) = "${env.field.name} by ${context.user}" + + suspend fun caption(env: DataFetchingEnvironment) = "caption of ${env.getSource()?.name}" +} + +class ShadowedImageResolver : GraphQLResolver { + fun getName(env: DataFetchingEnvironment) = "sourceless ${env.field.name}" + + fun title(image: SourcelessImage) = "with source ${image.name}" + + fun title(env: DataFetchingEnvironment) = "sourceless ${env.field.name}" +} + +class HelperImageResolver : GraphQLResolver { + fun imageBlob(image: SourcelessImage) = "blob of ${image.name}" + + fun preview(env: DataFetchingEnvironment) = "helper ${env.field.name}" +} + +class MisboundImageResolver : GraphQLResolver { + fun thumbnail(context: GraphQLContext, env: DataFetchingEnvironment) = "thumbnail ${env.field.name}" +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensions.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensions.kt new file mode 100644 index 00000000..cca70e20 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensions.kt @@ -0,0 +1,45 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser + +/** + * Extensions of every kind of type: fields, values, members, interfaces and directives merged into the type, repeats that + * keep the first one with a warning, extensions without a type, and an extension of a different kind than its type. + */ +object TypeExtensions : Scenario { + override val name = "type-extensions" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/type-extensions/schema.graphqls") + .resolvers(TypeExtensionsQuery()) + .dictionary(Article::class.java, Video::class.java) +} + +interface Node { + val id: String +} + +data class Article(override val id: String, val createdAt: String?, val name: String?, val title: String) : Node + +data class Video(override val id: String, val createdAt: String?, val name: String?, val seconds: Int) : Node + +enum class Color { RED, BLUE, GREEN } + +enum class Shade { LIGHT, DARK } + +data class Filter(val term: String?, val limit: Int?) + +private val nodes: List = listOf(Article("a1", "2026-10-01", "Launch", "We launched"), Video("v1", "2026-10-02", "Demo", 90)) + +class TypeExtensionsQuery : GraphQLQueryResolver { + fun node(id: String): Node? = nodes.find { it.id == id } + + fun search(): List = nodes + + fun colors(): List = Color.entries + + fun shades(): List = Shade.entries + + fun count(filter: Filter): Int = nodes.count { (it as? Article)?.title?.contains(filter.term.orEmpty()) ?: true }.coerceAtMost(filter.limit ?: Int.MAX_VALUE) +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsInputOrder.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsInputOrder.kt new file mode 100644 index 00000000..39657802 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsInputOrder.kt @@ -0,0 +1,23 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.schema.GraphQLInputObjectType +import graphql.schema.GraphQLSchema + +/** An input object whose extensions come before and after the type in the SDL. inspect.txt lists the fields in schema order. */ +object TypeExtensionsInputOrder : Scenario { + override val name = "type-extensions-input-order" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/type-extensions-input-order/schema.graphqls") + .resolvers(TypeExtensionsInputOrderQuery()) + + override fun inspect(schema: GraphQLSchema) = "Filter fields: ${(schema.getType("Filter") as GraphQLInputObjectType).fieldDefinitions.map { it.name }}" +} + +data class TypeExtensionsInputOrderFilter(val term: String?, val limit: Int?, val offset: Int?) + +class TypeExtensionsInputOrderQuery : GraphQLQueryResolver { + fun count(filter: TypeExtensionsInputOrderFilter?): Int = listOfNotNull(filter?.term, filter?.limit, filter?.offset).size +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsRepeatedFields.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsRepeatedFields.kt new file mode 100644 index 00000000..5537a7d4 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsRepeatedFields.kt @@ -0,0 +1,55 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.schema.GraphQLInputObjectType +import graphql.schema.GraphQLObjectType +import graphql.schema.GraphQLSchema + +/** + * Object and input types that declare a field twice, between a type and its extension, between two extensions and inside + * one definition. They build, and inspect.txt lists the description of the declaration the schema kept. + */ +object TypeExtensionsRepeatedFields : Scenario { + override val name = "type-extensions-repeated-fields" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/type-extensions-repeated-fields/schema.graphqls") + .resolvers(TypeExtensionsRepeatedFieldsQuery()) + + override fun inspect(schema: GraphQLSchema): String { + val objects = listOf("TypeAndExtension", "TwoExtensions", "OneDefinition").map { + "$it.name: ${(schema.getType(it) as GraphQLObjectType).getFieldDefinition("name").description}" + } + val inputs = listOf("InputTypeAndExtension", "InputTwoExtensions", "InputOneDefinition").map { + "$it.id: ${(schema.getType(it) as GraphQLInputObjectType).getField("id").description}" + } + return (objects + inputs).joinToString("\n") + } +} + +data class TypeExtensionsRepeatedFieldsTypeAndExtension(val name: String?) + +data class TypeExtensionsRepeatedFieldsTwoExtensions(val id: String?, val name: String?) + +data class TypeExtensionsRepeatedFieldsOneDefinition(val name: String?) + +data class TypeExtensionsRepeatedFieldsInputTypeAndExtension(val id: String?) + +data class TypeExtensionsRepeatedFieldsInputTwoExtensions(val term: String?, val id: String?) + +data class TypeExtensionsRepeatedFieldsInputOneDefinition(val id: String?) + +class TypeExtensionsRepeatedFieldsQuery : GraphQLQueryResolver { + fun typeAndExtension() = TypeExtensionsRepeatedFieldsTypeAndExtension("a") + + fun twoExtensions() = TypeExtensionsRepeatedFieldsTwoExtensions("b", "c") + + fun oneDefinition() = TypeExtensionsRepeatedFieldsOneDefinition("d") + + fun echo( + typeAndExtension: TypeExtensionsRepeatedFieldsInputTypeAndExtension?, + twoExtensions: TypeExtensionsRepeatedFieldsInputTwoExtensions?, + oneDefinition: TypeExtensionsRepeatedFieldsInputOneDefinition? + ): String = listOf(typeAndExtension?.id, twoExtensions?.term, twoExtensions?.id, oneDefinition?.id).joinToString(",") +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsSealed.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsSealed.kt new file mode 100644 index 00000000..917965ca --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsSealed.kt @@ -0,0 +1,36 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser + +/** + * A union member added by `extend union` and an interface implementor added by `extend type X implements Y`, with no + * dictionary. Their classes can only be found among the subclasses of the sealed class or interface the fields return. + */ +object TypeExtensionsSealed : Scenario { + override val name = "type-extensions-sealed" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/type-extensions-sealed/schema.graphqls") + .resolvers(TypeExtensionsSealedQuery()) +} + +sealed class Pet { + data class Dog(val name: String) : Pet() + + data class Cat(val lives: Int) : Pet() +} + +sealed interface Animal { + val name: String +} + +data class Cow(override val name: String) : Animal + +data class Horse(override val name: String) : Animal + +class TypeExtensionsSealedQuery : GraphQLQueryResolver { + fun pets(): List = listOf(Pet.Dog("Rex"), Pet.Cat(9)) + + fun animals(): List = listOf(Cow("Daisy"), Horse("Spirit")) +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/UnmappedInputs.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/UnmappedInputs.kt new file mode 100644 index 00000000..abc97b2c --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/UnmappedInputs.kt @@ -0,0 +1,38 @@ +package scenarios + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import java.util.Optional + +/** Input classes with an Optional property: one ignores a field on purpose, the other misspells one. */ +object UnmappedInputs : Scenario { + override val name = "unmapped-inputs" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/unmapped-inputs/schema.graphqls") + .resolvers(UnmappedInputsQuery()) +} + +class IgnoredInput { + @field:JsonIgnoreProperties("legacy") + var inner: Optional? = null +} + +class InnerInput { + var name: String? = null +} + +class TypoInput { + var item: Optional? = null +} + +class ItemInput { + var nmae: String? = null +} + +class UnmappedInputsQuery : GraphQLQueryResolver { + fun ignored(input: IgnoredInput): String? = input.inner?.get()?.name + + fun typo(input: TypoInput): String? = input.item?.get()?.nmae +} diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/WiringShapes.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/WiringShapes.kt new file mode 100644 index 00000000..5c68d32b --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/WiringShapes.kt @@ -0,0 +1,67 @@ +package scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.schema.* +import graphql.schema.idl.SchemaDirectiveWiring +import graphql.schema.idl.SchemaDirectiveWiringEnvironment + +/** Directive wirings on a recursive input (#875) and on types that refer to each other: interface, union, enum, self-reference. */ +object WiringShapes : Scenario { + override val name = "wiring-shapes" + + override fun parser() = SchemaParser.newParser() + .file("scenarios/wiring-shapes/schema.graphqls") + .resolvers(WiringShapesQuery()) + .directive("inspect", InspectWiring()) + .directive("required", RequiredWiring()) + .directive("described", DescribedWiring()) +} + +data class WiringTreeFilter(val name: String?, val children: List?) + +enum class State { ALIVE, GONE } + +class WiringPerson(val name: String) { + val friend: WiringPerson get() = this + val state: State get() = State.ALIVE + val someone: Any get() = this +} + +class WiringShapesQuery : GraphQLQueryResolver { + fun trees(filter: WiringTreeFilter?): Int = filter?.let { 1 + (it.children ?: emptyList()).sumOf { child -> trees(child) } } ?: 0 + + fun person() = WiringPerson("ada") + + fun someone(): Any = WiringPerson("grace") +} + +// records the type the wiring sees in the field's description +class InspectWiring : SchemaDirectiveWiring { + override fun onInputObjectField(environment: SchemaDirectiveWiringEnvironment): GraphQLInputObjectField { + val type = GraphQLTypeUtil.unwrapAllAs(environment.element.type) + return environment.element.transform { it.description("sees ${type.javaClass.simpleName} ${type.name}") } + } +} + +class RequiredWiring : SchemaDirectiveWiring { + override fun onField(environment: SchemaDirectiveWiringEnvironment): GraphQLFieldDefinition = + environment.element.transform { it.type(GraphQLNonNull.nonNull(environment.element.type)) } +} + +class DescribedWiring : SchemaDirectiveWiring { + override fun onObject(environment: SchemaDirectiveWiringEnvironment): GraphQLObjectType = + environment.element.transform { it.description("described") } + + override fun onInterface(environment: SchemaDirectiveWiringEnvironment): GraphQLInterfaceType = + environment.element.transform { it.description("described") } + + override fun onUnion(environment: SchemaDirectiveWiringEnvironment): GraphQLUnionType = + environment.element.transform { it.description("described") } + + override fun onEnum(environment: SchemaDirectiveWiringEnvironment): GraphQLEnumType = + environment.element.transform { it.description("described") } + + override fun onInputObjectType(environment: SchemaDirectiveWiringEnvironment): GraphQLInputObjectType = + environment.element.transform { it.description("described") } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/logback.xml b/.claude/skills/verify-tools/probe/src/main/resources/logback.xml new file mode 100644 index 00000000..d8728fbf --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/logback.xml @@ -0,0 +1,21 @@ + + + ${probe.out}/probe.log + false + + %-5level %logger{36} - %msg%n + + + + System.err + + %-5level %logger{36} - %msg%n + + + + + + + + + diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/async/01-query.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/async/01-query.graphql new file mode 100644 index 00000000..f6145c99 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/async/01-query.graphql @@ -0,0 +1,5 @@ +query Async { + future + suspended + shipments { id status } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/async/02-subscription.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/async/02-subscription.graphql new file mode 100644 index 00000000..8be1c798 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/async/02-subscription.graphql @@ -0,0 +1,3 @@ +subscription Ticks { + ticks(count: 3) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/async/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/async/schema.graphqls new file mode 100644 index 00000000..40f853fe --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/async/schema.graphqls @@ -0,0 +1,14 @@ +type Query { + future: String! + suspended: String! + shipments: [Shipment!]! +} + +type Shipment { + id: ID! + status: String! +} + +type Subscription { + ticks(count: Int!): Int! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore-missing-resolver/extension.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore-missing-resolver/extension.graphqls new file mode 100644 index 00000000..ed31d413 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore-missing-resolver/extension.graphqls @@ -0,0 +1,3 @@ +extend type Book { + isbn: String! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/01-books.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/01-books.graphql new file mode 100644 index 00000000..253c349c --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/01-books.graphql @@ -0,0 +1,9 @@ +query Books { + books { + id + title + published + inStock + author { name } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/02-book-by-id.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/02-book-by-id.graphql new file mode 100644 index 00000000..e7f97751 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/02-book-by-id.graphql @@ -0,0 +1,7 @@ +query BookById($id: ID!) { + book(id: $id) { + title + author { id name } + } + missing: book(id: "nope") { title } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/02-book-by-id.variables.json b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/02-book-by-id.variables.json new file mode 100644 index 00000000..775ead7c --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/02-book-by-id.variables.json @@ -0,0 +1 @@ +{ "id": "b3" } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/schema.graphqls new file mode 100644 index 00000000..8e8fb418 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/bookstore/schema.graphqls @@ -0,0 +1,24 @@ +scalar Date + +type Query { + books: [Book!]! + book(id: ID!): Book +} + +type Book { + id: ID! + title: String! + author: Author! + published: Date! + inStock: Boolean! +} + +type Author { + id: ID! + name: String! +} + +# Reachable from no root type: graphql-java-tools logs a warning and leaves it out of the schema +type Review { + stars: Int! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-and-environment/01-query.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-and-environment/01-query.graphql new file mode 100644 index 00000000..860160ad --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-and-environment/01-query.graphql @@ -0,0 +1,7 @@ +query { + greeting(name: "ada") + farewell(name: "ada") + user { name locale } + environmentOnly + contextOnly +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-and-environment/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-and-environment/schema.graphqls new file mode 100644 index 00000000..e3779905 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-and-environment/schema.graphqls @@ -0,0 +1,12 @@ +type Query { + greeting(name: String!): String! + farewell(name: String!): String! + user: User! + environmentOnly: String! + contextOnly: String! +} + +type User { + name: String! + locale: String! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/01-without-argument.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/01-without-argument.graphql new file mode 100644 index 00000000..f9f1e4e3 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/01-without-argument.graphql @@ -0,0 +1,3 @@ +query { + users { name } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/02-with-argument.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/02-with-argument.graphql new file mode 100644 index 00000000..1f60d526 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/02-with-argument.graphql @@ -0,0 +1,3 @@ +query { + users(first: 1) { name } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/03-context-and-correct.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/03-context-and-correct.graphql new file mode 100644 index 00000000..e0a1a5a0 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/03-context-and-correct.graphql @@ -0,0 +1,4 @@ +query { + contextArgument(name: "ada") + greeting(name: "ada") +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/04-type-resolver.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/04-type-resolver.graphql new file mode 100644 index 00000000..70171552 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/04-type-resolver.graphql @@ -0,0 +1,3 @@ +query { + user { name thumbnail(size: 64) } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/schema.graphqls new file mode 100644 index 00000000..d8385510 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/context-misbound/schema.graphqls @@ -0,0 +1,11 @@ +type Query { + users(first: Int): [User!]! + user: User! + contextArgument(name: String): String + greeting(name: String!): String! +} + +type User { + name: String! + thumbnail(size: Int): String +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directive-drift-undeclared/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directive-drift-undeclared/schema.graphqls new file mode 100644 index 00000000..a00d59f1 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directive-drift-undeclared/schema.graphqls @@ -0,0 +1,3 @@ +type Query { + a: String @undeclared(s: "x") +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directive-drift/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directive-drift/schema.graphqls new file mode 100644 index 00000000..85f2f1e5 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directive-drift/schema.graphqls @@ -0,0 +1,79 @@ +schema @tag(name: "schema") @link(url: "https://example.com/v1") @link(url: "https://example.com/v2") { + query: Query +} + +"Tags a node" +directive @tag( + "The tag's name" + name: String! + "How loud" + level: Int = 1 + kind: Kind = PLAIN + meta: Meta +) repeatable on OBJECT | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | FIELD_DEFINITION | ARGUMENT_DEFINITION | SCALAR | SCHEMA + +"Marks a node once" +directive @once( + "Why" + reason: String = "because" +) on OBJECT | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | FIELD_DEFINITION | ARGUMENT_DEFINITION | SCALAR + +directive @link(url: String!) repeatable on SCHEMA + +directive @argDoc(note: String @once @tag(name: "on a directive argument")) on FIELD_DEFINITION + +directive @fieldOnly on FIELD_DEFINITION + +directive @needs(value: String!) on FIELD_DEFINITION + +enum Kind { PLAIN LOUD } + +type Query @tag(name: "query") @once @once { + plain: String + # described by a comment + @tag(name: "plain", level: 2) + @once(reason: "supplied") + @fieldOnly + @argDoc(note: "x") + wrongPlace(arg: String @fieldOnly): String + missing: String @needs + old: String @deprecated + older: String @deprecated(reason: "use plain") + search( + filter: Meta @tag(name: "arg", kind: LOUD, meta: {owner: "me"}) + term: String @once @once + ): String @undeclared(s: "x", i: 1, f: 1.5, b: true, n: null, l: [1, 2], e: []) @undeclared(s: "again") @tag(name: "a") @tag(name: "b") + animal: Animal + pet: Pet + color: Color + when: Date + price: Money +} + +extend type Query @once(reason: "extension") @tag(name: "extension") @undeclared + +interface Animal @tag(name: "animal") @once { + name: String @once @once +} + +type Dog implements Animal { + name: String +} + +union Pet @tag(name: "pet") @once @once = Dog + +enum Color @once { + RED @tag(name: "red") @once @once + GREEN @deprecated + BLUE @deprecated(reason: "too blue") @undeclared(why: "blue") +} + +input Meta @tag(name: "input") @once { + owner: String @once(reason: "x") @once +} + +"A date" +scalar Date @tag(name: "date") @specifiedBy(url: "https://example.com/date") @once +extend scalar Date @once(reason: "extension") @tag(name: "extension") + +scalar Money @tag(nam: "typo") diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives-invalid/01-query.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives-invalid/01-query.graphql new file mode 100644 index 00000000..ecd6b647 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives-invalid/01-query.graphql @@ -0,0 +1,8 @@ +query Invalid { + motto + secret + members { + id + name + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives-invalid/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives-invalid/schema.graphqls new file mode 100644 index 00000000..b2e14ab7 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives-invalid/schema.graphqls @@ -0,0 +1,20 @@ +directive @uppercase on OBJECT +directive @auth(role: String!, scope: String = "all") on FIELD_DEFINITION +directive @cached(ttl: Int) on FIELD_DEFINITION | SCHEMA + +schema @cached(ttl: 60) { + query: Query +} + +extend schema @cached(ttl: 30) + +type Query { + motto: String! @uppercase + secret: String @auth + members: [Member!] @cached @cached(ttl: 10) +} + +type Member @deprecated { + id: ID! + name: String! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/01-uppercase.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/01-uppercase.graphql new file mode 100644 index 00000000..80daec1f --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/01-uppercase.graphql @@ -0,0 +1,4 @@ +query Uppercase { + motto + oldMotto +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/02-deprecated.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/02-deprecated.graphql new file mode 100644 index 00000000..43fd27bd --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/02-deprecated.graphql @@ -0,0 +1,9 @@ +query Deprecated { + __type(name: "Query") { + fields(includeDeprecated: true) { + name + isDeprecated + deprecationReason + } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/03-connection.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/03-connection.graphql new file mode 100644 index 00000000..23d8dba2 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/03-connection.graphql @@ -0,0 +1,14 @@ +query Members { + members(first: 2) { + edges { + cursor + node { id name } + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/schema.graphqls new file mode 100644 index 00000000..37ef47d2 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/directives/schema.graphqls @@ -0,0 +1,13 @@ +directive @uppercase on FIELD_DEFINITION +directive @connection(for: String!) on FIELD_DEFINITION + +type Query { + motto: String! @uppercase + oldMotto: String! @deprecated(reason: "Use motto") + members(first: Int, after: String): MemberConnection @connection(for: "Member") +} + +type Member { + id: ID! + name: String! @uppercase +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/01-plain.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/01-plain.graphql new file mode 100644 index 00000000..ee5eb8eb --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/01-plain.graphql @@ -0,0 +1 @@ +{ plain(input: { name: "a" }) } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/02-generic.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/02-generic.graphql new file mode 100644 index 00000000..61415273 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/02-generic.graphql @@ -0,0 +1 @@ +{ generic(input: { name: "a" }) } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/schema.graphqls new file mode 100644 index 00000000..13da2912 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/generic-input-resolver/schema.graphqls @@ -0,0 +1,8 @@ +type Query { + generic(input: GreetingInput!): String! + plain(input: GreetingInput!): String! +} + +input GreetingInput { + name: String! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/01-search.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/01-search.graphql new file mode 100644 index 00000000..5ec6030a --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/01-search.graphql @@ -0,0 +1,4 @@ +query Search { + defaults: search(term: "dune") + explicit: search(term: "dune", limit: 2, genres: [SCIENCE, HISTORY]) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/02-nickname.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/02-nickname.graphql new file mode 100644 index 00000000..54851ae0 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/02-nickname.graphql @@ -0,0 +1,5 @@ +query Nickname { + omitted: nickname + explicitNull: nickname(value: null) + given: nickname(value: "Bilbo") +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/03-add-book.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/03-add-book.graphql new file mode 100644 index 00000000..e4cbfcb0 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/03-add-book.graphql @@ -0,0 +1,14 @@ +mutation AddBook($input: BookInput!) { + addBook(input: $input) { + title + genre + tags + pages + language + } + defaults: addBook(input: { title: "Untitled" }) { + genre + tags + pages + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/03-add-book.variables.json b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/03-add-book.variables.json new file mode 100644 index 00000000..ff1ebf8c --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/03-add-book.variables.json @@ -0,0 +1 @@ +{ "input": { "title": "Cosmos", "genre": "SCIENCE", "tags": ["space", "classic"], "details": { "pages": 396 } } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/04-invalid-enum.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/04-invalid-enum.graphql new file mode 100644 index 00000000..e6e7fe8f --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/04-invalid-enum.graphql @@ -0,0 +1,3 @@ +query InvalidEnum { + search(term: "x", genres: [POETRY]) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/schema.graphqls new file mode 100644 index 00000000..d987dd68 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/inputs/schema.graphqls @@ -0,0 +1,34 @@ +type Query { + search(term: String!, limit: Int = 10, genres: [Genre!]): String! + nickname(value: String): String! +} + +type Mutation { + addBook(input: BookInput!): SavedBook! +} + +enum Genre { + FICTION + SCIENCE + HISTORY +} + +input BookInput { + title: String! + genre: Genre = FICTION + tags: [String!] + details: DetailsInput +} + +input DetailsInput { + pages: Int! + language: String = "en" +} + +type SavedBook { + title: String! + genre: Genre! + tags: [String!]! + pages: Int + language: String +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/jdk-proxy/01-query.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/jdk-proxy/01-query.graphql new file mode 100644 index 00000000..190fbb0f --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/jdk-proxy/01-query.graphql @@ -0,0 +1 @@ +{ test count total } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/jdk-proxy/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/jdk-proxy/schema.graphqls new file mode 100644 index 00000000..2c6feced --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/jdk-proxy/schema.graphqls @@ -0,0 +1,5 @@ +type Query { + test: String + count: Int + total: Int +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-unions/01-results.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-unions/01-results.graphql new file mode 100644 index 00000000..1dbe8f8f --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-unions/01-results.graphql @@ -0,0 +1,9 @@ +query Results { + results { + __typename + ... on Book { title } + ... on Media { + ... on Movie { title } + } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-unions/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-unions/schema.graphqls new file mode 100644 index 00000000..7c040dac --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-unions/schema.graphqls @@ -0,0 +1,15 @@ +type Query { + results: [Result!]! +} + +union Result = Book | Media + +union Media = Movie + +type Book { + title: String! +} + +type Movie { + title: String! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/01-dates.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/01-dates.graphql new file mode 100644 index 00000000..7edc9dc0 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/01-dates.graphql @@ -0,0 +1 @@ +{ dates } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/02-tried-dates.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/02-tried-dates.graphql new file mode 100644 index 00000000..be584969 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/02-tried-dates.graphql @@ -0,0 +1 @@ +{ triedDates } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/03-plain-future-items.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/03-plain-future-items.graphql new file mode 100644 index 00000000..ca6d7a1a --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/03-plain-future-items.graphql @@ -0,0 +1 @@ +{ plainFutureItems { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/04-batched-items.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/04-batched-items.graphql new file mode 100644 index 00000000..2156bae0 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/04-batched-items.graphql @@ -0,0 +1 @@ +{ batchedItems { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/05-boxed-items.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/05-boxed-items.graphql new file mode 100644 index 00000000..08db2ed0 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/05-boxed-items.graphql @@ -0,0 +1 @@ +{ boxedItems { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/06-later-items.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/06-later-items.graphql new file mode 100644 index 00000000..aacfda86 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/06-later-items.graphql @@ -0,0 +1 @@ +{ laterItems { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/07-suspend-plain-future-items.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/07-suspend-plain-future-items.graphql new file mode 100644 index 00000000..0dbbf8cc --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/07-suspend-plain-future-items.graphql @@ -0,0 +1 @@ +{ suspendPlainFutureItems { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/schema.graphqls new file mode 100644 index 00000000..dd5ac5ce --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-exact/schema.graphqls @@ -0,0 +1,15 @@ +scalar DateTime + +type Query { + dates: [DateTime] + triedDates: [DateTime!]! + plainFutureItems: [Item] + batchedItems: [Item!]! + boxedItems: [Item!]! + laterItems: [Item] + suspendPlainFutureItems: [Item] +} + +type Item { + id: ID! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/01-nullable-items.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/01-nullable-items.graphql new file mode 100644 index 00000000..25e05572 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/01-nullable-items.graphql @@ -0,0 +1 @@ +{ nullableItems { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/02-non-null-items.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/02-non-null-items.graphql new file mode 100644 index 00000000..d8a89355 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/02-non-null-items.graphql @@ -0,0 +1 @@ +{ nonNullItems { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/03-type-variable-strings.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/03-type-variable-strings.graphql new file mode 100644 index 00000000..9e894423 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/03-type-variable-strings.graphql @@ -0,0 +1 @@ +{ typeVariableStrings } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/schema.graphqls new file mode 100644 index 00000000..b1575798 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers-suspend/schema.graphqls @@ -0,0 +1,9 @@ +type Query { + nullableItems: [Item] + nonNullItems: [Item!]! + typeVariableStrings: [String] +} + +type Item { + id: ID! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/01-payload.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/01-payload.graphql new file mode 100644 index 00000000..3ed5ffc1 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/01-payload.graphql @@ -0,0 +1 @@ +{ payload { data } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/02-payloads.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/02-payloads.graphql new file mode 100644 index 00000000..84d0bc6b --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/02-payloads.graphql @@ -0,0 +1 @@ +{ payloads { data } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/03-payload-strings.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/03-payload-strings.graphql new file mode 100644 index 00000000..3568fe8b --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/03-payload-strings.graphql @@ -0,0 +1 @@ +{ payloadStrings } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/04-items.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/04-items.graphql new file mode 100644 index 00000000..3c1faaf8 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/04-items.graphql @@ -0,0 +1 @@ +{ items { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/05-item-names.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/05-item-names.graphql new file mode 100644 index 00000000..44577a66 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/05-item-names.graphql @@ -0,0 +1 @@ +{ itemNames } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/06-future-of-future.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/06-future-of-future.graphql new file mode 100644 index 00000000..b362257c --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/06-future-of-future.graphql @@ -0,0 +1 @@ +{ futureOfFuture { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/07-future-of-tries.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/07-future-of-tries.graphql new file mode 100644 index 00000000..0bcafb9c --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/07-future-of-tries.graphql @@ -0,0 +1 @@ +{ futureOfTries { data } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/08-tries-of-futures.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/08-tries-of-futures.graphql new file mode 100644 index 00000000..590b87ab --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/08-tries-of-futures.graphql @@ -0,0 +1 @@ +{ triesOfFutures { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/09-loaded-items.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/09-loaded-items.graphql new file mode 100644 index 00000000..59304ac9 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/09-loaded-items.graphql @@ -0,0 +1 @@ +{ loadedItems { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/10-failed-try-in-list.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/10-failed-try-in-list.graphql new file mode 100644 index 00000000..ff1774ab --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/10-failed-try-in-list.graphql @@ -0,0 +1 @@ +{ failedTryInList { data } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/11-failed-future-in-list.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/11-failed-future-in-list.graphql new file mode 100644 index 00000000..14db363f --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/11-failed-future-in-list.graphql @@ -0,0 +1 @@ +{ failedFutureInList { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/12-controls.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/12-controls.graphql new file mode 100644 index 00000000..e79a12bf --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/12-controls.graphql @@ -0,0 +1 @@ +{ plainItems { id } futureOfItems { id } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/schema.graphqls new file mode 100644 index 00000000..1798ee6e --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/nested-wrappers/schema.graphqls @@ -0,0 +1,23 @@ +type Query { + payload: Payload! + payloads: [Payload!]! + payloadStrings: [String!]! + items: [Item] + itemNames: [String] + futureOfFuture: Item + futureOfTries: [Payload!]! + triesOfFutures: [Item!]! + loadedItems: [Item!]! + failedTryInList: [Payload!] + failedFutureInList: [Item] + plainItems: [Item!]! + futureOfItems: [Item!]! +} + +type Payload { + data: String! +} + +type Item { + id: ID! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-list/01-optional-result-list.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-list/01-optional-result-list.graphql new file mode 100644 index 00000000..1664acf9 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-list/01-optional-result-list.graphql @@ -0,0 +1 @@ +{ optionalResultList { data } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-list/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-list/schema.graphqls new file mode 100644 index 00000000..4d83858a --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-list/schema.graphqls @@ -0,0 +1,7 @@ +type Query { + optionalResultList: [Payload] +} + +type Payload { + data: String +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/01-optional-result.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/01-optional-result.graphql new file mode 100644 index 00000000..c10e6989 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/01-optional-result.graphql @@ -0,0 +1 @@ +{ optionalResult { data } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/02-result-of-optional.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/02-result-of-optional.graphql new file mode 100644 index 00000000..d441ca28 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/02-result-of-optional.graphql @@ -0,0 +1 @@ +{ resultOfOptional { data } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/schema.graphqls new file mode 100644 index 00000000..e3d6776d --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-mixed/schema.graphqls @@ -0,0 +1,8 @@ +type Query { + optionalResult: Payload + resultOfOptional: Payload +} + +type Payload { + data: String +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-nested/01-optional-result-of-result.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-nested/01-optional-result-of-result.graphql new file mode 100644 index 00000000..4faaec18 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-nested/01-optional-result-of-result.graphql @@ -0,0 +1 @@ +{ optionalResultOfResult { data } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-nested/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-nested/schema.graphqls new file mode 100644 index 00000000..fdcfe753 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results-nested/schema.graphqls @@ -0,0 +1,7 @@ +type Query { + optionalResultOfResult: Payload +} + +type Payload { + data: String +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/01-optional-result.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/01-optional-result.graphql new file mode 100644 index 00000000..c10e6989 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/01-optional-result.graphql @@ -0,0 +1 @@ +{ optionalResult { data } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/02-optional-result-name.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/02-optional-result-name.graphql new file mode 100644 index 00000000..82e4e071 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/02-optional-result-name.graphql @@ -0,0 +1 @@ +{ optionalResultName } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/03-empty-optional-result.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/03-empty-optional-result.graphql new file mode 100644 index 00000000..60fd0542 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/03-empty-optional-result.graphql @@ -0,0 +1 @@ +{ emptyOptionalResult { data } } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/schema.graphqls new file mode 100644 index 00000000..e3f18278 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/optional-results/schema.graphqls @@ -0,0 +1,9 @@ +type Query { + optionalResult: Payload + optionalResultName: String + emptyOptionalResult: Payload +} + +type Payload { + data: String +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/01-fields.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/01-fields.graphql new file mode 100644 index 00000000..49a76a4b --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/01-fields.graphql @@ -0,0 +1,5 @@ +query Fields { + name + unimplemented + __typename +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/02-schema-introspection.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/02-schema-introspection.graphql new file mode 100644 index 00000000..c194bf8f --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/02-schema-introspection.graphql @@ -0,0 +1,3 @@ +query SchemaIntrospection { + __schema { queryType { name } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/03-type-introspection.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/03-type-introspection.graphql new file mode 100644 index 00000000..e4089f34 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/03-type-introspection.graphql @@ -0,0 +1,3 @@ +query TypeIntrospection { + __type(name: "Query") { name } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/schema.graphqls new file mode 100644 index 00000000..4940232b --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/options/schema.graphqls @@ -0,0 +1,4 @@ +type Query { + name: String! + unimplemented: String! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/01-node.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/01-node.graphql new file mode 100644 index 00000000..8e7ddae2 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/01-node.graphql @@ -0,0 +1,11 @@ +query Nodes { + novel: node(id: "n1") { + __typename + id + ... on Novel { title } + } + writer: node(id: "w1") { + __typename + ... on Writer { name } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/02-union.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/02-union.graphql new file mode 100644 index 00000000..28426ae5 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/02-union.graphql @@ -0,0 +1,7 @@ +query Search { + search(term: "s") { + __typename + ... on Novel { title } + ... on Writer { name } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/schema.graphqls new file mode 100644 index 00000000..64920e7a --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/polymorphism/schema.graphqls @@ -0,0 +1,20 @@ +type Query { + node(id: ID!): Node + search(term: String!): [SearchResult!]! +} + +interface Node { + id: ID! +} + +type Novel implements Node { + id: ID! + title: String! +} + +type Writer implements Node { + id: ID! + name: String! +} + +union SearchResult = Novel | Writer diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/01-interface.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/01-interface.graphql new file mode 100644 index 00000000..b7680fb9 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/01-interface.graphql @@ -0,0 +1,3 @@ +{ + animal(name: "Tom") { __typename name ... on Cat { lives } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/02-union.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/02-union.graphql new file mode 100644 index 00000000..4b85d0a7 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/02-union.graphql @@ -0,0 +1,3 @@ +{ + pets { __typename ... on Dog { name barks } ... on Cat { name lives } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/03-no-mutation.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/03-no-mutation.graphql new file mode 100644 index 00000000..de47fce6 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/03-no-mutation.graphql @@ -0,0 +1,3 @@ +{ + __schema { mutationType { name } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/schema.graphqls new file mode 100644 index 00000000..55e0dca1 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/read-only-schema/schema.graphqls @@ -0,0 +1,29 @@ +directive @tag(name: String!) on FIELD_DEFINITION +directive @contact(name: String!) on SCHEMA + +extend schema @contact(name: "pets-team") + +type Query { + animal(name: String!): Animal + pets: [Pet!]! +} + +type Mutation { + adopt(name: String!): Animal! +} + +interface Animal { + name: String! @tag(name: "public") +} + +type Dog implements Animal { + name: String! @tag(name: "public") + barks: Boolean! +} + +type Cat implements Animal { + name: String! @tag(name: "public") + lives: Int! +} + +union Pet = Dog | Cat diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/01-describe.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/01-describe.graphql new file mode 100644 index 00000000..c38a92ed --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/01-describe.graphql @@ -0,0 +1,5 @@ +query Describe($filter: TreeFilter!) { + describe(filter: $filter) + literal: describe(filter: { name: "x", child: { depth: 1, siblings: [[{ depth: 2 }]] } }) + names(first: 2) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/01-describe.variables.json b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/01-describe.variables.json new file mode 100644 index 00000000..91519580 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/01-describe.variables.json @@ -0,0 +1 @@ +{"filter": {"name": "root", "and": [{"name": "a"}, {"not": {"name": "b"}}], "child": {"depth": 3, "parent": {"name": "up"}, "siblings": [[{"depth": 4}], []]}}} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/02-introspect.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/02-introspect.graphql new file mode 100644 index 00000000..7efc5c33 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/02-introspect.graphql @@ -0,0 +1,6 @@ +query Introspect { + __schema { + directives { name args { name defaultValue type { kind name ofType { kind name ofType { kind name } } } } } + types { name inputFields { name type { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } } } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/schema.graphqls new file mode 100644 index 00000000..7f300298 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/recursive-inputs/schema.graphqls @@ -0,0 +1,29 @@ +directive @limit(range: RangeInput!, unit: LimitUnit = ITEMS, labels: [String!]) on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION + +enum LimitUnit { + ITEMS + PAGES +} + +input RangeInput { + min: Int! + max: Int! +} + +type Query { + describe(filter: TreeFilter!): String! @limit(range: {min: 0, max: 5}, labels: ["a", "b"]) + names(first: Int @limit(range: {min: 1, max: 10}, unit: PAGES)): [String!]! +} + +input TreeFilter { + name: String + and: [TreeFilter!] + not: TreeFilter + child: ChildFilter +} + +input ChildFilter { + parent: TreeFilter + siblings: [[ChildFilter!]!] + depth: Int! @limit(range: {min: 1, max: 3}) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/01-custom-scalar.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/01-custom-scalar.graphql new file mode 100644 index 00000000..96f15786 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/01-custom-scalar.graphql @@ -0,0 +1 @@ +{ tag(tag: "kotlin") tags(tags: ["a", "b"]) } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/02-id.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/02-id.graphql new file mode 100644 index 00000000..a6cd5e09 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/02-id.graphql @@ -0,0 +1 @@ +{ id(id: "42") } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/03-nested-sets.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/03-nested-sets.graphql new file mode 100644 index 00000000..2f6288dd --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/03-nested-sets.graphql @@ -0,0 +1 @@ +{ nestedSets(tags: [["a", "a", "b"], ["c"]]) } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/04-nested-lists.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/04-nested-lists.graphql new file mode 100644 index 00000000..c51981e1 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/04-nested-lists.graphql @@ -0,0 +1 @@ +{ nestedLists(tags: [["a", "a", "b"], ["c"]]) } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/05-empty-kotlin-scalar.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/05-empty-kotlin-scalar.graphql new file mode 100644 index 00000000..8f06720a --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/05-empty-kotlin-scalar.graphql @@ -0,0 +1 @@ +{ tokenInput(input: { token: "input" }) } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/06-marked-empty-kotlin-scalars.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/06-marked-empty-kotlin-scalars.graphql new file mode 100644 index 00000000..641761cd --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/06-marked-empty-kotlin-scalars.graphql @@ -0,0 +1 @@ +{ markedTokens(input: { typed: "typed", wrapped: "wrapped", ids: ["first", "second"] }) } diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/07-optional-marked-empty-kotlin-scalars.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/07-optional-marked-empty-kotlin-scalars.graphql new file mode 100644 index 00000000..494654aa --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/07-optional-marked-empty-kotlin-scalars.graphql @@ -0,0 +1,4 @@ +{ + optionalTypedToken(token: "optional") + optionalIdToken(token: "optional") +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/schema.graphqls new file mode 100644 index 00000000..8f527f56 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-args/schema.graphqls @@ -0,0 +1,27 @@ +scalar Tag +scalar Token +scalar TypedToken +scalar WrappedToken +scalar IdToken + +type Query { + tag(tag: Tag!): String! + tags(tags: [Tag!]!): String! + id(id: ID!): String! + nestedSets(tags: [[String!]!]!): String! + nestedLists(tags: [[String!]!]!): String! + tokenInput(input: TokenInput!): String! + markedTokens(input: MarkedTokensInput!): String! + optionalTypedToken(token: TypedToken): String! + optionalIdToken(token: IdToken): String! +} + +input TokenInput { + token: Token +} + +input MarkedTokensInput { + typed: TypedToken + wrapped: WrappedToken + ids: [IdToken!] +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/01-introspect-scalars.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/01-introspect-scalars.graphql new file mode 100644 index 00000000..77098e98 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/01-introspect-scalars.graphql @@ -0,0 +1,3 @@ +query { + __schema { types { name kind description specifiedByURL } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/02-use-scalars.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/02-use-scalars.graphql new file mode 100644 index 00000000..e0f4fdc3 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/02-use-scalars.graphql @@ -0,0 +1,6 @@ +query { + today + now + shift(from: "2020-01-01") + price +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/schema.graphqls new file mode 100644 index 00000000..48bba21e --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/scalar-directives/schema.graphqls @@ -0,0 +1,17 @@ +directive @since(date: Date) on SCALAR | FIELD_DEFINITION +directive @unit(name: String!) on SCALAR + +"A calendar date" +scalar Date @specifiedBy(url: "https://example.com/date") +extend scalar Date @since(date: "2020-01-01") @unit(name: "day") + +scalar DateTime + +scalar Money @currency(code: "USD") + +type Query { + today: Date @since(date: "2021-01-01") + now: DateTime + shift(from: Date): Date + price: Money +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-misbound/01-thumbnail.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-misbound/01-thumbnail.graphql new file mode 100644 index 00000000..70583e56 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-misbound/01-thumbnail.graphql @@ -0,0 +1,3 @@ +query { + folder { images { name thumbnail(size: 64) } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-misbound/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-misbound/schema.graphqls new file mode 100644 index 00000000..82fdf346 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-misbound/schema.graphqls @@ -0,0 +1,12 @@ +type Query { + folder: Folder! +} + +type Folder { + images: [Image!]! +} + +type Image { + name: String! + thumbnail(size: Int): String +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-shadowed/01-shadowed.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-shadowed/01-shadowed.graphql new file mode 100644 index 00000000..50b50a22 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-shadowed/01-shadowed.graphql @@ -0,0 +1,3 @@ +query { + folder { images { name title } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-shadowed/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-shadowed/schema.graphqls new file mode 100644 index 00000000..e9a28d7c --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-shadowed/schema.graphqls @@ -0,0 +1,12 @@ +type Query { + folder: Folder! +} + +type Folder { + images: [Image!]! +} + +type Image { + name: String! + title: String! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-unimplemented/01-helper.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-unimplemented/01-helper.graphql new file mode 100644 index 00000000..50dd7b02 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-unimplemented/01-helper.graphql @@ -0,0 +1,3 @@ +query { + folder { images { name imageBlob preview } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-unimplemented/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-unimplemented/schema.graphqls new file mode 100644 index 00000000..ac354e43 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless-unimplemented/schema.graphqls @@ -0,0 +1,13 @@ +type Query { + folder: Folder! +} + +type Folder { + images: [Image!]! +} + +type Image { + name: String! + imageBlob: String! + preview: String +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/01-local-context.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/01-local-context.graphql new file mode 100644 index 00000000..15559cd9 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/01-local-context.graphql @@ -0,0 +1,3 @@ +query { + folder { images { name imageBlob thumbnail(size: 64) caption } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/02-contexts.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/02-contexts.graphql new file mode 100644 index 00000000..6a5e7e1e --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/02-contexts.graphql @@ -0,0 +1,3 @@ +query { + folder { images { name owner locale signature } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/schema.graphqls new file mode 100644 index 00000000..21659169 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/sourceless/schema.graphqls @@ -0,0 +1,18 @@ +type Query { + folder: Folder! +} + +type Folder { + supportedFileTypes: [String!]! + images: [Image!]! +} + +type Image { + name: String! + imageBlob: String! + thumbnail(size: Int!): String! + owner: String + locale: String! + signature: String! + caption: String! +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-input-order/01-count.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-input-order/01-count.graphql new file mode 100644 index 00000000..20456a0e --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-input-order/01-count.graphql @@ -0,0 +1,3 @@ +query { + count(filter: { term: "a", limit: 1, offset: 2 }) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-input-order/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-input-order/schema.graphqls new file mode 100644 index 00000000..8fb7ff41 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-input-order/schema.graphqls @@ -0,0 +1,15 @@ +type Query { + count(filter: Filter): Int! +} + +extend input Filter { + limit: Int +} + +input Filter { + term: String +} + +extend input Filter { + offset: Int +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/01-kept-declarations.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/01-kept-declarations.graphql new file mode 100644 index 00000000..46ca005e --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/01-kept-declarations.graphql @@ -0,0 +1,10 @@ +query { + typeAndExtension { name } + twoExtensions { id name } + oneDefinition { name } + echo( + typeAndExtension: { id: "1" } + twoExtensions: { term: "t", id: "2" } + oneDefinition: { id: "3" } + ) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/02-introspection.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/02-introspection.graphql new file mode 100644 index 00000000..2ae3452f --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/02-introspection.graphql @@ -0,0 +1,9 @@ +query { + __schema { + types { + name + fields { name description } + inputFields { name description } + } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/schema.graphqls new file mode 100644 index 00000000..94479c98 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-repeated-fields/schema.graphqls @@ -0,0 +1,72 @@ +type Query { + typeAndExtension: TypeAndExtension + twoExtensions: TwoExtensions + oneDefinition: OneDefinition + echo( + typeAndExtension: InputTypeAndExtension + twoExtensions: InputTwoExtensions + oneDefinition: InputOneDefinition + ): String +} + +type TypeAndExtension { + "From the type" + name: String +} + +extend type TypeAndExtension { + "From the extension" + name: String +} + +type TwoExtensions { + id: ID +} + +extend type TwoExtensions { + "From the first extension" + name: String +} + +extend type TwoExtensions { + "From the second extension" + name: String +} + +type OneDefinition { + "The first" + name: String + "The second" + name: String +} + +input InputTypeAndExtension { + "From the type" + id: ID +} + +extend input InputTypeAndExtension { + "From the extension" + id: ID +} + +input InputTwoExtensions { + term: String +} + +extend input InputTwoExtensions { + "From the first extension" + id: ID +} + +extend input InputTwoExtensions { + "From the second extension" + id: ID +} + +input InputOneDefinition { + "The first" + id: ID + "The second" + id: ID +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-sealed/01-pets-and-animals.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-sealed/01-pets-and-animals.graphql new file mode 100644 index 00000000..98533be9 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-sealed/01-pets-and-animals.graphql @@ -0,0 +1,11 @@ +query { + pets { + __typename + ... on Dog { name } + ... on Cat { lives } + } + animals { + __typename + name + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-sealed/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-sealed/schema.graphqls new file mode 100644 index 00000000..bdac91b3 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions-sealed/schema.graphqls @@ -0,0 +1,30 @@ +type Query { + pets: [Pet!]! + animals: [Animal!]! +} + +union Pet = Dog + +extend union Pet = Cat + +type Dog { + name: String +} + +type Cat { + lives: Int +} + +interface Animal { + name: String +} + +type Cow implements Animal { + name: String +} + +type Horse { + name: String +} + +extend type Horse implements Animal diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/01-node.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/01-node.graphql new file mode 100644 index 00000000..07289dca --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/01-node.graphql @@ -0,0 +1,16 @@ +query { + article: node(id: "a1") { + __typename + id + createdAt + name + ... on Article { title } + } + video: node(id: "v1") { + __typename + id + createdAt + name + ... on Video { seconds } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/02-search-and-enums.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/02-search-and-enums.graphql new file mode 100644 index 00000000..f578be07 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/02-search-and-enums.graphql @@ -0,0 +1,10 @@ +query { + search { + __typename + ... on Article { title } + ... on Video { seconds } + } + colors + shades + count(filter: { term: "launched", limit: 5 }) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/03-introspection.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/03-introspection.graphql new file mode 100644 index 00000000..088b57c7 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/03-introspection.graphql @@ -0,0 +1,13 @@ +query { + __schema { + types { + name + kind + fields { name description } + interfaces { name } + possibleTypes { name } + enumValues { name description } + inputFields { name } + } + } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/schema.graphqls new file mode 100644 index 00000000..b0488c03 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/type-extensions/schema.graphqls @@ -0,0 +1,73 @@ +directive @tag(name: String!) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT +directive @owner(team: String!) on OBJECT + +type Query { + node(id: ID!): Node + search: [SearchResult!]! + colors: [Color!]! + shades: [Shade!]! + count(filter: Filter!): Int! +} + +interface Node @tag(name: "base") { + "The base id" + id: ID! + createdAt: String +} + +extend interface Node @tag(name: "extension") { + "The extension id" + id: ID! + name: String +} + +type Article implements Node @owner(team: "content") @tag(name: "base") { + id: ID! + createdAt: String + name: String + title: String +} + +extend type Article @owner(team: "growth") @tag(name: "extension") + +type Video { + id: ID! + createdAt: String + name: String + seconds: Int +} + +extend type Video implements Node + +union SearchResult @tag(name: "base") = Article + +extend union SearchResult @tag(name: "extension") = Video | Article + +enum Color @tag(name: "base") { + "The first red" + RED + BLUE +} + +extend enum Color @tag(name: "extension") { + RED + GREEN +} + +extend enum Shade { LIGHT } + +extend enum Shade { DARK } + +input Filter @tag(name: "base") { + term: String +} + +extend input Filter @tag(name: "extension") { + limit: Int +} + +type Note { + text: String +} + +extend union Note = Article diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/01-ignored.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/01-ignored.graphql new file mode 100644 index 00000000..da3a853c --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/01-ignored.graphql @@ -0,0 +1,3 @@ +query { + ignored(input: { inner: { name: "a", legacy: "x" } }) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/02-typo.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/02-typo.graphql new file mode 100644 index 00000000..f6465561 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/02-typo.graphql @@ -0,0 +1,3 @@ +query { + typo(input: { item: { name: "b" } }) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/schema.graphqls new file mode 100644 index 00000000..b466a9a9 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/unmapped-inputs/schema.graphqls @@ -0,0 +1,21 @@ +type Query { + ignored(input: IgnoredInput!): String + typo(input: TypoInput!): String +} + +input IgnoredInput { + inner: InnerInput +} + +input InnerInput { + name: String + legacy: String +} + +input TypoInput { + item: ItemInput +} + +input ItemInput { + name: String +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/01-trees.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/01-trees.graphql new file mode 100644 index 00000000..abf0d8fc --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/01-trees.graphql @@ -0,0 +1,3 @@ +query { + trees(filter: { name: "a", children: [{ name: "b" }, { name: "c", children: [{ name: "d" }] }] }) +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/02-person.graphql b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/02-person.graphql new file mode 100644 index 00000000..9a424c39 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/02-person.graphql @@ -0,0 +1,4 @@ +query { + person { name friend { name } state someone { ... on Person { name } } } + someone { ... on Named { name } } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/schema.graphqls b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/schema.graphqls new file mode 100644 index 00000000..180fe7d6 --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/scenarios/wiring-shapes/schema.graphqls @@ -0,0 +1,32 @@ +directive @inspect on INPUT_FIELD_DEFINITION +directive @required on FIELD_DEFINITION +directive @described on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT + +type Query { + trees(filter: TreeFilter): Int + person: Person + someone: Someone +} + +input TreeFilter @described { + name: String + children: [TreeFilter!] @inspect +} + +interface Named @described { + name: String +} + +type Person implements Named @described { + name: String + friend: Person @required + state: State @required + someone: Someone +} + +union Someone @described = Person + +enum State @described { + ALIVE + GONE +} From 2aa609ec563200509d3eaf8a0744194b5a90d8ef Mon Sep 17 00:00:00 2001 From: Oryan Date: Wed, 4 Nov 2026 13:49:58 -0500 Subject: [PATCH 2/7] Ignore local agent and Maven files --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 5b53fe18..e6539ff9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,8 @@ target/ pom.xml.releaseBackup release.properties +.mvn/jvm.config +.local/ +CLAUDE.local.md +.claude/settings.local.json +.claude/worktrees/ From dcf70b34574ae450a227380db11a81650e4469c3 Mon Sep 17 00:00:00 2001 From: Oryan Date: Wed, 4 Nov 2026 13:52:19 -0500 Subject: [PATCH 3/7] Add AGENTS.md with the agent rules and a rule table CLAUDE.md imports it, so Claude Code, Cursor and Codex read the same rules in every clone and worktree. --- AGENTS.md | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 1 + 2 files changed, 110 insertions(+) create mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..d0dd42b2 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,109 @@ +# graphql-java-tools + +Open-source library (`io.github.graphql-java-kickstart:graphql-java-tools`) that builds a graphql-java schema from GraphQL SDL and +resolver classes. Published to Maven Central. Kotlin, with a few Java files, targeting Java 17. + +## Layout + +- `src/main/kotlin/graphql/kickstart/tools`: `SchemaParser` and its builder and options, `SchemaClassScanner` (matches schema + types to classes), `resolver/` (field resolvers and data fetchers), `directive/`, `relay/`, `util/` +- `src/test/kotlin`: JUnit tests, one class per feature or issue. `EndToEndTest` and `EndToEndSpecHelper` hold the shared schema + and resolvers +- `.claude/skills/verify-tools`: the probe that checks a change from a consuming app's side + +## Build and test + +```bash +mvn verify +``` + +Compiler warnings fail the build. CI runs `mvn verify` on JDK 17, 21 and 25. A newer local JDK can pass code that fails on +17, so run the build on JDK 17 before you push. + +Machine-specific Maven JVM flags go in `.mvn/jvm.config` and personal agent rules go in `CLAUDE.local.md`. Git ignores both. + +## Verifying + +Run the `verify-tools` skill (`.claude/skills/verify-tools/SKILL.md`) before you push any change to how the schema is built, +refactors and new or changed warnings included. `mvn verify` runs the library's own tests. The probe builds a schema +through the public API only, the way an app does. Bugfixes and small features stop at this skill. + +## Compatibility + +- Public API changes must stay backwards compatible. Deprecate before removing. +- Invalid input that used to build stays accepted until the next major. Log a WARN that names the type and the item, open a + GitHub issue with the target major in its title (the repo has no milestones), and leave `// TODO in X.0.0 (#N)`. + +## GitHub + +- PRs follow `.github/pull-request-template.md` and the + [contribution guide](https://github.com/graphql-java-kickstart/graphql-java-tools/wiki/Contribution-guide). Open them as ready + for review, not drafts. Reference the issue with `Fixes #N`. +- A follow-up to an open PR goes into that PR as another commit. +- Deferred work and out-of-scope findings become GitHub issues. +- When a PR has release-note material, add it to the PR description. + +## Releases + +Follow the [Releasing a version](https://github.com/graphql-java-kickstart/graphql-java-tools/wiki/Releasing-a-version) wiki +page. `github-build.sh` and `.github/workflows/release.yml` do the version bump, tag and publish. + +## Rules that need judgment + +No check can enforce these, so each one names the mistake it prevents. + +- **Build only what was asked.** Don't add support for a case nobody asked for. Ask first. Failure: a PR made the library call + JDK proxied resolver methods through the proxy's interfaces, a shape no user had reported. A later commit replaced that + with a warning at build and deleted 282 lines (`76b67394`). +- **Check every claim in a PR body or release note at the current head.** Re-read the body after each push. A claim about + what users do needs an issue comment or a consumer's code behind it. Failure: a PR body said existing tests already + proved scalars pass through unchanged, and none of them did. +- **Add a variant to the existing test class and its shared fixtures.** Write one test per behavior and cover variants with + a table or a generated matrix, as `NestedGenericWrapperTest` does. Failure: a directive change added a test and + fixtures per variant, and a later commit folded seven of those tests into one (`f8c7be76`). +- **Run verify-tools on refactors and warning changes too.** A change called "a refactor" or "only the wording" still + changes what an app's schema build does, and the unit tests don't build through the public API alone. Failure: an agent + skipped the probe on a scanner rewrite because it was a refactor. +- **Keep a comment only for a non-obvious why.** No comment that repeats the code, narrates history, or carries an issue or + PR number outside a TODO. Failure: a comment explained what `determineType` returned, which the `namedType` default + already showed, and a follow-up commit deleted it (`7448f2c6`). + +## Rule table + +Each rule comes from a mistake agents made in this repo more than once. The second column names what fails when the rule +is broken. "docs only" means nothing does yet, so the rule depends on you reading it. + +| Rule | Enforced by | +|---|---| +| A resolver method's return value is unwrapped by one rule that the schema build and the data fetcher share | docs only | +| A resolver method's parameter layout, type variables and source are decided once, at schema build | docs only | +| One output has one builder. Don't add a second path that builds the same thing | docs only | +| Read an SDL type's members merged with its extensions, never from the raw definition | docs only | +| Reuse an existing structure before you add a parallel one | docs only | +| Argument conversion goes through one entry point | docs only | +| An input field's Java type comes from the mapping Jackson uses, not from guessed getters | docs only | +| Every recursive walk over the type graph handles cycles, and a test covers a cycle | docs only | +| Public signatures stay binary compatible, data class `copy()` and `componentN` included | docs only | +| Remove the plumbing a change leaves unused | Compiler warnings for unused locals, docs only for the rest | +| A new warning or build error names the type and the item and uses `SourceLocation.describe()` for its location | docs only | +| A check keyed on a class name or an exception type has a test that fails when the dependency moves it | docs only | +| Work that depends only on the schema happens at schema build, not on every fetch | docs only | +| Schema build time grows linearly with the schema | docs only | +| A subtype check has a test with a subclass, so an inverted check fails | docs only | +| Directive wirings decide which types become `GraphQLTypeReference` in one place | `TypeReferences` in `DirectiveWiringHelper` | +| An object built once at schema build holds no per-request state | docs only | +| Add a variant to the existing test class and its shared fixtures | docs only | +| A new test fails without the change it guards | docs only | +| A fix keeps every shape that worked on the last release | docs only | +| A test that builds a schema also queries its fields with `assertEveryFieldResolves` | docs only | +| The first commit of a fix tests the neighbouring shapes, not just the reported one | docs only | +| The build passes on JDK 17, the lowest supported version | CI on JDK 17, 21 and 25 | +| Run verify-tools before you push a schema-building change | docs only | +| The packaged jar matches the pom's module and Java target | docs only | +| Compiler warnings fail the build | `-Werror` and `failOnWarning` in `pom.xml` | +| Check every claim in a PR body or release note at the current head | docs only | +| Keep a comment only for a non-obvious why, with no history and no issue numbers outside a TODO | docs only | +| Build only what was asked | docs only | +| Agent worktrees and local settings stay out of commits | `.gitignore` | +| Agent rules live in one committed file | This file. `CLAUDE.md` imports it | +| Invalid input that used to build logs a WARN until the next major | docs only | diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..43c994c2 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md From eba055532598b686266c52c2741b4daf5698bd56 Mon Sep 17 00:00:00 2001 From: Oryan Date: Wed, 4 Nov 2026 13:56:45 -0500 Subject: [PATCH 4/7] Drop the probe's narrating comments and unchecked casts --- .claude/skills/verify-tools/probe.sh | 5 ---- .claude/skills/verify-tools/probe/pom.xml | 4 ---- .../src/main/kotlin/probe/DirectiveDump.kt | 1 - .../probe/src/main/kotlin/probe/Main.kt | 24 ++++++------------- .../probe/src/main/kotlin/scenarios/Async.kt | 1 - .../src/main/kotlin/scenarios/Bookstore.kt | 2 -- .../kotlin/scenarios/ContextAndEnvironment.kt | 2 -- .../main/kotlin/scenarios/ContextMisbound.kt | 1 - .../main/kotlin/scenarios/DirectiveDrift.kt | 5 ---- .../src/main/kotlin/scenarios/Directives.kt | 1 - .../kotlin/scenarios/DirectivesInvalid.kt | 1 - .../kotlin/scenarios/GenericInputResolver.kt | 1 - .../probe/src/main/kotlin/scenarios/Inputs.kt | 3 --- .../src/main/kotlin/scenarios/JdkProxy.kt | 3 --- .../src/main/kotlin/scenarios/NestedUnions.kt | 3 --- .../main/kotlin/scenarios/NestedWrappers.kt | 3 --- .../kotlin/scenarios/NestedWrappersExact.kt | 5 ---- .../main/kotlin/scenarios/OptionalResults.kt | 5 ---- .../src/main/kotlin/scenarios/Options.kt | 1 - .../src/main/kotlin/scenarios/Polymorphism.kt | 4 ---- .../main/kotlin/scenarios/ReadOnlySchema.kt | 4 ---- .../main/kotlin/scenarios/RecursiveInputs.kt | 1 - .../src/main/kotlin/scenarios/ScalarArgs.kt | 6 ----- .../main/kotlin/scenarios/ScalarDirectives.kt | 2 -- .../src/main/kotlin/scenarios/Scenario.kt | 7 ------ .../src/main/kotlin/scenarios/Sourceless.kt | 4 ---- .../main/kotlin/scenarios/TypeExtensions.kt | 4 ---- .../scenarios/TypeExtensionsInputOrder.kt | 1 - .../scenarios/TypeExtensionsRepeatedFields.kt | 4 ---- .../kotlin/scenarios/TypeExtensionsSealed.kt | 4 ---- .../main/kotlin/scenarios/UnmappedInputs.kt | 1 - .../src/main/kotlin/scenarios/WiringShapes.kt | 2 -- 32 files changed, 7 insertions(+), 108 deletions(-) diff --git a/.claude/skills/verify-tools/probe.sh b/.claude/skills/verify-tools/probe.sh index b5f69a5b..dc88d731 100755 --- a/.claude/skills/verify-tools/probe.sh +++ b/.claude/skills/verify-tools/probe.sh @@ -1,7 +1,4 @@ #!/usr/bin/env bash -# Drives graphql-java-tools the way a consuming app does: installs the current directory's checkout into a private local -# Maven repository, compiles the probe project in probe/ against it, builds a scenario's schema and runs its operations. -# See SKILL.md for the commands. Evidence goes to $TMPDIR/verify-tools/evidence/ and survives `clean`. set -euo pipefail SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -21,7 +18,6 @@ pom_value() { sed -n "s:.*<$1>\(.*\).*:\1:p" "$REPO/pom.xml" | head -1; } TOOLS_VERSION="$(pom_value version)" KOTLIN_VERSION="$(pom_value kotlin.version)" -# Identifies the library sources: HEAD plus any uncommitted change to pom.xml or src/, tracked or not fingerprint() { { git -C "$REPO" rev-parse HEAD @@ -126,7 +122,6 @@ cmd_run() { evidence=$base build="$WORK/probe-target${gj:+-gj$gj}" mkdir -p "$EVIDENCE_ROOT" - # Another checkout can start the same scenario in the same second until mkdir "$evidence" 2>/dev/null; do n=$((n + 1)) evidence="$base-$n" diff --git a/.claude/skills/verify-tools/probe/pom.xml b/.claude/skills/verify-tools/probe/pom.xml index c17028ce..8cdeb468 100644 --- a/.claude/skills/verify-tools/probe/pom.xml +++ b/.claude/skills/verify-tools/probe/pom.xml @@ -1,5 +1,4 @@ - 4.0.0 @@ -9,7 +8,6 @@ UTF-8 - UNSET 2.3.10 ${project.basedir}/target @@ -21,7 +19,6 @@ graphql-java-tools ${tools.version} - com.fasterxml.jackson.core jackson-databind @@ -45,7 +42,6 @@ - graphql-java-override diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/probe/DirectiveDump.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/probe/DirectiveDump.kt index 0c622e39..119cff88 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/probe/DirectiveDump.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/probe/DirectiveDump.kt @@ -14,7 +14,6 @@ import graphql.schema.GraphQLSchema import graphql.schema.GraphQLTypeUtil import graphql.schema.InputValueWithState -/** Lists the applied and the legacy directives of every element that can carry them, in a stable order. */ fun dumpDirectives(schema: GraphQLSchema): String = buildString { @Suppress("DEPRECATION") section("schema", schema.schemaAppliedDirectives, schema.schemaDirectives) diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt index 33b3115d..c17009fa 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt @@ -1,5 +1,6 @@ package probe +import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature import graphql.ExecutionInput @@ -17,13 +18,6 @@ import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit import kotlin.system.exitProcess -/** - * Builds the scenario's schema through the public API of the graphql-java-tools jar on the classpath, then runs every - * `.graphql` file under `scenarios//` against it. Everything it observes goes to the output directory. - * - * Exit codes: 0 schema built and all operations ran (operations may still have GraphQL errors, see summary.txt), - * 2 schema build threw, 64 bad arguments. - */ fun main(args: Array) { if (args.size != 2) usage("expected ") val scenario = SCENARIOS.find { it.name == args[0] } ?: usage("unknown scenario '${args[0]}'") @@ -59,8 +53,7 @@ fun main(args: Array) { for (operation in operationFiles(scenario.operations)) { val name = operation.nameWithoutExtension val variablesFile = File(operation.parentFile, "$name.variables.json") - @Suppress("UNCHECKED_CAST") - val variables = if (variablesFile.exists()) json.readValue(variablesFile, Map::class.java) as Map else emptyMap() + val variables = if (variablesFile.exists()) json.readValue(variablesFile, object : TypeReference>() {}) else emptyMap() val input = scenario.input(ExecutionInput.newExecutionInput().query(operation.readText()).variables(variables)).build() val result = try { @@ -70,9 +63,7 @@ fun main(args: Array) { report("operation $name: THREW $e") continue } - // A subscription's data is a Publisher of results - @Suppress("UNCHECKED_CAST") - val publisher = result.getData() as? Publisher + val publisher = result.getData() as? Publisher<*> val written = LinkedHashMap() var eventCount = "" if (publisher != null) { @@ -105,14 +96,13 @@ private fun operationFiles(scenario: String): List { return File(dir.toURI()).listFiles { file -> file.extension == "graphql" }!!.sortedBy { it.name } } -/** Subscribes the way a transport would and collects every event until completion, for up to 10 seconds. */ -private fun collect(publisher: Publisher): List> { +private fun collect(publisher: Publisher<*>): List> { val events = mutableListOf>() val done = CountDownLatch(1) - publisher.subscribe(object : Subscriber { + publisher.subscribe(object : Subscriber { override fun onSubscribe(subscription: Subscription) = subscription.request(Long.MAX_VALUE) - override fun onNext(event: ExecutionResult) { - synchronized(events) { events.add(event.toSpecification()) } + override fun onNext(event: Any?) { + synchronized(events) { events.add((event as ExecutionResult).toSpecification()) } } override fun onError(error: Throwable) { synchronized(events) { events.add(mapOf("publisherError" to error.toString())) } diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Async.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Async.kt index 535d8f4d..87ba5aa5 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Async.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Async.kt @@ -9,7 +9,6 @@ import kotlinx.coroutines.reactive.publish import org.reactivestreams.Publisher import java.util.concurrent.CompletableFuture -/** CompletableFuture and suspend resolvers, a suspend field resolver on a nested type, and a Publisher subscription. */ object Async : Scenario { override val name = "async" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Bookstore.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Bookstore.kt index 624ef070..7314bcb4 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Bookstore.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Bookstore.kt @@ -12,7 +12,6 @@ import graphql.schema.GraphQLScalarType import java.time.LocalDate import java.util.Locale -/** Root resolver, a GraphQLResolver for a nested type, data class properties, an is-getter and a custom scalar. */ object Bookstore : Scenario { override val name = "bookstore" @@ -22,7 +21,6 @@ object Bookstore : Scenario { .scalars(dateScalar) } -/** The same schema plus a field no resolver or class implements. */ object BookstoreMissingResolver : Scenario { override val name = "bookstore-missing-resolver" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextAndEnvironment.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextAndEnvironment.kt index d569d63d..fae8041e 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextAndEnvironment.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextAndEnvironment.kt @@ -8,7 +8,6 @@ import graphql.kickstart.tools.SchemaParser import graphql.kickstart.tools.SchemaParserOptions import graphql.schema.DataFetchingEnvironment -/** Resolver methods that take the custom context class and DataFetchingEnvironment after the schema arguments. */ object ContextAndEnvironment : Scenario { override val name = "context-and-environment" @@ -21,7 +20,6 @@ object ContextAndEnvironment : Scenario { builder.graphQLContext(mapOf(AppContext::class.java to AppContext("oryan", "en-CA"))) } -/** A trailing parameter that is neither a context nor the environment. */ object ContextAndEnvironmentInvalid : Scenario { override val name = "context-and-environment-invalid" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextMisbound.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextMisbound.kt index 10612981..d51223b6 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextMisbound.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ContextMisbound.kt @@ -7,7 +7,6 @@ import graphql.kickstart.tools.SchemaParser import graphql.kickstart.tools.SchemaParserOptions import graphql.schema.DataFetchingEnvironment -/** Resolver methods whose environment or context parameter takes the place of a schema argument. */ object ContextMisbound : Scenario { override val name = "context-misbound" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectiveDrift.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectiveDrift.kt index 87dc56e5..53ff6ca6 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectiveDrift.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectiveDrift.kt @@ -8,10 +8,6 @@ import graphql.schema.GraphQLScalarType import graphql.schema.GraphQLSchema import probe.dumpDirectives -/** - * Every place a directive can be applied, with repeated non-repeatable, undeclared, defaulted and described arguments, - * extensions, and a scalar whose directive has an unknown argument. inspect.txt lists the applied and legacy directives. - */ object DirectiveDrift : Scenario { override val name = "directive-drift" @@ -25,7 +21,6 @@ object DirectiveDrift : Scenario { override fun inspect(schema: GraphQLSchema) = dumpDirectives(schema) } -/** An undeclared directive without allowUndeclaredDirectives. */ object DirectiveDriftUndeclared : Scenario { override val name = "directive-drift-undeclared" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Directives.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Directives.kt index 179b0a2f..f4888d92 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Directives.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Directives.kt @@ -10,7 +10,6 @@ import graphql.schema.GraphQLFieldDefinition import graphql.schema.idl.SchemaDirectiveWiring import graphql.schema.idl.SchemaDirectiveWiringEnvironment -/** A named SchemaDirectiveWiring that wraps a data fetcher, @deprecated, and a relay connection generated by @connection. */ object Directives : Scenario { override val name = "directives" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectivesInvalid.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectivesInvalid.kt index d641ffd3..d05c34c7 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectivesInvalid.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/DirectivesInvalid.kt @@ -3,7 +3,6 @@ package scenarios import graphql.kickstart.tools.GraphQLQueryResolver import graphql.kickstart.tools.SchemaParser -/** Directives applied at a location their definition doesn't list, without a required argument, or twice when not repeatable. */ object DirectivesInvalid : Scenario { override val name = "directives-invalid" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/GenericInputResolver.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/GenericInputResolver.kt index 375ebc22..ad4dc778 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/GenericInputResolver.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/GenericInputResolver.kt @@ -3,7 +3,6 @@ package scenarios import graphql.kickstart.tools.GraphQLQueryResolver import graphql.kickstart.tools.SchemaParser -/** A query resolver inheriting a method whose parameter is its superclass's type variable. */ object GenericInputResolver : Scenario { override val name = "generic-input-resolver" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Inputs.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Inputs.kt index 3172da5d..3665d9b7 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Inputs.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Inputs.kt @@ -7,7 +7,6 @@ import graphql.kickstart.tools.SchemaParserOptions import graphql.schema.DataFetchingEnvironment import java.util.Optional -/** Scalar, list, enum and input object arguments, SDL default values, DataFetchingEnvironment and omitted vs null. */ object Inputs : Scenario { override val name = "inputs" @@ -29,8 +28,6 @@ class InputsQuery : GraphQLQueryResolver { fun search(term: String, limit: Int, genres: List?, env: DataFetchingEnvironment): String = "term=$term limit=$limit genres=$genres field=${env.field.name}" - /** null when the argument was omitted, Optional.empty() when it was passed as null. */ - @Suppress("OptionalAssignedToNull") fun nickname(value: Optional?): String = when { value == null -> "omitted" value.isEmpty -> "explicit null" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/JdkProxy.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/JdkProxy.kt index fa417aa2..e06bddf7 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/JdkProxy.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/JdkProxy.kt @@ -5,14 +5,12 @@ import graphql.kickstart.tools.SchemaParser import org.springframework.aop.framework.ProxyFactory import org.springframework.aop.support.AopUtils -/** Issue #822: the resolver behind a Spring JDK dynamic proxy, which only implements GraphQLQueryResolver. */ object JdkProxy : Scenario { override val name = "jdk-proxy" override fun parser() = proxyParser(proxy(proxyTargetClass = false).also { check(AopUtils.isJdkDynamicProxy(it)) }) } -/** The workaround: the same resolver behind a CGLIB proxy. */ object JdkProxyCglib : Scenario { override val name = "jdk-proxy-cglib" override val operations = "jdk-proxy" @@ -20,7 +18,6 @@ object JdkProxyCglib : Scenario { override fun parser() = proxyParser(proxy(proxyTargetClass = true).also { check(AopUtils.isCglibProxy(it)) }) } -/** The same resolver without a proxy. */ object JdkProxyPlain : Scenario { override val name = "jdk-proxy-plain" override val operations = "jdk-proxy" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedUnions.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedUnions.kt index 0649a90b..1fd7001c 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedUnions.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedUnions.kt @@ -3,9 +3,6 @@ package scenarios import graphql.kickstart.tools.GraphQLQueryResolver import graphql.kickstart.tools.SchemaParser -/** - * A union that is only a member of another union. No field returns `Media`. - */ object NestedUnions : Scenario { override val name = "nested-unions" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappers.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappers.kt index 854d19f6..440e2d65 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappers.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappers.kt @@ -13,7 +13,6 @@ import org.dataloader.DataLoaderRegistry import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture.completedFuture -/** Generic wrappers and futures nested inside lists and inside other futures (issue 254). */ object NestedWrappers : Scenario { override val name = "nested-wrappers" @@ -31,7 +30,6 @@ object NestedWrappers : Scenario { private val tryWrapper = SchemaParserOptions.GenericWrapper.withTransformer(Try::class, 0, { t -> t.get() }) } -/** The same resolvers, run by an app whose own graphql-java ValueUnboxer already unwraps Try and joins futures. */ object NestedWrappersUnboxer : Scenario by NestedWrappers { override val name = "nested-wrappers-unboxer" @@ -91,7 +89,6 @@ class NestedWrappersQuery : GraphQLQueryResolver { fun futureOfItems(): CompletableFuture> = completedFuture(plainItems()) } -/** Suspend functions returning lists of an open class, which Kotlin reflection types as List. */ object NestedWrappersSuspend : Scenario { override val name = "nested-wrappers-suspend" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappersExact.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappersExact.kt index 398f7acc..d1c111ff 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappersExact.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/NestedWrappersExact.kt @@ -15,11 +15,6 @@ import java.util.concurrent.CompletableFuture.completedFuture import java.util.concurrent.Future import java.util.concurrent.FutureTask -/** - * Nested wrappers unwrapped exactly where the schema build matched them (issue 905): a custom scalar's futures and wrappers, a - * plain Future in a list (also from a wrapper's transformer and a suspend function), a wrapper only a schemaWrapper introduces, - * and a subclass registered as a wrapper of its own. - */ object NestedWrappersExact : Scenario { override val name = "nested-wrappers-exact" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/OptionalResults.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/OptionalResults.kt index 6772d564..ddec6328 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/OptionalResults.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/OptionalResults.kt @@ -6,11 +6,6 @@ import graphql.kickstart.tools.GraphQLQueryResolver import graphql.kickstart.tools.SchemaParser import java.util.Optional -/** - * A DataFetcherResult inside an Optional: its data, its errors, an empty Optional, the same object type returned another way, - * a list, and DataFetcherResult nested in itself under an Optional, which the build rejects like - * DataFetcherResult>. - */ object OptionalResults : Scenario { override val name = "optional-results" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Options.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Options.kt index 6bb4ad3a..108ccce5 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Options.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Options.kt @@ -6,7 +6,6 @@ import graphql.kickstart.tools.SchemaParser import graphql.kickstart.tools.SchemaParserOptions import graphql.schema.DataFetcher -/** A missing resolver provider standing in for a field nothing implements. */ object Options : Scenario { override val name = "options" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Polymorphism.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Polymorphism.kt index a97444b5..bd4b6778 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Polymorphism.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Polymorphism.kt @@ -3,10 +3,6 @@ package scenarios import graphql.kickstart.tools.GraphQLQueryResolver import graphql.kickstart.tools.SchemaParser -/** - * Interface and union fields whose resolvers return a supertype, so the concrete classes are only known through the - * dictionary. `Writer` is backed by a class with a different name. - */ object Polymorphism : Scenario { override val name = "polymorphism" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ReadOnlySchema.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ReadOnlySchema.kt index 22212cfe..9a6b9763 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ReadOnlySchema.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ReadOnlySchema.kt @@ -4,10 +4,6 @@ import graphql.kickstart.tools.GraphQLMutationResolver import graphql.kickstart.tools.GraphQLQueryResolver import graphql.kickstart.tools.SchemaParser -/** - * Builds the schema with `parseSchemaObjects().toReadOnlySchema()` instead of `makeExecutableSchema()`, so the mutation - * type is left out. Covers an interface, a union, a custom field directive and a directive applied to the schema. - */ object ReadOnlySchema : Scenario { override val name = "read-only-schema" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/RecursiveInputs.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/RecursiveInputs.kt index 94d40fcc..0c68fe7d 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/RecursiveInputs.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/RecursiveInputs.kt @@ -3,7 +3,6 @@ package scenarios import graphql.kickstart.tools.GraphQLQueryResolver import graphql.kickstart.tools.SchemaParser -/** Input objects that reference themselves and each other through lists and non-null types, and directive arguments of input object, enum and list types. */ object RecursiveInputs : Scenario { override val name = "recursive-inputs" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarArgs.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarArgs.kt index c258d296..c6fe7a7d 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarArgs.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarArgs.kt @@ -14,10 +14,6 @@ import graphql.schema.GraphQLScalarType import java.util.Locale import java.util.Optional -/** - * Scalar arguments: a custom scalar Jackson can't build, a Kotlin scalar class without visible properties in an input object, - * the same written with a type id or an object id, ID converted to Long, and nested lists of strings. - */ object ScalarArgs : Scenario { override val name = "scalar-args" @@ -27,7 +23,6 @@ object ScalarArgs : Scenario { .resolvers(ScalarArgsQuery()) } -// no default constructor and no creator, so only the scalar's coercing can make one class Tag private constructor(val value: String) { companion object { fun of(value: String) = Tag(value) @@ -44,7 +39,6 @@ private val tagScalar = GraphQLScalarType.newScalar() }) .build() -// Jackson writes it as {} and can read {} back as a new instance holding "default" class ScalarArgsToken(private val value: String = "default") { override fun toString() = value } diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarDirectives.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarDirectives.kt index 76501b7e..abd40c93 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarDirectives.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/ScalarDirectives.kt @@ -7,7 +7,6 @@ import graphql.schema.GraphQLScalarType import graphql.schema.idl.SchemaDirectiveWiring import graphql.schema.idl.SchemaDirectiveWiringEnvironment -/** Directives and @specifiedBy on scalars from the SDL, on an extension and on the provided scalar, plus an undeclared one. */ object ScalarDirectives : Scenario { override val name = "scalar-directives" @@ -26,7 +25,6 @@ object ScalarDirectives : Scenario { private fun string(name: String) = GraphQLScalarType.newScalar().name(name).coercing(Scalars.GraphQLString.coercing).build() } -/** Appends the directive and the value of [argument] that the wiring sees to the scalar's description. */ class ArgumentWiring(private val argument: String) : SchemaDirectiveWiring { override fun onScalar(environment: SchemaDirectiveWiringEnvironment): GraphQLScalarType { val directive = environment.appliedDirective diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Scenario.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Scenario.kt index cfca8e40..89b59d55 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Scenario.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Scenario.kt @@ -6,22 +6,15 @@ import graphql.kickstart.tools.SchemaParser import graphql.kickstart.tools.SchemaParserBuilder import graphql.schema.GraphQLSchema -/** - * One way a user sets up graphql-java-tools: SDL and operations under `src/main/resources/scenarios//`, resolvers - * and options in an `object` in this package, which registers it. - */ sealed interface Scenario { val name: String - /** The directory under `scenarios/` whose operations run against this scenario's schema. */ val operations: String get() = name - /** The configured builder. The probe calls `build()` on it and passes the result to [schema]. */ fun parser(): SchemaParserBuilder fun schema(parser: SchemaParser): GraphQLSchema = parser.makeExecutableSchema() - /** Extra evidence about the built schema, written to inspect.txt. */ fun inspect(schema: GraphQLSchema): String? = null fun graphQL(builder: GraphQL.Builder): GraphQL.Builder = builder diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Sourceless.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Sourceless.kt index 1253d5c5..f14c4ec2 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Sourceless.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/Sourceless.kt @@ -9,7 +9,6 @@ import graphql.kickstart.tools.SchemaParser import graphql.kickstart.tools.SchemaParserOptions import graphql.schema.DataFetchingEnvironment -/** Resolver methods that leave out the source object and take the environment or a context last (issue 304). */ object Sourceless : Scenario { override val name = "sourceless" @@ -22,7 +21,6 @@ object Sourceless : Scenario { builder.graphQLContext(mapOf(AppContext::class.java to AppContext("oryan", "en-CA"), "owner" to "ada")) } -/** A data class getter and a with-source method that share a name with a sourceless method. */ object SourcelessShadowed : Scenario { override val name = "sourceless-shadowed" @@ -31,7 +29,6 @@ object SourcelessShadowed : Scenario { .resolvers(SourcelessQuery(), SourcelessFolderResolver(), ShadowedImageResolver()) } -/** A helper on the resolver that looks like a sourceless method for a field the app leaves unimplemented. */ object SourcelessUnimplemented : Scenario { override val name = "sourceless-unimplemented" @@ -41,7 +38,6 @@ object SourcelessUnimplemented : Scenario { .options(SchemaParserOptions.newOptions().allowUnimplementedResolvers(true).build()) } -/** Sourceless methods whose environment or context parameter would take the place of a schema argument. */ object SourcelessMisbound : Scenario { override val name = "sourceless-misbound" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensions.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensions.kt index cca70e20..a7f10476 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensions.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensions.kt @@ -3,10 +3,6 @@ package scenarios import graphql.kickstart.tools.GraphQLQueryResolver import graphql.kickstart.tools.SchemaParser -/** - * Extensions of every kind of type: fields, values, members, interfaces and directives merged into the type, repeats that - * keep the first one with a warning, extensions without a type, and an extension of a different kind than its type. - */ object TypeExtensions : Scenario { override val name = "type-extensions" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsInputOrder.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsInputOrder.kt index 39657802..05dcfda3 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsInputOrder.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsInputOrder.kt @@ -5,7 +5,6 @@ import graphql.kickstart.tools.SchemaParser import graphql.schema.GraphQLInputObjectType import graphql.schema.GraphQLSchema -/** An input object whose extensions come before and after the type in the SDL. inspect.txt lists the fields in schema order. */ object TypeExtensionsInputOrder : Scenario { override val name = "type-extensions-input-order" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsRepeatedFields.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsRepeatedFields.kt index 5537a7d4..6144b6e9 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsRepeatedFields.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsRepeatedFields.kt @@ -6,10 +6,6 @@ import graphql.schema.GraphQLInputObjectType import graphql.schema.GraphQLObjectType import graphql.schema.GraphQLSchema -/** - * Object and input types that declare a field twice, between a type and its extension, between two extensions and inside - * one definition. They build, and inspect.txt lists the description of the declaration the schema kept. - */ object TypeExtensionsRepeatedFields : Scenario { override val name = "type-extensions-repeated-fields" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsSealed.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsSealed.kt index 917965ca..e5544f32 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsSealed.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/TypeExtensionsSealed.kt @@ -3,10 +3,6 @@ package scenarios import graphql.kickstart.tools.GraphQLQueryResolver import graphql.kickstart.tools.SchemaParser -/** - * A union member added by `extend union` and an interface implementor added by `extend type X implements Y`, with no - * dictionary. Their classes can only be found among the subclasses of the sealed class or interface the fields return. - */ object TypeExtensionsSealed : Scenario { override val name = "type-extensions-sealed" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/UnmappedInputs.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/UnmappedInputs.kt index abc97b2c..10dba5eb 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/UnmappedInputs.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/UnmappedInputs.kt @@ -5,7 +5,6 @@ import graphql.kickstart.tools.GraphQLQueryResolver import graphql.kickstart.tools.SchemaParser import java.util.Optional -/** Input classes with an Optional property: one ignores a field on purpose, the other misspells one. */ object UnmappedInputs : Scenario { override val name = "unmapped-inputs" diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/WiringShapes.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/WiringShapes.kt index 5c68d32b..840c74a7 100644 --- a/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/WiringShapes.kt +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/scenarios/WiringShapes.kt @@ -6,7 +6,6 @@ import graphql.schema.* import graphql.schema.idl.SchemaDirectiveWiring import graphql.schema.idl.SchemaDirectiveWiringEnvironment -/** Directive wirings on a recursive input (#875) and on types that refer to each other: interface, union, enum, self-reference. */ object WiringShapes : Scenario { override val name = "wiring-shapes" @@ -36,7 +35,6 @@ class WiringShapesQuery : GraphQLQueryResolver { fun someone(): Any = WiringPerson("grace") } -// records the type the wiring sees in the field's description class InspectWiring : SchemaDirectiveWiring { override fun onInputObjectField(environment: SchemaDirectiveWiringEnvironment): GraphQLInputObjectField { val type = GraphQLTypeUtil.unwrapAllAs(environment.element.type) From 1be87a7c9612dbfe70a5f4a4619f182e10a626ae Mon Sep 17 00:00:00 2001 From: Oryan Date: Wed, 4 Nov 2026 13:57:02 -0500 Subject: [PATCH 5/7] Say once that verify-tools covers refactors --- AGENTS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d0dd42b2..8ac18f4c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,9 +24,9 @@ Machine-specific Maven JVM flags go in `.mvn/jvm.config` and personal agent rule ## Verifying -Run the `verify-tools` skill (`.claude/skills/verify-tools/SKILL.md`) before you push any change to how the schema is built, -refactors and new or changed warnings included. `mvn verify` runs the library's own tests. The probe builds a schema -through the public API only, the way an app does. Bugfixes and small features stop at this skill. +Run the `verify-tools` skill (`.claude/skills/verify-tools/SKILL.md`) before you push any change to how the schema is built. +`mvn verify` runs the library's own tests. The probe builds a schema through the public API only, the way an app does. +Bugfixes and small features stop at this skill. ## Compatibility From 4b418c4193954c8841a9e80a7bd702e6fbcddd46 Mon Sep 17 00:00:00 2001 From: Oryan Date: Wed, 4 Nov 2026 14:10:35 -0500 Subject: [PATCH 6/7] Clean-build the probe install and exit 64 on bad usage probe.sh install ran mvn install without clean, so a class left in target/ by an earlier build could end up in the jar the probe tests. A missing or unknown scenario exited 1, which the skill documents as a harness failure. The hash falls back to shasum -a 256 where sha256sum is missing. The skill's run block now lists install. Co-Authored-By: Claude Opus 5.5 --- .claude/skills/verify-tools/SKILL.md | 10 ++++++---- .claude/skills/verify-tools/probe.sh | 20 ++++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.claude/skills/verify-tools/SKILL.md b/.claude/skills/verify-tools/SKILL.md index e05f506c..89a3d8e7 100644 --- a/.claude/skills/verify-tools/SKILL.md +++ b/.claude/skills/verify-tools/SKILL.md @@ -18,20 +18,22 @@ and run another checkout's `probe.sh` from inside it. ```bash .claude/skills/verify-tools/probe.sh doctor # checkout, branch, install state, lock .claude/skills/verify-tools/probe.sh list # scenario names +.claude/skills/verify-tools/probe.sh install # clean-build the checkout into the private repo .claude/skills/verify-tools/probe.sh run [--graphql-java ] # build the schema, run every operation .claude/skills/verify-tools/probe.sh clean # remove this checkout's work dir, keep evidence ``` - `run` first installs the checkout into a private Maven repo under `$TMPDIR/verify-tools/work/-/` when the install is missing or stale, meaning HEAD or uncommitted `pom.xml`/`src/` changes differ from the last install. It - reads `~/.m2` but never writes it. The work dir is keyed on the checkout's path, so clones and worktrees run in parallel, - even when two share a folder name. If `doctor` shows the - lock held by a live pid, wait for that run. + reads `~/.m2` but never writes it. The install runs `mvn clean install`, so it empties the checkout's `target/`. Don't + run it while another build uses the same checkout. The work dir is keyed on the checkout's path, so clones and worktrees + run in parallel, even when two share a folder name. If `doctor` shows the lock held by a live pid, wait for that run. - It builds the schema from the scenario's `parser()`, prints it, then executes every `*.graphql` in `probe/src/main/resources/scenarios//` in name order, with `.variables.json` as variables. It collects subscription events until the stream completes, for at most 10 seconds. - Exit `0`: the schema built and every operation ran, though operations can still return GraphQL errors. `2`: the build - threw. `1`: harness failure (install log or `maven.log`). `64`: bad usage. + threw. `1`: harness failure (install log or `maven.log`) or a held lock. `64`: bad usage, such as a missing or unknown + scenario. - `--graphql-java` swaps only the runtime graphql-java, like a user who pins another version. It doesn't recompile the library against it. `--skip-install` runs a stale install on purpose and doesn't count as proof. diff --git a/.claude/skills/verify-tools/probe.sh b/.claude/skills/verify-tools/probe.sh index dc88d731..89dc2afa 100755 --- a/.claude/skills/verify-tools/probe.sh +++ b/.claude/skills/verify-tools/probe.sh @@ -5,7 +5,10 @@ SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO="$(git rev-parse --show-toplevel 2>/dev/null)" || REPO="$(git -C "$SKILL_DIR" rev-parse --show-toplevel)" ROOT="${TMPDIR:-/tmp}" ROOT="${ROOT%/}/verify-tools" -KEY="$(basename "$REPO")-$(printf '%s' "$REPO" | sha256sum | cut -c1-8)" + +sha256() { if command -v sha256sum > /dev/null; then sha256sum; else shasum -a 256; fi; } + +KEY="$(basename "$REPO")-$(printf '%s' "$REPO" | sha256 | cut -c1-8)" WORK="$ROOT/work/$KEY" M2="$WORK/m2" TAIL_M2="$HOME/.m2/repository" @@ -13,6 +16,7 @@ EVIDENCE_ROOT="$ROOT/evidence" STAMP="$WORK/installed.stamp" die() { echo "probe: $*" >&2; exit 1; } +usage_error() { echo "probe: $*" >&2; exit 64; } pom_value() { sed -n "s:.*<$1>\(.*\).*:\1:p" "$REPO/pom.xml" | head -1; } TOOLS_VERSION="$(pom_value version)" @@ -26,7 +30,7 @@ fingerprint() { echo "$file" cat "$REPO/$file" done - } | sha256sum | cut -c1-16 + } | sha256 | cut -c1-16 } installed_jar() { echo "$M2/io/github/graphql-java-kickstart/graphql-java-tools/$TOOLS_VERSION/graphql-java-tools-$TOOLS_VERSION.jar"; } @@ -62,7 +66,7 @@ cmd_install() { fp="$(fingerprint)" log="$WORK/install.log" echo "probe: installing $TOOLS_VERSION from $REPO into $M2 (log: $log)" - if ! (cd "$REPO" && mvn_isolated install -DskipTests > "$log" 2>&1); then + if ! (cd "$REPO" && mvn_isolated clean install -DskipTests > "$log" 2>&1); then grep -E '^\[ERROR\]' "$log" | head -30 >&2 || true die "install failed, see $log" fi @@ -99,12 +103,12 @@ cmd_run() { case "$1" in --graphql-java) gj="$2"; shift 2 ;; --skip-install) skip_install=true; shift ;; - -*) die "unknown option $1" ;; - *) [[ -z "$scenario" ]] || die "one scenario per run"; scenario="$1"; shift ;; + -*) usage_error "unknown option $1" ;; + *) [[ -z "$scenario" ]] || usage_error "one scenario per run"; scenario="$1"; shift ;; esac done - [[ -n "$scenario" ]] || die "usage: probe.sh run [--graphql-java VERSION] [--skip-install]" - cmd_list | grep -qx "$scenario" || die "unknown scenario '$scenario', known: $(cmd_list | tr '\n' ' ')" + [[ -n "$scenario" ]] || usage_error "usage: probe.sh run [--graphql-java VERSION] [--skip-install]" + cmd_list | grep -qx "$scenario" || usage_error "unknown scenario '$scenario', known: $(cmd_list | tr '\n' ' ')" lock local state @@ -168,5 +172,5 @@ case "${1:-}" in list) cmd_list ;; run) shift; cmd_run "$@" ;; clean) cmd_clean ;; - *) echo "usage: probe.sh {doctor|list|install|run [--graphql-java VERSION] [--skip-install]|clean}" >&2; exit 64 ;; + *) usage_error "usage: probe.sh {doctor|list|install|run [--graphql-java VERSION] [--skip-install]|clean}" ;; esac From a3c3861689d3a30939ebdb1424de697f292ce740 Mon Sep 17 00:00:00 2001 From: Oryan Date: Wed, 4 Nov 2026 14:10:42 -0500 Subject: [PATCH 7/7] Make AGENTS.md agree with itself and the repo The layout said one test class per feature or issue, while the judgment rule says to add a variant to the existing class. The f8c7be76 example now says what that commit did: five failure tests folded into one, two dropped. The rule table header no longer claims every row names a failing check or an agent mistake. The jar row names module-info and java.version, the layout lists proxy/, the build command cleans, and a row covers stale classes in target/. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 8ac18f4c..4714eb7a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,15 +6,16 @@ resolver classes. Published to Maven Central. Kotlin, with a few Java files, tar ## Layout - `src/main/kotlin/graphql/kickstart/tools`: `SchemaParser` and its builder and options, `SchemaClassScanner` (matches schema - types to classes), `resolver/` (field resolvers and data fetchers), `directive/`, `relay/`, `util/` -- `src/test/kotlin`: JUnit tests, one class per feature or issue. `EndToEndTest` and `EndToEndSpecHelper` hold the shared schema - and resolvers + types to classes), `resolver/` (field resolvers and data fetchers), `directive/`, `relay/`, `proxy/` (finds the class + behind a Spring, Guice, Weld or Javassist proxied resolver), `util/` +- `src/test/kotlin`: JUnit tests, one class per feature. A test for an issue goes into the class for its feature. + `EndToEndTest` and `EndToEndSpecHelper` hold the shared schema and resolvers - `.claude/skills/verify-tools`: the probe that checks a change from a consuming app's side ## Build and test ```bash -mvn verify +mvn clean verify ``` Compiler warnings fail the build. CI runs `mvn verify` on JDK 17, 21 and 25. A newer local JDK can pass code that fails on @@ -60,7 +61,8 @@ No check can enforce these, so each one names the mistake it prevents. proved scalars pass through unchanged, and none of them did. - **Add a variant to the existing test class and its shared fixtures.** Write one test per behavior and cover variants with a table or a generated matrix, as `NestedGenericWrapperTest` does. Failure: a directive change added a test and - fixtures per variant, and a later commit folded seven of those tests into one (`f8c7be76`). + fixtures per variant. A later commit folded five of the failure tests into one `assertSchemaError` test and dropped two + that repeated other tests (`f8c7be76`). - **Run verify-tools on refactors and warning changes too.** A change called "a refactor" or "only the wording" still changes what an app's schema build does, and the unit tests don't build through the public API alone. Failure: an agent skipped the probe on a scanner rewrite because it was a refactor. @@ -70,8 +72,9 @@ No check can enforce these, so each one names the mistake it prevents. ## Rule table -Each rule comes from a mistake agents made in this repo more than once. The second column names what fails when the rule -is broken. "docs only" means nothing does yet, so the rule depends on you reading it. +Each rule comes from a mistake made in this repo more than once, mostly by agents and in a few cases by older human code. +The second column names what enforces the rule: a check that fails the build, or code or config that keeps the mistake from +happening. "docs only" means nothing does yet, so the rule depends on you reading it. | Rule | Enforced by | |---|---| @@ -99,11 +102,12 @@ is broken. "docs only" means nothing does yet, so the rule depends on you readin | The first commit of a fix tests the neighbouring shapes, not just the reported one | docs only | | The build passes on JDK 17, the lowest supported version | CI on JDK 17, 21 and 25 | | Run verify-tools before you push a schema-building change | docs only | -| The packaged jar matches the pom's module and Java target | docs only | +| The packaged jar holds `module-info.class`, its non-static `requires` resolve from the runtime dependencies, and every class targets the pom's `java.version` | docs only | | Compiler warnings fail the build | `-Werror` and `failOnWarning` in `pom.xml` | | Check every claim in a PR body or release note at the current head | docs only | | Keep a comment only for a non-obvious why, with no history and no issue numbers outside a TODO | docs only | | Build only what was asked | docs only | +| A build you trust starts from an empty `target/`, so no class from an earlier build ships | `clean` in `probe.sh install`, docs only for your own `mvn` runs | | Agent worktrees and local settings stay out of commits | `.gitignore` | | Agent rules live in one committed file | This file. `CLAUDE.md` imports it | | Invalid input that used to build logs a WARN until the next major | docs only |