Skip to content

feat: wire MongoDB adapter to GormRegistry O(M+N) scaling#15783

Closed
borinquenkid wants to merge 1 commit into
feat/gorm-registry-h5from
feat/gorm-registry-mongodb
Closed

feat: wire MongoDB adapter to GormRegistry O(M+N) scaling#15783
borinquenkid wants to merge 1 commit into
feat/gorm-registry-h5from
feat/gorm-registry-mongodb

Conversation

@borinquenkid

Copy link
Copy Markdown
Member

Summary

Wires the MongoDB adapter into the GormRegistry introduced in #15780.

  • MongoGormApiFactory — factory that creates MongoDB-typed static, instance, and validation API instances for MongoDatastore
  • MongoGormInstanceApi — MongoDB-specific instance API wired through the registry
  • MongoTransactionTemplateFactory / MongoGormTransactionTemplate / MongoTransactionContext — pluggable transaction template for MongoDB sessions
  • MongoStaticApi — updated to source its datastore resolver from the registry
  • Unit tests: MongoGormApiFactorySpec, MongoGormInstanceApiSpec, GormRegistryScalabilitySpec, MongoTenantContextProfilingSpec, MongoGormTransactionTemplateSpec, MongoTransactionTemplateFactorySpec

Test plan

  • ./gradlew :grails-data-mongodb:test passes
  • TCK suite passes with MongoDB datastore

Stack

🤖 Generated with Claude Code

@borinquenkid borinquenkid force-pushed the feat/gorm-registry-h5 branch from c9a86d8 to 112af9d Compare June 27, 2026 17:36
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-mongodb branch from 59e2f00 to 371b1c9 Compare June 27, 2026 17:36
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-h5 branch from 112af9d to 964143d Compare June 27, 2026 18:14
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-mongodb branch from 371b1c9 to cf60629 Compare June 27, 2026 18:14
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-h5 branch from 964143d to 22a1b06 Compare June 27, 2026 20:46
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-mongodb branch from cf60629 to 6d7070a Compare June 27, 2026 20:46
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-h5 branch from 22a1b06 to 1f3125e Compare June 27, 2026 22:03
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-mongodb branch from 6d7070a to a597040 Compare June 27, 2026 22:03
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-h5 branch from 1f3125e to cc888a0 Compare June 27, 2026 22:23
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-mongodb branch from a597040 to 4e0ed09 Compare June 27, 2026 22:23
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-h5 branch from cc888a0 to 532480b Compare June 27, 2026 22:58
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-mongodb branch from 4e0ed09 to 6504e90 Compare June 27, 2026 22:58
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-h5 branch 2 times, most recently from 8294745 to c71045d Compare June 28, 2026 00:53
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-mongodb branch from 6504e90 to 84a342e Compare June 28, 2026 00:53
Register MongoDB GORM APIs with GormRegistry in MongoGormEnhancer and update
MongoStaticApi, affected MongoDB tests and TCK specs to use the registry-based
API path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-h5 branch from c71045d to bde6eff Compare June 28, 2026 01:35
@borinquenkid borinquenkid force-pushed the feat/gorm-registry-mongodb branch from 84a342e to d4c2ea1 Compare June 28, 2026 01:36
@testlens-app

testlens-app Bot commented Jun 28, 2026

Copy link
Copy Markdown

🚨 TestLens detected 38 failed tests 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

CI / Build Grails-Core (macos-latest, 21) > :grails-data-graphql-core:test

Test Runs
CreateEntityDataFetcherSpec > test get
DeleteEntityDataFetcherSpec > test get
DeleteEntityDataFetcherSpec > test get invalid
EntityDataFetcherSpec
SingleEntityDataFetcherSpec
SoftDeleteEntityDataFetcherSpec
UpdateEntityDataFetcherSpec > test get
UpdateEntityDataFetcherSpec > test optimistic locking
UpdateEntityDataFetcherSpec > test optimistic locking with null version

CI / Build Grails-Core (ubuntu-latest, 21) > :grails-data-graphql-core:test

Test Runs
CreateEntityDataFetcherSpec > test get
DeleteEntityDataFetcherSpec > test get
DeleteEntityDataFetcherSpec > test get invalid
EntityDataFetcherSpec
SingleEntityDataFetcherSpec
SoftDeleteEntityDataFetcherSpec
UpdateEntityDataFetcherSpec > test get
UpdateEntityDataFetcherSpec > test optimistic locking
UpdateEntityDataFetcherSpec > test optimistic locking with null version

CI / Build Grails-Core (ubuntu-latest, 21) > :grails-datamapping-core:test

Test Runs
GormEnhancerAllQualifiersSpec > registerEntity can resolve through injected registry without touching global singleton

CI / Build Grails-Core (ubuntu-latest, 25) > :grails-data-graphql-core:test

Test Runs
CreateEntityDataFetcherSpec > test get
DeleteEntityDataFetcherSpec > test get
DeleteEntityDataFetcherSpec > test get invalid
EntityDataFetcherSpec
SingleEntityDataFetcherSpec
SoftDeleteEntityDataFetcherSpec
UpdateEntityDataFetcherSpec > test get
UpdateEntityDataFetcherSpec > test optimistic locking
UpdateEntityDataFetcherSpec > test optimistic locking with null version

CI / Build Grails-Core Rerunning all Tasks (ubuntu-latest, 21) > :grails-data-graphql-core:test

Test Runs
CreateEntityDataFetcherSpec > test get
DeleteEntityDataFetcherSpec > test get
DeleteEntityDataFetcherSpec > test get invalid
EntityDataFetcherSpec
SingleEntityDataFetcherSpec
SoftDeleteEntityDataFetcherSpec
UpdateEntityDataFetcherSpec > test get
UpdateEntityDataFetcherSpec > test optimistic locking
UpdateEntityDataFetcherSpec > test optimistic locking with null version

CI / Build Grails-Core Rerunning all Tasks (ubuntu-latest, 21) > :grails-datamapping-core:test

Test Runs
GormEnhancerAllQualifiersSpec > registerEntity can resolve through injected registry without touching global singleton

🏷️ Commit: d4c2ea1
▶️ Tests: 6942 executed
⚪️ Checks: 39/39 completed

Test Failures (first 10 of 38)

CreateEntityDataFetcherSpec > test get (:grails-data-graphql-core:test in CI / Build Grails-Core (macos-latest, 21))
java.lang.NullPointerException: Cannot invoke "org.grails.datastore.mapping.services.ServiceRegistry.getService(java.lang.Class)" because "datastore" is null
	at org.grails.gorm.graphql.fetcher.DefaultGormDataFetcher.withTransaction(DefaultGormDataFetcher.groovy:133)
	at org.grails.gorm.graphql.fetcher.impl.CreateEntityDataFetcher.get(CreateEntityDataFetcher.groovy:46)
	at org.grails.gorm.graphql.fetcher.impl.CreateEntityDataFetcherSpec.test get(CreateEntityDataFetcherSpec.groovy:42)
DeleteEntityDataFetcherSpec > test get (:grails-data-graphql-core:test in CI / Build Grails-Core (macos-latest, 21))
java.lang.NullPointerException: Cannot invoke "org.grails.orm.hibernate.AbstractHibernateDatastore.getConnectionSources()" because the return value of "groovy.lang.Reference.get()" is null
	at org.grails.orm.hibernate.AbstractHibernateGormStaticApi.withNewSession(AbstractHibernateGormStaticApi.groovy:118)
	at org.grails.datastore.gorm.GormEntity$Trait$Helper.withNewSession(GormEntity.groovy:1140)
	at org.grails.gorm.graphql.fetcher.impl.DeleteEntityDataFetcherSpec.test get(DeleteEntityDataFetcherSpec.groovy:53)
DeleteEntityDataFetcherSpec > test get invalid (:grails-data-graphql-core:test in CI / Build Grails-Core (macos-latest, 21))
Too few invocations for:

1 * getArgument('id') >> 95   (0 invocations)

Unmatched invocations (ordered by similarity):

None

Too few invocations for:

1 * getMergedField()   (0 invocations)

Unmatched invocations (ordered by similarity):

None


	at org.spockframework.mock.runtime.InteractionScope.verifyInteractions(InteractionScope.java:110)
	at org.spockframework.mock.runtime.MockController.leaveScope(MockController.java:95)
	at org.grails.gorm.graphql.fetcher.impl.DeleteEntityDataFetcherSpec.test get invalid(DeleteEntityDataFetcherSpec.groovy:74)
