← 输入框|github.com|刷新
Skip to content

Preserve AST definitions across schema transformations - #4513

Merged
andimarek merged 1 commit into
masterfrom
codex/preserve-ast-definitions
Oct 27, 2026
Merged

andimarek merged 1 commit into
masterfrom
codex/preserve-ast-definitions

Conversation

@andimarek

Copy link
Copy Markdown
Member

Copying enum values, applied directives, and applied directive arguments currently drops their AST definitions, even with an empty transform callback. Schema copy builders also drop the schema definition, and SchemaTransformer drops both the schema definition and extensions when rebuilding a changed schema.

Preserve this metadata consistently across copy builders, transform, copy, and withNewChildren, including both schema transformer variants. Retain the original AST nodes by reference; callers can explicitly replace or clear them. Document that runtime edits do not rewrite the original source AST.

Also populate custom scalar extension definitions from the SDL registry when captureAstDefinitions is enabled, and clear them when it is disabled, matching the other type definitions.

Regression tests cover all 13 AST-bearing schema element classes, schema copying and nested transformations, explicit clearing, unchanged source names after runtime renaming, and scalar capture with and without metadata supplied by wiring.

Validation:

  • Focused schema and transformation suite: 168 tests passed.
  • ./gradlew check javadoc passed (5,861 test cases, no failures; includes shaded-JAR verification and consumer compilation).

@github-actions

Copy link
Copy Markdown
Contributor

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 6051 (+39 🟢) 5995 (+39 🟢) 0 (±0) 0 (±0) 56 (±0)
Java 17 6051 (+39 🟢) 5994 (+39 🟢) 0 (±0) 0 (±0) 57 (±0)
Java 21 6051 (+39 🟢) 5994 (+39 🟢) 0 (±0) 0 (±0) 57 (±0)
Java 25 6051 (+39 🟢) 5994 (+39 🟢) 0 (±0) 0 (±0) 57 (±0)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 24236 (+156 🟢) 24009 (+156 🟢) 0 (±0) 0 (±0) 227 (±0)

Code Coverage (Java 25)

Metric Covered Missed Coverage vs Master
Lines 30205 3085 90.7% +0.1% 🟢
Branches 8860 1510 85.4% +0.1% 🟢
Methods 8070 1188 87.2% +0.2% 🟢

Changed Class Coverage (17 classes)

Class Line Branch Method
g.e.i.d.PerLevelDataLoaderDispatchStrategy
$ChainedDLStack
+2.4% 🟢 +4.2% 🟢 ±0.0%
g.s.GraphQLAppliedDirective +5.9% 🟢 ±0.0% +12.5% 🟢
g.s.GraphQLAppliedDirective
$Builder
+0.3% 🟢 ±0.0% ±0.0%
g.s.GraphQLAppliedDirectiveArgument +6.1% 🟢 ±0.0% +10.5% 🟢
g.s.GraphQLArgument +1.6% 🟢 ±0.0% +3.1% 🟢
g.s.GraphQLEnumType +1.2% 🟢 ±0.0% +2.7% 🟢
g.s.GraphQLEnumValueDefinition +2.4% 🟢 ±0.0% +4.2% 🟢
g.s.GraphQLEnumValueDefinition
$Builder
+0.3% 🟢 ±0.0% ±0.0%
g.s.GraphQLInputObjectField +1.8% 🟢 ±0.0% +3.4% 🟢
g.s.GraphQLInputObjectType +1.8% 🟢 ±0.0% +3.1% 🟢
g.s.GraphQLInterfaceType +1.6% 🟢 ±0.0% +3.4% 🟢
g.s.GraphQLScalarType +9.3% 🟢 ±0.0% +12.5% 🟢
g.s.GraphQLUnionType +1.8% 🟢 ±0.0% +3.8% 🟢
g.s.i.SchemaGeneratorAppliedDirectiveHelper ±0.0% +6.9% 🟢 ±0.0%
g.s.i.SchemaGeneratorHelper ±0.0% +0.7% 🟢 ±0.0%
g.s.SchemaTransformer
$DummyRoot
+0.1% 🟢 ±0.0% ±0.0%
g.s.v.AppliedDirectiveArgumentsAreValid +5.1% 🟢 +4.5% 🟢 ±0.0%

Full HTML report: build artifact jacoco-html-report

Updated: 2026-10-27 00:03:07 UTC

@andimarek
andimarek merged commit 7d659bc into master Oct 27, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant