Repository navigation
Separate normalized directive computation from ordinary lookup - #4560
Merged
Merged
Conversation
Contributor
Test ReportTest Results
Code Coverage (Java 25)
Changed Class Coverage (2 classes)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ordinary
QueryDirectiveslookups currently normalize the operation's variables and directive arguments as a side effect. A data fetcher asking for coerced directive values can therefore invoke custom scalarvalueToLiteral()even though it never requests normalized values.Separate the two lazy computations. Ordinary lookups resolve and cache directives using coerced variables.
getNormalizedInputValueByImmediateAppliedDirectives()uses its own thread-safe memoized computation, reuses the resolved applied-directive instances, and requests normalized variables only when needed. Fields without directives return an empty normalized map without evaluating the variable supplier. A normalized conversion failure leaves ordinary directive values available.Keep a direct applied-directive-to-AST map for later normalization, replacing the intermediate bidirectional maps. Preserve repeatable directive ordering and ordinary argument defaults. When directives are present but normalized variables are unavailable (including ENOF operations created from coerced variables), the normalized getter throws
AssertExceptionwith a descriptive message instead of silently returning an empty map. This prevents the ENF-to-AST compiler from silently omitting directive arguments when normalization is unavailable. Ordinary directive lookups remain available. Correct the Javadoc that previously described normalized directive arguments as ENOF-only. Raw-variable ENOF creation itself continues to normalize variables as before.Spock coverage checks all six ordinary getters, both lookup orders, cache and instance reuse, repeatable directives across merged fields, empty fields, literal arguments with the builder’s default empty variables, conversion failure isolation, unavailable normalized variables on the coerced-variable ENOF path, and a real execution path with a custom scalar. The seven targeted ordinary-lookup regression cases fail against the original implementation; the focused directive/normalized-operation suite passes with this change.
Full local Java 25 validation passed:
./gradlew assemble test testng check javadoc jacocoTestReport. The final builder test also passed in the focused suite. The assertion follow-up passed all 440 focused directive/normalized-operation tests and Javadoc. All 10 CI checks passed on the final commit, including the Java 17/21/25 test suites and per-class coverage gate. The coverage baseline is unchanged. No benchmark timing claim is made.