EntityDataFetcherSpec (:grails-data-graphql-core:test in CI / Build Grails-Core (macos-latest, 21))
java.lang.IllegalStateException: No PlatformTransactionManager set
	at org.springframework.util.Assert.state(Assert.java:80)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
	at grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:115)
	at org.grails.datastore.gorm.GormStaticApi.withTransaction(GormStaticApi.groovy:687)
	at org.grails.datastore.gorm.GormStaticApi.withNewTransaction(GormStaticApi.groovy:649)
	at org.grails.datastore.gorm.GormEntity$Trait$Helper.withNewTransaction(GormEntity.groovy:1063)
	at org.grails.gorm.graphql.fetcher.impl.EntityDataFetcherSpec.setupSpec(EntityDataFetcherSpec.groovy:32)
SingleEntityDataFetcherSpec (:grails-data-graphql-core:test in CI / Build Grails-Core (macos-latest, 21))
java.lang.IllegalStateException: No PlatformTransactionManager set
	at org.springframework.util.Assert.state(Assert.java:80)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
	at grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:115)
	at org.grails.datastore.gorm.GormStaticApi.withTransaction(GormStaticApi.groovy:687)
	at org.grails.datastore.gorm.GormStaticApi.withNewTransaction(GormStaticApi.groovy:649)
	at org.grails.datastore.gorm.GormEntity$Trait$Helper.withNewTransaction(GormEntity.groovy:1063)
	at org.grails.gorm.graphql.fetcher.impl.SingleEntityDataFetcherSpec.setupSpec(SingleEntityDataFetcherSpec.groovy:35)
SoftDeleteEntityDataFetcherSpec (:grails-data-graphql-core:test in CI / Build Grails-Core (macos-latest, 21))
java.lang.IllegalStateException: No PlatformTransactionManager set
	at org.springframework.util.Assert.state(Assert.java:80)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
	at grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:115)
	at org.grails.datastore.gorm.GormStaticApi.withTransaction(GormStaticApi.groovy:687)
	at org.grails.datastore.gorm.GormStaticApi.withNewTransaction(GormStaticApi.groovy:649)
	at org.grails.datastore.gorm.GormEntity$Trait$Helper.withNewTransaction(GormEntity.groovy:1063)
	at org.grails.gorm.graphql.fetcher.impl.SoftDeleteEntityDataFetcherSpec.setupSpec(SoftDeleteEntityDataFetcherSpec.groovy:36)
UpdateEntityDataFetcherSpec > test get (:grails-data-graphql-core:test in CI / Build Grails-Core (macos-latest, 21))
java.lang.NullPointerException: Cannot invoke "org.grails.datastore.mapping.services.ServiceRegistry.getService(java.lang.Class)" because "datastore" is null
	at org.grails.gorm.graphql.fetcher.DefaultGormDataFetcher.withTransaction(DefaultGormDataFetcher.groovy:133)
	at org.grails.gorm.graphql.fetcher.impl.UpdateEntityDataFetcher.get(UpdateEntityDataFetcher.groovy:48)
	at org.grails.gorm.graphql.fetcher.impl.UpdateEntityDataFetcherSpec.test get(UpdateEntityDataFetcherSpec.groovy:48)
UpdateEntityDataFetcherSpec > test optimistic locking (:grails-data-graphql-core:test in CI / Build Grails-Core (macos-latest, 21))
java.lang.NullPointerException: Cannot invoke "org.grails.datastore.mapping.services.ServiceRegistry.getService(java.lang.Class)" because "datastore" is null
	at org.grails.gorm.graphql.fetcher.DefaultGormDataFetcher.withTransaction(DefaultGormDataFetcher.groovy:133)
	at org.grails.gorm.graphql.fetcher.impl.UpdateEntityDataFetcher.get(UpdateEntityDataFetcher.groovy:48)
	at org.grails.gorm.graphql.fetcher.impl.UpdateEntityDataFetcherSpec.test optimistic locking(UpdateEntityDataFetcherSpec.groovy:69)
UpdateEntityDataFetcherSpec > test optimistic locking with null version (:grails-data-graphql-core:test in CI / Build Grails-Core (macos-latest, 21))
java.lang.NullPointerException: Cannot invoke "org.grails.datastore.mapping.services.ServiceRegistry.getService(java.lang.Class)" because "datastore" is null
	at org.grails.gorm.graphql.fetcher.DefaultGormDataFetcher.withTransaction(DefaultGormDataFetcher.groovy:133)
	at org.grails.gorm.graphql.fetcher.impl.UpdateEntityDataFetcher.get(UpdateEntityDataFetcher.groovy:48)
	at org.grails.gorm.graphql.fetcher.impl.UpdateEntityDataFetcherSpec.test optimistic locking with null version(UpdateEntityDataFetcherSpec.groovy:88)
CreateEntityDataFetcherSpec > test get (:grails-data-graphql-core:test in CI / Build Grails-Core (ubuntu-latest, 21))
java.lang.NullPointerException: Cannot invoke "org.grails.datastore.mapping.services.ServiceRegistry.getService(java.lang.Class)" because "datastore" is null
	at org.grails.gorm.graphql.fetcher.DefaultGormDataFetcher.withTransaction(DefaultGormDataFetcher.groovy:133)
	at org.grails.gorm.graphql.fetcher.impl.CreateEntityDataFetcher.get(CreateEntityDataFetcher.groovy:46)
	at org.grails.gorm.graphql.fetcher.impl.CreateEntityDataFetcherSpec.test get(CreateEntityDataFetcherSpec.groovy:42)

Muted Tests (first 20 of 38)

Select tests to mute in this pull request:

  • CreateEntityDataFetcherSpec > test get
  • DeleteEntityDataFetcherSpec > test get
  • DeleteEntityDataFetcherSpec > test get invalid
  • EntityDataFetcherSpec
  • GormEnhancerAllQualifiersSpec > registerEntity can resolve through injected registry without touching global singleton
  • SingleEntityDataFetcherSpec
  • SoftDeleteEntityDataFetcherSpec
  • UpdateEntityDataFetcherSpec > test get
  • UpdateEntityDataFetcherSpec > test optimistic locking
  • UpdateEntityDataFetcherSpec > test optimistic locking with null version

Reuse successful test results:

  • ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app.

borinquenkid added a commit that referenced this pull request Jun 29, 2026
…ollution

SchemaBasedMultiTenancySpec passed in isolation but failed in the full suite: a prior
DATABASE-mode tenancy spec left a stale CompanyB->datastore binding in the singleton
GormRegistry, so this SCHEMA-mode spec resolved the wrong datastore (CompanyB.DB.name
'test1Db' instead of 'test1'). Match the MongoDB adapter PR (#15783): make the datastore
@shared, create it once in setupSpec after GormRegistry.reset() to clear leaked state, and
keep per-feature tenant-property clearing in setup(). Applied to SchemaBasedMultiTenancySpec
and MultiTenancySpec. Mongo core 3 -> 1 (only the count-OR disjunction remains).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@borinquenkid

Copy link
Copy Markdown
Member Author

Superseded by #15780 — the consolidated GormRegistry core-impl PR wires the in-build adapters directly (Hibernate 5/7 and MongoDB via a registered GormApiFactory; SimpleMap and GraphQL via the base GormStaticApi) and is stabilized green. The unique unit-test coverage from this stack was harvested into #15790. Closing as superseded; the branch is retained for reference (not deleted).

borinquenkid added a commit that referenced this pull request Jul 4, 2026
…ollution

SchemaBasedMultiTenancySpec passed in isolation but failed in the full suite: a prior
DATABASE-mode tenancy spec left a stale CompanyB->datastore binding in the singleton
GormRegistry, so this SCHEMA-mode spec resolved the wrong datastore (CompanyB.DB.name
'test1Db' instead of 'test1'). Match the MongoDB adapter PR (#15783): make the datastore
@shared, create it once in setupSpec after GormRegistry.reset() to clear leaked state, and
keep per-feature tenant-property clearing in setup(). Applied to SchemaBasedMultiTenancySpec
and MultiTenancySpec. Mongo core 3 -> 1 (only the count-OR disjunction remains).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@borinquenkid borinquenkid deleted the feat/gorm-registry-mongodb branch July 4, 2026 22:51
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.

1 participant