Repository navigation
Assert in the TCK that where-query closures are rewritten into criteria - #16876
Merged
Merged
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
jamesfredley
approved these changes
Nov 6, 2026
jamesfredley
left a comment
Contributor
There was a problem hiding this comment.
The TCK assertions match the existing where-query transformer. Null comparisons become isNull and isNotNull, and value comparisons map to the matching criteria. No production code changes.
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
Replaces #16825, which sat on top of a chain of PRs. This branch has only this change, on 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.