Skip to content

fix(datamapping): a dynamic finder refuses text after its operator instead of dropping it - #17007

Closed
borinquenkid wants to merge 2 commits into
7.1.xfrom
fix/finder-text-after-operator-7.0.x
Closed

borinquenkid wants to merge 2 commits into
7.1.xfrom
fix/finder-text-after-operator-7.0.x

Conversation

@borinquenkid

Copy link
Copy Markdown
Member

A dynamic finder dropped the text after an operator it did not understand: findAllByAgeGreaterThanOrderByName ran as findAllByAgeGreaterThan and returned the rows unsorted, with no error. DynamicFinder now refuses the name with a message that names the sort and order arguments, which is how a finder is sorted (findAllByAgeGreaterThan(18, [sort: 'name'])). The finders guide says so.

DynamicFinderTextAfterOperatorSpec is a TCK spec: the refusal rows run through the finders of TestEntity with GreaterThan, InList and Like suffixes, and the sort and order arguments sort the finder. It runs on Hibernate 5, the in-memory store and MongoDB.

Full suites on this branch: grails-datamapping-core 252 tests, Hibernate 5 692, in-memory 574, MongoDB 573 (2 workers), 0 failures.

Fixes #14605

https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL

…stead of dropping it

findAllByRankInListOrderByName parsed as rank in a list and silently ignored
OrderByName, on every datastore. calcPropertyName keeps only the text before the
operator, so whatever followed it was lost. Text after an operator is now an
IllegalArgumentException that names the sort and order arguments and listOrderBy*,
which are the documented ways to sort.

Fixes #14605

Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
…say so in the guide

DynamicFinderTextAfterOperatorSpec runs on Hibernate 5, the in-memory store and MongoDB:
an OrderBy suffix after GreaterThan, InList or Like is refused with a message that names
the sort and order arguments, and those arguments sort the finder. The finders guide
says that a finder is sorted with the parameters, not a suffix.

Refs #14605

Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
Copilot AI balanced review requested due to automatic review settings November 15, 2026 01:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@jamesfredley jamesfredley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A dynamic finder with text after its operator is refused. A finder that ends on the operator still runs.

@borinquenkid
borinquenkid changed the base branch from 7.0.x to 7.1.x November 15, 2026 18:18
@borinquenkid

Copy link
Copy Markdown
Member Author

Retargeted from 7.0.x to 7.1.x. A dynamic finder that used to drop text after an operator silently now throws, which can break an application that worked by accident, so it does not fit 7.0.x (the patch branch, bug fixes only). 7.1.x is the lowest minor branch and merges up through 7.2.x to 8.0.x. No code changed (head bb55568) and James's approval stays on it. #17008 is stacked on this branch and follows it.

@borinquenkid

Copy link
Copy Markdown
Member Author

Replaced by #17058 against 7.0.x on a clean branch: a call that contradicts its own name goes to the oldest branch (dev@ rule on fixes that change results), and this branch sat on an older 7.1.x base. Same code, plus an upgrade-guide note. @jamesfredley your approval here does not carry over, so please look at the new one when you can.

https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants