Repository navigation
Run the bounded return value unwrapping check in mvn verify - #946
Merged
Merged
Conversation
ReturnValueUnwrappingTest compiles the check from src/test/resources/returnvalue and fails the build when a resolver return type the schema build accepts doesn't reach graphql-java fully unwrapped. The verify-return-value-unwrapping skill's check.sh now runs that test, with its options passed as -Dunwrapping.args.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why
Agents working in graphql-java-tools keep repeating the same mistakes, and the repo should change so a change that looks right from one file is right for the whole repo. Return value unwrapping is one of those spots. A change to
ReturnValueUnwrapperor the generic wrappers can pass every unit test and still hand graphql-java aCompletableFutureor anOptionalfor a return type nobody wrote a test for. The bounded check that catches this was a local skill you had to remember to run, which is how theOptional<DataFetcherResult<...>>bug got found after the fact.Description
ReturnValueUnwrappingTestruns the check at its default bounds (3 containers deep, 2 non-default choices per value) inmvn verify, so every PR and CI job on 17, 21 and 25 runs it. That's 171,693 executions over 2,649 accepted return typesCheck.javaandFixtures.javalive insrc/test/resources/returnvalue/and the test compiles them when it runs. The test classes run inside thegraphql.java.toolsmodule, which doesn't readjava.compiler, so it calls javac throughjava.util.spi.ToolProviderfromjava.base. They load in their own class loader and the temp dir is deleted after the runverify-return-value-unwrappingskill is committed and itscheck.shnow runs that test, with the same options (--depth,--budget,--show,--rejected) and exit codes. So there's one copy of the checkknown-findings.txtmoved next to the check and is empty. A finding listed there still passes the build, and one that no longer fails makes it fail asSTALECost is about 15s per build on JDK 25 on my machine. On 17 it took 32s inside a full
mvn verify, but the machine had a load average around 45 from other builds at the time, so I'd take that number with a grain of salt.No release note, nothing changes for library users.
Checklist
Pull requests follows the contribution guide
New or modified functionality is covered by tests
mise exec java@temurin-17.0.21+9 -- mvn -B -ntp clean verifypasses, 441 tests, and the new test reports171693 executionsandPASSat
3f022b91(the parent of theOptional<DataFetcherResult<...>>fix), withLaterremoved sincewithCompletionStageTransformerdoesn't exist there yet,check.shexits 1 withFAIL: 357 executions in 29 return types. All 29 areOptional<DataFetcherResult<...>>. Unchanged, the check doesn't compile there andcheck.shexits 2 withMODEL ERRORa known finding that no longer fails makes
check.shexit 3 withSTALE