Skip to content

Restore RX GORM compatibility with current core APIs - #16268

Open
jamesfredley wants to merge 3 commits into
8.1.xfrom
fix/rx-criteria-list-8.1.x
Open

Restore RX GORM compatibility with current core APIs#16268
jamesfredley wants to merge 3 commits into
8.1.xfrom
fix/rx-criteria-list-8.1.x

Conversation

@jamesfredley

Copy link
Copy Markdown
Contributor

Summary

  • Remove the accidental List-returning AbstractCriteriaBuilder.list(Closure) overload that conflicts with the established reactive criteria API.
  • Restore per-RxDatastoreClient tenant bindings with nested-scope cleanup, client isolation, and fail-closed fallback to the core tenant holder.
  • Port CountByFinder to the current dynamic-finder query API and verify count projections through public finder invocation.

Validation

  • Full :grails-datamapping-core:test and :grails-datamapping-rx:test suites.
  • :grails-datamapping-rx:codeStyle and repository-wide CodeNarc, Checkstyle, PMD, and SpotBugs aggregation with no violations.
  • Downstream MongoDB, Neo4j, and Hibernate 7 core compilation.
  • External public-surface driver confirming reactive CriteriaBuilder.list(Closure) emits the expected list.
  • Independent goal, code-quality, security, hands-on QA, context, Oracle, and Codex reviews.

Root-wide test note

The full repository aggregate run reached 3,570 integration tests and reported three unrelated example failures: an asynchronous SiteMesh request-recycling failure, a missing Docker environment for one Hibernate/Geb example, and a Selenium page-load timeout in the Spring Security ACL example. It also encountered the existing grails-spring-security-ui:copyTemplates duplicate-entry failure. All affected core and RX suites are green.

@borinquenkid, please review this compatibility repair. It should be merged forward into 9.0.x after landing on 8.1.x.

Remove the accidental criteria list overload that conflicts with the
reactive return type, and update RX tenant and count finder integration
for current datastore APIs.

Assisted-by: opencode:gpt-5.6-sol codegraph
Copilot AI lite review requested due to automatic review settings August 29, 2026 07:56

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.

Pull request overview

This PR restores RxGORM compatibility with the current grails-datamapping-core APIs by removing an accidental criteria overload that changed reactive method dispatch, reintroducing per-RxDatastoreClient tenant bindings (with correct nesting/cleanup and a fail-closed fallback to the core tenant holder), and updating the Rx CountByFinder implementation/tests to use the current dynamic-finder query construction behavior while ensuring count projections execute via the reactive query surface.

Changes:

  • Remove the AbstractCriteriaBuilder.list(Closure) overload so reactive criteria APIs don’t resolve to a blocking/List-returning signature.
  • Rework Rx Tenants to track tenant bindings per RxDatastoreClient, restore nested scopes correctly, and fall back to CurrentTenantHolder (fail-closed when ambiguous).
  • Port Rx CountByFinder to the current DynamicFinder query-building flow and update tests to validate OR parsing and count projection behavior via public invocation.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
grails-datamapping-rx/src/test/groovy/org/grails/gorm/rx/finders/CountByFinderSpec.groovy Updates tests to exercise the public countBy* invocation path, OR parsing, and reactive count projections.
grails-datamapping-rx/src/test/groovy/org/grails/gorm/rx/events/MultiTenantEventListenerSpec.groovy Switches tests to bind Rx tenant context via grails.gorm.rx.multitenancy.Tenants and datastore-client typing.
grails-datamapping-rx/src/test/groovy/grails/gorm/rx/multitenancy/TenantsSpec.groovy Adds coverage for fallback-to-core tenant binding, nested scope restoration, exception cleanup, and per-client isolation.
grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/CountByFinder.groovy Aligns Rx count finder query construction with the current dynamic-finder API and returns a reactive single-result.
grails-datamapping-rx/src/main/groovy/grails/gorm/rx/multitenancy/Tenants.groovy Implements per-client Rx tenant binding with nested-scope cleanup and core-holder fallback behavior.
grails-datamapping-core/src/test/groovy/grails/gorm/CriteriaBuilderSpec.groovy Tightens the core criteria contract expectation to ensure createCriteria().list {} returns a List.
grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/query/criteria/AbstractCriteriaBuilder.java Removes the conflicting list(Closure) overload from the shared criteria base class.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.59459% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.1619%. Comparing base (bb21a3a) to head (2acb285).
⚠️ Report is 139 commits behind head on 8.1.x.

