Re-enable grails-datamapping-rx module - #16135
Conversation
The module was disabled in settings.gradle (and gradle/publish-root-config.gradle, which independently gated GrailsPublishExtension registration) pending a port to the current Grails release. This restores it to the active build: - Fix RxSchedule.java: an @interface illegally declared a `default` annotation member with a method body instead of a constant default value, and referenced a removed GroovyTransformOrder constant (RX_SCHEDULE -> RX_SCHEDULER_ORDER). - Fix grails.gorm.rx.DetachedCriteria.clone(): illegally narrowed visibility from the inherited public AbstractDetachedCriteria.clone(). - Fix RxEntity.groovy: missing `import rx.Observable`. - Fix RxScheduleIOTransformation.groovy: same stale GroovyTransformOrder constant reference (RX_SCHEDULE_IO_ORDER -> RX_SCHEDULER_ORDER). - Fix FindByFinder/FindAllByFinder (rx): both called a 3-arg buildQuery(...) overload that no longer exists after the finders' Groovy->Java conversion; inlined the query-building steps (applyAdditionalCriteria/applyDetachedCriteria/ configureQueryWithArguments/getJunction) that the current 2-arg buildQuery performs internally, using the query the finder already creates via RxDatastoreClient instead of a Session. - Bring the module's Checkstyle and CodeNarc compliance up to date with the rest of the codebase (it had never been checked while disabled). Compiles, and its test suite passes (8/8). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Re-enables the grails-datamapping-rx module in the Gradle build/publish configuration and updates the module’s source to compile against the current Grails/Groovy APIs while meeting current linting rules.
Changes:
- Re-added
grails-datamapping-rxtosettings.gradleand root publishing configuration. - Updated AST transformation + RxGORM code to align with current Graovy/Grails constants and finder/query building APIs.
- Applied broad Checkstyle/CodeNarc-driven formatting/import cleanups across the module.
Reviewed changes
Copilot reviewed 50 out of 56 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| settings.gradle | Re-includes grails-datamapping-rx in the multi-project build. |
| gradle/publish-root-config.gradle | Re-enables publishing for grails-datamapping-rx. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/transform/RxScheduleIOTransformation.groovy | Updates transformation ordering constant + formatting/import cleanup. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/transform/RxAstUtils.groovy | Formatting/lint updates; string literal normalization. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/services/support/RxServiceSupport.groovy | Removes unused import to satisfy linting. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/services/implementers/SingleResultAdapter.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/services/implementers/ObservableServiceImplementerAdapter.groovy | Removes unused import + formatting. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/services/implementers/ObservableResultAdapter.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/FindOrSaveByFinder.groovy | Formatting/lint updates (semicolon removal). |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/FindOrCreateByFinder.groovy | Removes unused import + formatting around Rx chain/subscribers. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/FindByFinder.groovy | Replaces removed buildQuery(...) overload by inlining query configuration steps. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/FindByBooleanFinder.groovy | Formatting/lint updates; simplifies visibility/semicolons. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/FindAllByFinder.groovy | Mirrors FindByFinder query configuration changes for “findAllBy”. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/FindAllByBooleanFinder.groovy | Formatting/lint updates; simplifies visibility/semicolons. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/CountByFinder.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/events/ValidationEventListener.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/events/MultiTenantEventListener.groovy | Updates assignability checks + formatting; tweaks exception message formatting. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/events/DomainEventListener.groovy | Formatting/lint updates (semicolons removed). |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/events/AutoTimestampEventListener.groovy | Formatting/lint updates (semicolons removed). |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/config/Settings.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/api/multitenancy/TenantDelegatingRxGormOperations.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/api/RxGormValidationApi.groovy | Formatting/lint updates; whitespace and argument cleanup. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/api/RxGormStaticApi.groovy | Formatting/lint updates; string literal normalization & whitespace fixes. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/api/RxGormInstanceApi.groovy | Removes unused import. |
| grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/api/RxGormEnhancer.groovy | Formatting/lint updates; minor string literal changes. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/query/RxQueryUtils.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/query/RxQuery.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/query/QueryState.groovy | Removes redundant empty constructor; formatting changes. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/proxy/RxJavassistProxyFactory.java | Import ordering + formatting updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/proxy/QueryObservableProxyMethodHandler.java | Import ordering + formatting updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/proxy/ProxyFactory.java | Import ordering. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/proxy/IdentifierObservableProxyMethodHandler.java | Removes unused import + import ordering/formatting. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/proxy/IdQueryObservableProxyMethodHandler.java | Import ordering + formatting updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/proxy/AbstractObservableProxyMethodHandler.java | Import ordering + formatting updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/internal/RxDatastoreClientImplementor.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/collection/RxPersistentSortedSet.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/collection/RxPersistentSet.groovy | Removes unused imports + formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/collection/RxPersistentList.groovy | Removes unused imports + formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/collection/RxCollectionUtils.groovy | Formatting/lint updates (switch formatting). |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/collection/RxCollection.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/batch/BatchOperation.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/RxDatastoreClientAware.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/RxDatastoreClient.groovy | Removes unused import + formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/AbstractRxDatastoreClient.groovy | Replaces wildcard event imports + formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/services/RxSchedule.java | Fixes invalid annotation default member; updates transform order constant usage. |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/multitenancy/Tenants.groovy | Formatting/lint updates; string literal normalization. |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/collection/RxPersistentCollection.java | Removes unused imports. |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/collection/ObservableCollection.java | Import ordering + formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/api/RxGormStaticOperations.groovy | Formatting/lint updates (whitespace cleanup). |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/api/RxGormOperations.groovy | Removes unused import + formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/api/RxGormInstanceOperations.groovy | Formatting/lint updates (whitespace cleanup). |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/api/RxGormAllOperations.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/RxEntity.groovy | Adds missing rx.Observable import; formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/MultiTenant.groovy | Formatting/lint updates. |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/DetachedCriteria.groovy | Fixes clone() visibility; formatting updates. |
| grails-datamapping-rx/src/main/groovy/grails/gorm/rx/CriteriaBuilder.groovy | Formatting/lint updates (semicolons/whitespace). |
Suppressed comments (5)
grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/FindOrCreateByFinder.groovy:1
- The
onError(Throwable e)handler signalsonCompleted()instead of propagating the error. This will silently swallow persistence failures and may leave downstream subscribers believing the create/save succeeded. ChangeonErrorto calls.onError(e)(or explicitly handle/transform the error if the intended behavior is to treat errors as empty).
grails-datamapping-rx/src/main/groovy/org/grails/datastore/rx/query/QueryState.groovy:48 - This is a check-then-act update on a
ConcurrentHashMap. Under concurrency, two threads can both seenull, create separate maps, and the laterput(type, loadedByType)can overwrite the earlier one (losing entries). Use an atomic initialization pattern (e.g.,computeIfAbsent/putIfAbsent) to ensure per-type maps are created once and updates aren’t dropped.
void addLoadedEntity(Class type, Serializable id, Object object) {
def loadedByType = loadedEntities.get(type)
if (loadedByType == null) {
loadedByType = new ConcurrentHashMap<Serializable, Object>()
loadedByType.put(id, object)
loadedEntities.put(type, loadedByType)
}
else {
loadedByType.put(id, object)
}
}
grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/api/RxGormEnhancer.groovy:1
- This
containsKey+putsequence is non-atomic and can race under concurrent initialization. Prefer usingputIfAbsent(orcomputeIfAbsentif you need to derive the value) so only the first initializer wins without redundant writes.
grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/FindByFinder.groovy:1 - This inlined query-configuration sequence is duplicated (also appears in the Rx
FindAllByFinder). To reduce drift risk if these steps change again, consider extracting a small shared helper (e.g.,configureQueryFromInvocation(invocation, javaClass, query)) or delegating to a single overridden method in a common base for the Rx finders.
grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/events/MultiTenantEventListener.groovy:1 - The error message has a grammatical typo: use 'Could not assign tenant id …' instead of 'Could not assigned tenant id …'. Consider also simplifying punctuation near 'id!:' to keep the message readable.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
✅ All tests passed ✅🏷️ Commit: 131b769 Learn more about TestLens at testlens.app. |
Summary
defaultannotation member with a method body instead of a constant, and referenced a removed GroovyTransformOrder constantimport rx.ObservableTest plan
:grails-datamapping-rx:compileGroovy— BUILD SUCCESSFUL:grails-datamapping-rx:test— 8/8 passing:grails-datamapping-rx:codeStyle— Checkstyle + CodeNarc both clean🤖 Generated with Claude Code