Repository navigation
Assert in the TCK that where-query closures are rewritten into criteria - #16825
Closed
borinquenkid wants to merge 10 commits into
Closed
borinquenkid wants to merge 10 commits into
borinquenkid wants to merge 10 commits into
Conversation
WhereTransformAppliedSpec reads the criteria a where query holds, so a TCK build that loses the where-query AST transformation fails by name instead of passing on results alone. Fixes #16810
This was referenced Nov 3, 2026
Member
Author
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.
Fixes #16810
Stacked on #16824 (chain: #16816, #16817, #16818, #16820, #16821, #16822, #16823, #16824).
no ciuntil the chain reaches 8.0.x.What I found
The issue says the TCK sources are compiled without the where-query AST transformation. On 8.0.x they are not:
grails-datamapping-tckhasgrails-datamapping-coreon its compile classpath (api project(':grails-datamapping-core')), which carries theGlobalDetachedCriteriaASTTransformationservice entry.WhereQueryIssueVerificationSpeccallsisNull("bar"):bar == nullwas rewritten into a criterion.where { bar == null }.count()returns every row, not 0).grails-datamapping-core-testforwhereclosures inside Spockthen:andexpect:blocks, where Spock's condition rewriting runs before the where transformation and drops the criterion. There are none.So no build change is needed. The risk the issue describes is real if the dependency is ever lost, so this PR adds an explicit guard.
Changes
WhereTransformAppliedSpec(TCK, runs in every datastore module) reads the criteria a where query holds:bar == nullisIsNull,bar != nullisIsNotNull, and==,!=,>,<with a value areEquals,NotEquals,GreaterThan,LessThanonbarwith that value. It also checks the criteria exist when the query is declared, before any datastore call.Tests
7 tests, passing on MongoDB, Neo4j and Hibernate 7.
codeStyle,validateRepositoryConventionsandratpass. No production code changes.