Skip to content

merge: 7.1.x into 7.2.x - #16314

Merged
sbglasius merged 9 commits into
7.2.xfrom
merge/7.1.x-into-7.2.x
Sep 4, 2026
Merged

sbglasius merged 9 commits into
7.2.xfrom
merge/7.1.x-into-7.2.x

Conversation

@sbglasius

Copy link
Copy Markdown
Contributor

jamesfredley and others added 9 commits September 2, 2026 20:50
FormFieldsTemplateService memoized findTemplate on BeanPropertyAccessor
instances, which retain request beans and values. Cache by candidate
template paths instead so distinct accessors of the same property share
one lookup and request objects can be collected.

Fixes #16162
The regression for #16162 used TestBean from PlainObjectPropertyAccessorSpec.
Keep the spec self-contained with a local non-domain fixture instead.
Fix fields template lookup leak from accessor-keyed memoization
`gradle/actions/setup-gradle@50e97c2` (v6.1.0) is not on the ASF
allowlist, so every workflow that used it — CI, Code Style, End to End,
Coverage, RAT, Vulnerability Scan, the Groovy canary and the release
workflows — failed at startup before any job ran:

    The action gradle/actions@50e97c2
    is not allowed in apache/grails-core because all actions must be
    from a repository owned by your enterprise, created by GitHub, or
    match one of the patterns: ...

Move it to `9c971963` (v6.3.0), the current approved entry with no
expiry date. v6.1.1 is also approved but expires 2026-09-05.

Also, so the same class of failure does not come back:

- `aws-actions/configure-aws-credentials` → v6.2.3 (`e6de0542`). The
  v6.2.0 pin it replaces expires from the allowlist on 2026-09-20.
- SHA-pin the three floating `actions/*` refs left in
  `vulnerability-scan.yml` and the twelve `actions/cache@v4` refs in
  `gradle.yml`, matching the versions already used everywhere else in
  the repo. These are allowed by namespace, so they were not breaking
  anything, but CLAUDE.md asks for SHA pins for supply-chain
  consistency.

`apache/grails-github-actions/*@asf` is left on the branch ref
deliberately — it is the ASF-owned, intentionally floating pin.

Approved SHAs verified against
https://github.com/apache/infrastructure-actions/blob/main/actions.yml
…ices package (#16156)

* Add unit test coverage for DefaultTenantService/DefaultTransactionService

Both classes had zero test coverage in org.grails.datastore.gorm.services.
Mock-based Spock specs cover all public methods including the
multi-tenancy-mode/datastore-capability branch checks, bringing each
class to 100% line/branch/method coverage.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add coverage for update/delete-where/projection service implementers

Covers DSL shapes with zero or partial coverage: UpdateOneImplementer,
DeleteWhereImplementer, FindOneInterfaceProjectionWhereImplementer,
FindAllPropertyProjectionImplementer, FindOnePropertyProjectionImplementer,
the findById(id) shortcut in FindOneByImplementer, and the
AbstractWriteOperationImplementer enhance() path for abstract-class
services with pre-existing concrete write methods.

Fixes a real bug found while writing the invalid-argument test for
AbstractSaveImplementer: the error path referenced
newMethodNode.declaringClass.module (null on the synthesized
implementation method), crashing the compiler with a NullPointerException/
GroovyBugError instead of reporting a clean compile error. Changed to
abstractMethodNode.declaringClass.module.context, matching the pattern
used elsewhere in this package (e.g. FindAllByImplementer).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Suppress IntelliJ warnings on getDetachedCriteriaType's unused parameter

domainClassNode is intentionally unused in the base implementation; the
method is a protected extension point so subclasses can pick a different
DetachedCriteria type per domain class. No current subclass overrides it,
but making the method static or dropping the parameter would remove that
polymorphic extension point.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Suppress IntelliJ warnings on AbstractWhereImplementer's getDetachedCriteriaType

Same shape as the AbstractDetachedCriteriaServiceImplementor fix: the
unused domainClassNode parameter is a protected extension point for
subclasses, not dead code.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Suppress MethodMayBeStatic on lookupById(), which is polymorphic

AbstractProjectionImplementer overrides lookupById() to return false,
and doImplement() dispatches on it via virtual call. Making it static
would silently break that override rather than just being unnecessary,
so it's suppressed with an explanation instead of "fixed".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Remove unused newMethodNode parameter from bindParametersAndSave

The parameter became dead after the earlier error-reporting fix (which
now uses abstractMethodNode instead of the buggy newMethodNode-based
lookup). No subclass overrides this method and it has only two call
sites, both updated. Unlike the getDetachedCriteriaType/lookupById
warnings, this parameter has no polymorphic purpose, so it's removed
rather than suppressed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Remove dead transactionalDatastore/transactionService/findInstanceApiForConnectionId

None of these three protected helpers have any call site anywhere in
the repo (core, rx, hibernate5/7, mongodb) and nothing overrides them,
unlike the earlier getDetachedCriteriaType/lookupById extension points.
findInstanceApiForConnectionId's live sibling, findStaticApiForConnectionId,
is actively used by 5 implementers, but the instance-API equivalent was
never wired up the same way -- every save/delete implementer builds that
lookup by hand instead. Drops the now-unused TransactionService/
TransactionCapableDatastore imports too.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Suppress unused-parameter warnings on FindOneImplementer.findMethodToInvoke

Same shape as the earlier getDetachedCriteriaType/lookupById fixes:
domainClassNode/newMethodNode are unused in the base 'find' return, but
the method is a protected extension point on a class with real subclasses
(FindAndDeleteImplementer, FindOneInterfaceProjectionImplementer), so the
parameters are kept and the warning is suppressed rather than the
signature changed.

Also includes minor pre-existing IDE cleanups picked up in this pass:
ClassHelper.VOID_TYPE.equals(x) -> == in DeleteImplementer/
DeleteWhereImplementer, and using the already-statically-imported
AstUtils.error instead of the fully-qualified call in FindAllByImplementer.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Suppress unused-parameter warnings on getFindMethodToInvoke

Same shape as FindOneImplementer.findMethodToInvoke: classNode/methodNode
are unused in the base implementation, but the method is a protected
extension point and FindOneStringQueryImplementer has a real subclass
(FindOneInterfaceProjectionStringQueryImplementer), so the parameters
stay and the warning is suppressed instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Deduplicate interface-projection property compatibility check

isInterfaceProjection()'s per-property compatibility loop was copy-pasted
almost verbatim between InterfaceProjectionBuilder and
IterableInterfaceProjectionBuilder (only the candidate type variable name
differed). Extracted into a shared hasCompatibleProperties(domainClass,
candidateType) method on the base trait; the iterable variant now just
resolves its generic type and delegates. Drops the now-unused
AstPropertyResolveUtils import from IterableInterfaceProjectionBuilder.

Also fixes a cast IntelliJ's stricter Groovy static checker rejects in
buildInterfaceImpl: casting a List<ConstantExpression> (from .collect{})
directly to List<Expression> is generics-invariant-illegal even though
groovyc accepts it. Uses the double-cast-through-raw-List trick already
established elsewhere in this codebase for the same class of warning.

Both isInterfaceProjection() variants and buildInterfaceImpl() are
already exercised by ServiceTransformSpec's existing interface/iterable
projection tests; full module suite + codeStyle pass unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Replace array range-slice with Arrays.copyOfRange in UpdateOneImplementer

parameters[1..-1] as Parameter[] relies on Groovy's range-slicing getAt
on an array; IntelliJ's stricter @CompileStatic checker infers the 1..-1
literal as ObjectRange<Integer> and can't resolve a matching
DefaultGroovyMethods.getAt overload for it, even though groovyc compiles
it fine. Arrays.copyOfRange(parameters, 1, parameters.length) expresses
the same "drop the first parameter" intent unambiguously for both
compilers, with no cast needed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Close the two real Codecov patch-coverage gaps from this PR

DeleteWhereImplementer.isCompatibleReturnType and
AbstractServiceImplementer.isValidParameter each had one branch missing
on lines Codecov flagged. Added a compile-error test for a @where delete
method with an incompatible (non-void, non-Number) return type, and a
save-with-id-named-parameter test that exercises isValidParameter's
GormProperties.IDENTITY branch directly (SaveImplementer, unlike
UpdateOneImplementer, doesn't strip the id parameter before validating
it). Both branches now fully covered.

The third flagged line, FindAllByImplementer's matchSpec == null error
path, was verified empirically rather than assumed unreachable: a probe
test with an edge-case DSL input (findAllBy() with no property suffix)
showed doesImplement() already computes the identical memoized matchSpec
before selecting this implementer, so doImplement() can never observe a
null matchSpec -- the method falls through to FindAllImplementer instead
whenever matchSpec would be null. Genuinely unreachable through the
public DSL, not a gap.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
ci: pin every action to an ASF-approved SHA
* origin/7.0.x:
  Add test coverage and fix real bugs in grails-datamapping-core's services package (#16156)
  ci: pin every action to an ASF-approved SHA
  Give TemplateLookupCachingSpec its own command fixture
  Fix fields template lookup leak from accessor-keyed memoization
* origin/7.1.x:
  Add test coverage and fix real bugs in grails-datamapping-core's services package (#16156)
  ci: pin every action to an ASF-approved SHA
  Give TemplateLookupCachingSpec its own command fixture
  Fix fields template lookup leak from accessor-keyed memoization
@sbglasius
sbglasius merged commit 5075ff3 into 7.2.x Sep 4, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants