Repository navigation
fix(hibernate5): a setting keeps the entities without the association for an association block in or - #16931
fix(hibernate5): a setting keeps the entities without the association for an association block in or#16931borinquenkid wants to merge 17 commits into
Conversation
…ther branch matches Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
…e entities without the association The criteria guide documents an association block inside or as one branch: accounts that have either performed transactions OR were recently created. The block was an inner join, so an account without transactions was dropped before the other branch could match it. A block that has no join type of its own, inside an or, is now a left join. Fixes #16924 Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
jamesfredley
left a comment
There was a problem hiding this comment.
Not approving. An association block that accepts a null now matches an entity that has no association. A later explicit inner join also reuses that left join.
…ociated entity A null test in the block matched the entities without the association, because the left join gives null for the missing one. The block now also requires the id of the joined alias. The shared block cases skip Neo4j until #16836 is merged. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
jamesfredley
left a comment
There was a problem hiding this comment.
A null test in an association block no longer matches an entity that has no association. Thread PRRT_kwDOAAfRJ862Qfia resolved. Not approving. An empty association block no longer requires the association, and a later inner join reuses the left join.
…uires an associated entity, and an empty block does too A block outside an or that reuses the left join of a block in one no longer returns the entities without the association, and an empty block in an or keeps requiring an associated entity of the whole entity, as its inner join did.
jamesfredley
left a comment
There was a problem hiding this comment.
An empty association block requires the association again, and a later inner join no longer reuses the left join as if the child were optional. Threads PRRT_kwDOAAfRJ862VrVg and PRRT_kwDOAAfRJ862VrVl resolved. Not approving. A later block that asks for a left join is treated as if it required the child.
…r not an or joined the association with a left join
or { child {...}; eq(...) }; child(LEFT_JOIN) { isNull('name') } keeps the entity without a child, as the left join the
second block asked for does.
jamesfredley
left a comment
There was a problem hiding this comment.
A later block that asks for a left join keeps that left join. Not approving. A later block that asks for an inner join still reuses the left join.
| // a block that is a branch of an "or" asks for an associated entity, and so does a block that | ||
| // reuses the left join of one, as a block outside an "or" always did | ||
| // (a join type the caller named is kept as the caller named it) | ||
| final boolean requiresAssociated = branchOfOr || (!hasMoreThanOneArg && leftBlockAliases.contains(blockAlias)); |
There was a problem hiding this comment.
or { child { eq('name', 'kid') }; eq('name', 'orphan') }; child(CriteriaSpecification.INNER_JOIN) { isNull('name') }, where orphan has no child. The list returns orphan. The later block asked for an inner join. Require the child.
…and is no branch of an or CriteriaOrAssociationBlockSpec expects an association block without criteria to leave out the entities that have no associated entity, and to add no branch to the or it stands in, as on the datastores that join. The in-memory store matched nothing for the block and let the other branch of the or find the orphan. The block is now skipped as a branch and the whole result is restricted to the entities that have an associated entity. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
| // a block that is a branch of an "or" asks for an associated entity, and so does a block that | ||
| // reuses the left join of one, as a block outside an "or" always did | ||
| // (a join type the caller named is kept as the caller named it) | ||
| final boolean requiresAssociated = branchOfOr || (!hasMoreThanOneArg && leftBlockAliases.contains(blockAlias)); |
There was a problem hiding this comment.
with has a child named kid. orphan has no child. or { child { eq('name', 'kid') }; eq('name', 'orphan') } then child(INNER_JOIN) {} should return only with. It returns with and orphan. The second block reuses the left join from the or, and the extra argument turns off the existence check. Keep the inner join when the caller asks for one.
…d a block in an or of a detached criteria keeps its left join
child(INNER_JOIN) { } after an or reused the left join the or had made for the same association and, as it named a join
type, skipped the existence check, so an entity without the association stayed in the result; a block that names an
inner join asks for an associated entity now. The query path of a detached criteria had no rule for a block that is a
branch of an or at all, so an entity without the association dropped out of the or, an empty block did not ask for an
associated entity and a block after the or did not either; it makes a left join for such a block, checks for an
associated entity as criteria does, and does not count a negation as an or. CriteriaOrAssociationBlockSpec runs
each row through criteria and through a detached criteria, and has the explicit join type rows.
Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
@jamesfredley Fixed in the new commit. Your case. The same rule through the other entry point. I ran every row of that spec through a detached criteria as well, and four of the eight earlier rows failed there: the query path used by detached criteria had no rule for a block that is a branch of an The H5 module (705 tests), the in-memory store and |
…nd a path a block repeats keeps one join
getOrCreateAlias reused the join of any earlier block of the same name whenever the block came with an alias, which a
block of a detached criteria always does, so dam { sire { ... } } filtered on the join of the root sire block and
returned nothing, and a second dam.sire block asked Hibernate for the same association path twice and failed with
a duplicate association path. The join made for the very path of the block is reused now, and a join made for the
same name under another path is not. The pedigree shapes of CriteriaNestedShapesSpec are checked through a detached
criteria as well, with the repeated nested blocks; the blocks that are branches of an or stay on criteria until #16931.
Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
…d criteria The detached criteria path keeps a left join for a block that is a branch of an or since #16931 (merged into this branch), so the three shapes that were checked through criteria only are checked through both. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
jamesfredley
left a comment
There was a problem hiding this comment.
Requested changes. An explicit inner join after one or is kept. The same join inside a second or still lets an entity without the association through.
| } | ||
| else if (requiresAssociated) { | ||
| // a missing associated entity is a null that a null test in the block would match | ||
| logicalExpression.args.add(0, Restrictions.isNotNull(blockAlias + ".id")); |
There was a problem hiding this comment.
with has a child named kid. orphan has no child. An or that asks for the child, then a second or with child(0), should return only with. It returns with and orphan. The existence check sits inside the second or, so the name branch bypasses it. Keep that check on the whole query.
…ation on the whole query A block that names an inner join and reuses the left join of a block in an earlier or kept its existence check inside its own expression, so a branch of the second or that does not mention the association bypassed it. The caller asked for an inner join, so the check is on the whole query, as for a block without criteria. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
…an or Ten shapes of a block that follows an or asking for the child: at the top level, as a branch of a second or, and in a not, each with a plain, an inner join and a left join block, and with and without criteria. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
jamesfredley
left a comment
There was a problem hiding this comment.
Requested changes. An explicit inner join inside an or still lets an entity without the association through when an earlier block joined it.
| final boolean explicitInnerJoin = hasMoreThanOneArg && | ||
| joinType == org.hibernate.sql.JoinType.INNER_JOIN.getJoinTypeValue(); | ||
| final boolean requiresAssociated = branchOfOr || | ||
| (leftBlockAliases.contains(blockAlias) && (!hasMoreThanOneArg || explicitInnerJoin)); |
There was a problem hiding this comment.
An earlier manager block joins manager. Then two or blocks follow, and the second asks for manager as an inner join. orphan, who has no manager, still comes back. The earlier join is not recorded, so the inner join reuses it and adds no check. Keep orphan out.
|
@jamesfredley I ran your manager shape. The orphan comes back when the association points at its own class (manager is an Employee), and plain 7.0.x returns the same results, so the PR did not change it. The block is joined with a left join by the "same table" rule and nothing records it. The same shapes on an association to another class are correct on this head: an empty block that names an inner join asks for the association on the whole query. I filed it as #17113 and kept it out of this PR. |
…ation after a default left join on the entity's own class, and the note for the or branch Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
James, found it. The entity has an association of its own class, like your |
Port the left join of an association block in an or onto the deferred joins: createJoin makes the join of an or branch a left join unless the query asks for another type. Three base specs pinned the inner join of an or branch; they now expect the rows an or branch keeps. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
Refreshed against 7.0.x after the merge-up (merge commit ce1ec87). The base now makes joins when the query runs (deferred joins), so the left join of an association block in an Three specs that came in with the merge-up pinned the inner join of an or branch, which is the result this PR changes, so I changed their expectations rather than the fix:
Verified on ce1ec87: H5 core 1406 tests, 0 failures; datamapping-core-test 585, 0 failures; codeStyle clean. With the fix reverted, 12 specs fail. This changes a result on 7.0.x, so it needs two approvals. |
matrei
left a comment
There was a problem hiding this comment.
First round, at ce1ec87. The branch merges cleanly with 7.0.x at ffd848b. CI hasn't run: the no ci label skipped all 30 checks.
I ran the 46 queries of my review of #16930 at this head and on 7.0.x:
- with Hibernate 5;
- with the in-memory store, plus seven blocks without criteria.
The fixture:
- the teams
ArsenalandPlayerlessplay for the clubArsenal,ChelseaandSquadforChelsea, andMUforManchester United; - the teams
UnattachedandEmptyhave no club; Squadhas the playersSquad A,Squad BandSquad C,PlayerlessandEmptyhave none, and the other teams have one each;- the club
Teamlesshas no team, and the playerFree Agenthas no team.
I agree with the fix. The criteria guide describes the or as either branch, and the in-memory store already returns the new rows for every query in the first table. Apart from the to-many rows below, #16930 returns the same rows with Hibernate 7.
The fix changes a result, so #17061 applies
| 7.0.x | This head | |
|---|---|---|
Team.createCriteria().list { or { club { eq('name', 'Arsenal') }; eq('name', 'Unattached') } }, also as a detached criteria, with count(), and with max: 10 and its totalCount |
Arsenal, Playerless |
Arsenal, Playerless, Unattached |
Team.where { club.name == 'Arsenal' || name == 'Unattached' }.list(), also with club { name == 'Arsenal' } |
Arsenal, Playerless |
Arsenal, Playerless, Unattached |
or { isNull('club'); club { eq('name', 'Arsenal') } } |
Arsenal, Playerless |
also Unattached and Empty |
not { or { club { eq('name', 'Arsenal') }; eq('name', 'MU') } } |
Chelsea, Squad |
also Unattached and Empty |
Player.createCriteria().list { or { team { eq('name', 'Squad') }; eq('name', 'Free Agent') } } |
the three players of Squad |
also Free Agent |
Team.createCriteria().get { or { club { eq('name', 'Teamless') }; eq('name', 'Empty') } } |
null |
Empty |
borinquenkid's comment of 11-28 says that this changes a result on 7.0.x and needs two approvals. Under "Fixes That Change a Result" in CONTRIBUTING.md, it's also a wrong result that many applications get:
- an association block in an
or, and a where query with||over an association, are common queries; - no other query API of Hibernate 5 returns the new rows yet: the where query returns the old ones too.
So it needs a setting:
- Default: off on 7.0.x, 7.1.x, 7.2.x and 8.0.x, on from 8.1.0, and removed in 9.0.0.
- Key: the same as in #16930, which makes the same fix for Hibernate 7. This branch is the fix for the oldest branch with the bug, so it goes first.
- Warning: a warning at startup when an application sets the setting to keep the old rows.
It also needs:
- the description to say which results change, how an application gets the old ones, and why there's a setting;
- a row in
compatibilitySettings.adoc; - an issue for each of the two later steps.
The note and the skill entry are there. They speak only of a block in a criteria query, though. The where query changes too, as the expectation that the merge changed in AssociationJoinTypeSpec shows, so the note should name it.
A collection holds only the elements that the block matches
The left join of a block on a collection makes Hibernate fetch the collection from the rows of the join, and the block's criterion has left out the other elements:
| 7.0.x | This head | |
|---|---|---|
Team.createCriteria().list { or { players { eq('name', 'Squad A') }; eq('name', 'Empty') } }, also as a where query players.name == 'Squad A' || name == 'Empty' |
Squad, its players not loaded |
Squad, holding only Squad A, and Empty |
or { club { eq('name', 'Arsenal') }; players { eq('name', 'Squad A') } } |
Arsenal, Squad |
also Playerless, and Squad holds only Squad A |
- Why it matters: the session keeps that
Squaduntil it's cleared, so the rest of the request sees a team with one player. - Not new for an explicit left join: a block that names one,
players(1) { eq('name', 'Squad A') }, does the same on 7.0.x. - New for a block without a join type: this branch makes it the default for a block in an
or. - Hibernate 7 at #16930: it doesn't load the collection there.
For a collection, a restriction with a subquery would keep the instances without elements and fill no collection. On 7.0.x, a join type requested for a path that ends in a collection, or passes through one, already restricts the query that way. A test for this case should check the elements of the collection that the query returns.
A not with more than one criterion
The code doesn't count the criteria of a not as branches of an or ("they are not branches of an or: a block in one keeps its join"). But not { a; b } means not (a or b), and the two forms differ at this head:
| 7.0.x | This head | In-memory store, both | |
|---|---|---|---|
not { or { club { eq('name', 'Arsenal') }; eq('name', 'MU') } } |
Chelsea, Squad |
Chelsea, Squad, Unattached, Empty |
Chelsea, Squad, Unattached, Empty |
not { club { eq('name', 'Arsenal') }; eq('name', 'MU') } |
Chelsea, Squad |
the same as on 7.0.x | Chelsea, Squad, Unattached, Empty |
I'd treat a not of more than one criterion as an or, here and in #16930. If not, the note should say that only or keeps the entities without the association.
The in-memory store
The change to SimpleMapQuery changes what the in-memory store returns for a block without criteria. So the unit tests of an application that use the store can get other rows:
| 7.0.x | This head | |
|---|---|---|
Team.createCriteria().list { club { } }, also in and or or, and as a detached criteria |
no team | the 5 teams with a club |
Team.createCriteria().list { players { } } |
no team | the 5 teams with players |
or { club { }; eq('name', 'Unattached') } |
Unattached |
no team |
club { }; or { club { eq('name', 'Chelsea') }; eq('name', 'Unattached') }, also with club { } after the or |
no team | Chelsea, Squad |
These are now the rows of Hibernate 5, which is the right direction for a store that unit tests use in place of Hibernate. The description and the note should say so.
Smaller points
- The open #16853 parts: this branch conflicts with #17070 to #17073 in
AbstractHibernateCriteriaBuilder.java. They're ahead in the queue, so this branch will need another merge with 7.0.x after them, and I'll run the rows again then. - The earlier reviews' points that I ran:
or { club { isNull('name') }; eq('name', 'nobody') }returns nothing;or { club(0) { eq('name', 'Arsenal') }; eq('name', 'Unattached') }keeps the inner join;club { }before or after theorstill requires the club.
- James's case on an association to its own class: #17113 has it, as the comment of 11-21 says.
What I ran
- Hibernate 5: at this head and on 7.0.x (ffd848b).
- The in-memory store: in
grails-datamapping-core-test, at the same two heads. - Hibernate 7: for the comparison with #16930, at d6fa6db.
As a fix that changes a result, this needs a second approval under #17061.
….leftJoinAssociationInOr, and fill no partial collection A block in an or that joins its association with a left join changes the result of queries that many applications run, so it is behind a setting that is off by default. The left join of a collection for such a block is restricted, so Hibernate does not fill the collection with only the elements that the block matches. Add the setting to the compatibility page, the upgrade note for 7.2.6 and the upgrade skill. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
…ows of a block on the entity's own class A criteria block on an association of the entity's own class is left-joined without the setting and asks for no associated entity. With the setting it was asked for one as a branch of an or, so the query lost rows. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
@matrei Thanks, done in 4fb4be1 and cca0a1f.
https://github.com/apache/grails-core/blob/cca0a1f4f2/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateQuery.java#L642-L644 |
✅ All tests passed ✅🏷️ Commit: cca0a1f Learn more about TestLens at testlens.app/docs. |
matrei
left a comment
There was a problem hiding this comment.
Second round, at cca0a1f:
The branch merges cleanly with 7.2.x at a19d39f. CI passed with run ci.
I ran the 66 queries of my second review of #16930, with the same fixture. I also ran seven on an association of the entity's own class: Employee has a manager, and the employees are boss, worker (managed by boss) and orphan. I ran them:
- with Hibernate 5 at this head, with
grails.gorm.leftJoinAssociationInOrunset andtrue, on 7.2.x (a19d39f) and on 7.0.x (6e69247); - with Hibernate 7 at #16930 (91a18da), with the setting unset and
true.
I also ran the 53 queries of my first review on the in-memory store, at this head and on 7.2.x.
Fixed
-
The setting:
- it has the same key as #16930, the startup warning, the compatibility settings row, the upgrade note and the skill entry;
- #17210 and #17211 are the later steps;
- with the setting unset, this head returns the rows of 7.2.x for 72 of the 73 queries.
The one that differs is a change that the note lists under "with or without the setting":
or { club(1) { eq('name', 'Arsenal') }; eq('name', 'Unattached') }; club { isNull('name') }returns no team, where 7.2.x returnsUnattached. -
The same rows as #16930: with
true, this head returns what #16930 returns withtrue, for each query that both modules can run. The exceptions are:- the differences between the two modules that they have without the setting too;
- the join type of a detached block, which my review of #16930 asks to leave to an issue for both modules;
- the block on the entity's own class below.
-
A collection holds all of its elements:
or { players { eq('name', 'Squad A') }; eq('name', 'Empty') }, its where form andor { club { eq('name', 'Arsenal') }; players { eq('name', 'Squad A') } }don't load the players ofSquadany more. At ce1ec87,Squadheld onlySquad A.CriteriaOrAssociationSettingSpecreads the elements. -
The where query and the in-memory store: both are in the note and the description. The in-memory store returns the rows of my first review for the blocks without criteria.
-
A
notwith more than one criterion: the note says that only anorkeeps the entities without the association.
The base branch
borinquenkid's comment of 11-28 moves this to 7.2.x, because "After the 2026-11-25 releases the 7.x line takes fixes on 7.2.x only." There were no such releases:
- the votes on 7.0.18, 7.1.8 and 7.2.5 were cancelled, and the latest tags are v7.0.17, v7.1.7 and v7.2.4;
- 7.0.x still takes fixes: #17194 and #17207 were merged there on 11-28, and the open parts of #16853 target it;
- I know of no decision on dev@ to stop fixes on 7.0.x and 7.1.x.
Under "Choosing the Branch" in CONTRIBUTING.md, the fix goes to the oldest release branch that has the bug, with the setting off on 7.0.x, 7.1.x, 7.2.x and 8.0.x. 7.0.x returns the same rows as 7.2.x for all 73 queries, so it has the bug. So I'd move this back to 7.0.x:
- The branch: it has 7.2.x merged in now, so it needs to be built again from 7.0.x, for example from ce1ec87 with 7.0.x merged in and the two new commits on top.
- The notes: the note goes under 7.0.18 in
upgrading60x.adoc, and the skill entry into its 7.0.18 part. - The version:
@since, the compatibility settings row and its link say 7.0.18, and the table in the description starts at 7.0.x. #16930 says@since 7.2.6inConnectionSourceSettingstoo.
Even on 7.2.x, the next release is 7.2.5, not 7.2.6. The note opens a 7.2.6 section after the 7.2.5 section, and 7.2.5 hasn't been released.
A not inside an or
This is the same point as in my review of #16930. With true, a block in a not that is inside an or keeps the entities without the association. The same not outside an or leaves them out. So the or returns a team that neither of its branches returns:
| Unset | true |
|
|---|---|---|
Team.createCriteria().list { not { club { eq('name', 'Arsenal') } } } |
Chelsea, MU, Squad |
Chelsea, MU, Squad |
Team.createCriteria().list { or { not { club { eq('name', 'Arsenal') } }; eq('name', 'Empty') } } |
Chelsea, MU, Squad |
Chelsea, Empty, MU, Squad, Unattached |
Unattached has no club and isn't named Empty. I'd put the existence check of such a block outside the not: club.id is not null and not (club.name = 'Arsenal'). The or then returns Chelsea, Empty, MU and Squad. If not, the note should say that a block in a not keeps the entities without the association inside an or, but not outside one.
Smaller points
-
A block on the entity's own class: with
true, the two pull requests differ for a null test in such a block:7.2.x and this head, unset This head, true#16930, trueEmployee.createCriteria().list { manager { isNull('name') } }boss,orphanboss,orphanboss,orphanEmployee.createCriteria().list { or { manager { isNull('name') }; eq('name', 'orphan') } }boss,orphanboss,orphanorphanthe same as a detached criteria no employee orphanorphanThis branch keeps the left join that Hibernate 5 gives such a block in a criteria query, which asks for no manager (#17113). Leaving it to #17113 is fine, but #17113 should say that the two modules differ here with the setting. #17113 isn't only Hibernate 5's either: on 8.0.x, Hibernate 7 also returns
bossandorphanformanager { isNull('name') }. -
Merging up: this branch has the shared specs and the in-memory store change, which #17188 adds on 8.0.x. The in-memory change is the same in both, but
CriteriaOrAssociationBlockSpecdiffers:- this branch's version turns the setting on through the
configurationmap of the Hibernate 5 TCK manager, which the Hibernate 7 manager doesn't have; - #17188's version turns it on through
grailsConfigand skips Hibernate 5.
The merge up to 8.0.x needs a spec that sets the setting for both managers and runs with both modules.
- this branch's version turns the setting on through the
-
The open #16853 parts: this branch conflicts with #17070 to #17073 in
AbstractHibernateCriteriaBuilder.java, and with #17072 and #17073 inAbstractHibernateQuery.javatoo. So it needs another merge after them, as the description says, and I'll run the rows again then.
What I ran
- Hibernate 5: at this head, with the setting unset and
true, on 7.2.x (a19d39f) and on 7.0.x (6e69247). - Hibernate 7: at #16930 (91a18da), with the setting unset and
true, and on 8.0.x (42951ae). - The in-memory store: in
grails-datamapping-core-test, at this head and on 7.2.x.
As a fix that changes a result, this needs a second approval under #17061.
|
@matrei You are right about the releases: my comment of 11-28 was wrong. The votes on 7.0.18, 7.1.8 and 7.2.5 were cancelled, and 7.0.x still takes fixes. I moved this back to 7.0.x as #17234. It is a new pull request, because moving this branch would have meant a force push.
|
An association block inside
or { }is one branch of the disjunction. The criteria guide documents it that way: "all accounts that have either performed transactions in the last 10 days OR have been recently created in the last 10 days". The block is an inner join, so an account without transactions is dropped before the other branch can match it. A where query with||over an association does the same.Results that change, and the setting
Association blocks in
orare common, and no other query API of Hibernate 5 returns the new rows, so under "Fixes That Change a Result" inCONTRIBUTING.mdthe fix is behind a setting,grails.gorm.leftJoinAssociationInOr:false, today's resultstrue(planned)Setting it to
falseexplicitly logs a startup warning naming Grails 9.With
true:or, in a criteria query, a detached criteria or a where query with||, is a left join: the instances without the association are found by the other branches, also bycountand thetotalCountof a paged list.orand a block directly in anotrequire the association as before. In a criteria query, a block on an association of the entity's own class, left-joined by default, keeps its rows as before. Anotis not treated as anor, because the criteria builder joins a block as it enters it, before it knows how many criteria thenotholds.With or without the setting:
To keep the previous results of an
or, leave the setting unset.Tests
CriteriaOrAssociationSettingSpec(Hibernate 5) runs a to-one association, a collection and a collection in a join table through a criteria query, a detached criteria, a where query,countand a paged list, with the setting unset,falseandtrue, and reads the collections of the instances returned. The unset andfalserows for those queries also pass on plain 7.2.x.CriteriaOrAssociationSpecandCriteriaOrAssociationBlockSpec(MongoDB skipped, it has no association blocks) run the block rows; on Hibernate 5 with the setting.HibernateDatastoreSpecpins the warning.grails-data-hibernate5-core,grails-datamapping-core-test,grails-datastore-core,grails-core,grails-data-mongodb-coreandcodeStylepass.CriteriaOrAssociationBlockSpecalso runs on Neo4j and passes there with #16836, so merge #16836 first. The open parts of #16853 touch the same builder, so this needs another merge after them.Fixes #16924
Evidence and the doc passage: #16924 (comment)
https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL