You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "jdaugherty (via GitHub)" <gi...@apache.org> on 2026/06/30 16:04:55 UTC
[PR] Fix inheritance of an explicit bindable:true constraint on id/version declared in an abstract @DirtyCheck base [grails-core]
jdaugherty opened a new pull request, #15796:
URL: https://github.com/apache/grails-core/pull/15796
## Description
When an abstract base class — for example a `@DirtyCheck` class in `src/main/groovy` — declares an
explicit `bindable: true` constraint on one of the default-excluded special properties
(`id`, `version`, `dateCreated`, `lastUpdated`), a concrete domain subclass that does not redeclare
the constraint failed to inherit it. The property was silently excluded from data binding even though
the parent explicitly opted it in.
This is a regression introduced by the fix for #15681 (PR #15699).
### Root cause
PR #15699 added a filter in `DefaultASTDatabindingHelper.getPropertyNamesToIncludeInWhiteList` that
strips the default-excluded special properties from the *inherited* parent whitelist for any domain
class. That correctly stops GORM-injected `id`/`version` from leaking out of a non-domain `@DirtyCheck`
base, but the filter was unconditional: it could not distinguish a special property that landed in the
parent whitelist *by default* from one the parent made bindable via an *explicit* `bindable: true`
constraint. As a result the explicit constraint was discarded.
### Fix
The helper now tracks which excluded-by-default special properties were made bindable via an explicit
constraint, propagates that set down the inheritance hierarchy, and only skips an inherited special
property when it was **not** explicitly opted in:
- The #15681 behavior is preserved — special properties that only landed in a non-domain parent's
whitelist by default are still not inherited.
- A subclass `bindable: false` override still wins over an inherited `bindable: true`.
### Tests
- **Unit** (`DefaultASTDatabindingHelperDomainClassSpecialPropertiesSpec`): an explicit `bindable: true`
on `id` declared in a `@DirtyCheck` abstract base is inherited by the domain subclass (this case fails
without the fix), and a subclass `bindable: false` override beats the inherited `bindable: true`.
- **Functional** (`grails-test-examples-gorm` / `DirtyCheckBindingSpec`): a new `@DirtyCheck` base
(`AbstractBindableIdRecord`) opting `id` into binding, an inheriting domain class (`BindableIdRecord`),
a controller action, and an end-to-end HTTP assertion that the inherited `id` is bound while `version`
remains unbound.
Fixes #15795
## Contributor Checklist
### Issue and Scope
- [x] This PR is linked to an existing issue that has been **acknowledged or approved** by the project team. <!-- replace #15795 above with the ticket you created -->
- [x] This PR addresses the **complete scope** of the linked issue.
- [x] This PR contains a **single, focused change**.
- [x] This PR targets the **correct branch** for the type of change:
- **Patch release branches** (e.g., `7.0.x`): Bug fixes only. No new features or API changes.
### Code Quality
- [x] I have **added or updated tests** that cover the changes introduced in this PR.
- [x] I have verified that all existing tests pass by running `./gradlew build --rerun-tasks`. <!-- run before pushing -->
- [x] My code follows the project's **code style** guidelines. I have run `./gradlew codeStyle` and resolved any violations.
- [x] This PR does **not** include mass reformatting, style-only changes, or large-scale refactoring.
- [x] If generative AI tooling was used in preparing this contribution, a quality model was used to ensure contributions are **consistent with the project's quality standards**.
### Licensing and Attribution
- [x] All contributed code is provided under the Apache License 2.0, and new source files include the appropriate **Apache license header**.
- [x] I have the necessary rights to submit this contribution and confirm it is my own original work.
- [x] If generative AI tooling was used in preparing this contribution, I have followed the ASF's policy on generative tooling and have properly attributed its use.
### Documentation
- [x] If this PR introduces user-facing changes, I have included or updated the relevant documentation. <!-- N/A: restores previously documented bindable-constraint inheritance behavior; no doc change required -->
- [x] If this PR adds a new feature, I have updated the **What's New** section of the Grails Guide. <!-- N/A: bug fix, not a feature -->
- [x] If this PR introduces breaking changes or changes that require user action during an upgrade, I have updated the **Upgrade Notes**. <!-- N/A: no breaking change -->
- [x] The PR description clearly explains **what** was changed and **why**.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix inheritance of an explicit bindable:true constraint on id/version declared in an abstract @DirtyCheck base [grails-core]
Posted by "sbglasius (via GitHub)" <gi...@apache.org>.
sbglasius merged PR #15796:
URL: https://github.com/apache/grails-core/pull/15796
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix inheritance of an explicit bindable:true constraint on id/version declared in an abstract @DirtyCheck base [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #15796:
URL: https://github.com/apache/grails-core/pull/15796#issuecomment-4846012182
## ✅ All tests passed ✅
🏷️ Commit: ef1202fc70ce6c78b74783d754fbe3bd9b04a9bc
▶️ Tests: 12539 executed
⚪️ Checks: 34/34 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix inheritance of an explicit bindable:true constraint on id/version declared in an abstract @DirtyCheck base [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #15796:
URL: https://github.com/apache/grails-core/pull/15796#issuecomment-4846875804
@jamesfredley I've added the test you suggested (and also updated the issue number in comments)
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix inheritance of an explicit bindable:true constraint on id/version declared in an abstract @DirtyCheck base [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #15796:
URL: https://github.com/apache/grails-core/pull/15796#issuecomment-4847242615
## ✅ All tests passed ✅
🏷️ Commit: b38bd689be7438f0ff65617a479e16aff47c0d3f
▶️ Tests: 30589 executed
⚪️ Checks: 33/33 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org