Files with missing lines Patch % Lines
.../groovy/grails/gorm/rx/multitenancy/Tenants.groovy 93.1034% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##                8.1.x     #16268         +/-   ##
===================================================
+ Coverage     29.8834%   55.1619%   +25.2786%     
- Complexity        509      21179      +20670     
===================================================
  Files              79       2140       +2061     
  Lines            4715     102433      +97718     
  Branches          814      18126      +17312     
===================================================
+ Hits             1409      56504      +55095     
- Misses           3063      38074      +35011     
- Partials          243       7855       +7612     
Files with missing lines Coverage Δ
...e/gorm/query/criteria/AbstractCriteriaBuilder.java 64.0719% <ø> (ø)
...vy/org/grails/gorm/rx/finders/CountByFinder.groovy 100.0000% <100.0000%> (ø)
.../groovy/grails/gorm/rx/multitenancy/Tenants.groovy 91.6667% <93.1034%> (ø)

... and 2058 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jamesfredley

Copy link
Copy Markdown
Contributor Author

@borinquenkid I will fix those forge failures separately. We moved forge from Google Cloud to AWS yesterday.

Cherry-picked from 8.0.x commit 6703374 (#16274) so 8.1.x Forge CI
can create startShadowScripts on Gradle 9.6.0.

Shadow 8.3.6's ShadowApplicationPlugin configures the startShadowScripts
task through conventionMapping.map('mainClassName'). Gradle 9 removed the
deprecated CreateStartScripts.mainClassName in favour of the mainClass
Property, so the task can no longer be created and the Forge build fails
at configuration time:

    Could not determine the dependencies of task
    ':grails-forge-web-netty:shadowDistTar'.
    > Could not create task ':grails-forge-web-netty:startShadowScripts'.
       > You can't map a property that does not exist: propertyName=mainClassName

Shadow 8.3.7 backported Gradle 9 support and 8.3.11 is the latest 8.3.x;
the 8.x line is maintenance-only upstream. Generated applications remain
on Shadow 9.2.2.

Assisted-by: Cursor Grok 4.6
@jamesfredley

Copy link
Copy Markdown
Contributor Author

PR #16268 was already up to date with origin/8.1.x. The three Forge CI jobs were failing because 8.1.x still had Shadow 8.3.6, which cannot create startShadowScripts on Gradle 9.6.0.

Cherry-picked the already-merged 8.0.x fix from #16274 (6703374a16) as 2acb2852a2: shadowVersion=8.3.6 -> 8.3.11. Local Forge validation on this branch passed startShadowScripts, shadowDistTar, awsElasticBeanstalk, and both CLI shadow jars. AWS ZIP contains app.jar / Procfile / start.sh / nginx proxy.conf, with Main-Class: org.grails.forge.netty.Application.

This does not include the rest of the 8.0.x line; that remains a separate 8.0.x -> 8.1.x merge.

@jamesfredley jamesfredley mentioned this pull request Aug 30, 2026
16 tasks
@testlens-app

testlens-app Bot commented Sep 3, 2026

Copy link
Copy Markdown

🔎 No tests executed 🔎

🏷️ Commit: 73befd4
▶️ Tests: 0 executed
⚪️ Checks: 2/2 completed


Learn more about TestLens at testlens.app/docs.

@jdaugherty

Copy link
Copy Markdown
Contributor

@jamesfredley there are no changes in this PR to review. Did your merge remove them?

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants