borinquenkid opened a new pull request, #16876:
URL: https://github.com/apache/grails-core/pull/16876

   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-tck` has `grails-datamapping-core` on its compile 
classpath (`api project(':grails-datamapping-core')`), which carries the 
`GlobalDetachedCriteriaASTTransformation` service entry.
   - The compiled closure of `WhereQueryIssueVerificationSpec` calls 
`isNull("bar")`: `bar == null` was rewritten into a criterion.
   - That spec already asserts counts that only hold when the rewrite happened 
(untransformed, the closure builds no criterion and `where { bar == null 
}.count()` returns every row, not 0).
   - I scanned the TCK and `grails-datamapping-core-test` for `where` closures 
inside Spock `then:` and `expect:` 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 == null` is `IsNull`, `bar != null` is 
`IsNotNull`, and `==`, `!=`, `>`, `<` with a value are `Equals`, `NotEquals`, 
`GreaterThan`, `LessThan` on `bar` with 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`, 
`validateRepositoryConventions` and `rat` pass. No production code changes.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to