jamesfredley commented on PR #15731: URL: https://github.com/apache/grails-core/pull/15731#issuecomment-4724423511
## Bidirectional H5.6 <-> H7.4 test-parity pass Following up on the coverage discussion, I did a full, TCK-aware parity audit across the three test layers and added what is genuinely shared. Pushed as `ec562deee4`. ### The three layers (where coverage belongs) | Layer | Module | Runs on | Use for | |---|---|---|---| | Shared TCK | `grails-datamapping-tck` | H5 **and** H7 (and Mongo) via the `GrailsDataTckManager` ServiceLoader | Version-agnostic GORM contracts | | Per-module | `grails-data-hibernate5/7/core/src/test` | one Hibernate line | Hibernate-implementation behavior (cannot live in the datastore-agnostic TCK) | | Functional | `grails-test-examples` | app boot | End-to-end app behavior | ### What is already at parity (no action needed) The shared TCK already runs **~60 GORM behavioral specs on both H5.6 and H7.4** (CRUD, dynamic finders, `findWhere`, criteria, detached criteria, projections, paged results, optimistic locking, proxies, validation, events, multi-datasource, multi-tenancy, etc.). The raw file-count gap (H5 ~109 vs H7 ~315 specs) is **not** a coverage gap: ~140 of the H7-only specs cover the Hibernate-7 internal rewrite (`cfg/domainbinding/**`, `query/**` HQL infrastructure, `support/hibernate7/**`) - code that does not exist in H5, so there is nothing to mirror. ### What I added this pass - **TCK (both sides):** extended `FindWhereSpec` and `GormEnhancerSpec` with the finder behaviors this PR fixed - `findWhere`/`findAllWhere` null matching (`is null`), `findWhere` single-result limiting, `getAll` order preservation incl. convertible String ids and a null slot for a missing id. Verified passing on both lines. - **H5 per-module (parity with H7):** ported 7 H7 specs whose classes exist identically in H5 - `HibernateGormEnhancerSpec`, `HibernateDatastoreMultiTenancySpec`, `HibernateEventListenersSpec`, `HibernateConnectionSourceSettingsBuilderSpec`, `GrailsQueryExceptionSpec`, `HibernateDatastoreConnectionSourcesRegistrarSpec`, `SoftKeySpec`. All pass on H5 (32 tests, 0 failures) and still pass on H7. ### Verified H7-only (correctly asymmetric - not gaps) I copied every remaining shared-looking H7 behavioral spec into H5 and **ran them**; these failed because they genuinely test Hibernate-7-specific API/behavior, so they stay H7-only (documented as the new behavior where it is a breaking change): | Spec | Why it is H7-only | |---|---| | `HibernateCriteriaBuilderSpec` / `...DirectSpec` | H7 adds a `HibernateCriteriaBuilder(Class, SessionFactory, HibernateDatastore)` ctor + criteria behaviors (isEmpty/scroll/fetchMode/singleResult) that differ on H5; criteria behavior itself is already covered both-sides by the TCK `CriteriaBuilderSpec` | | `InstanceApiHelperSpec` | H7 `InstanceApiHelper.remove(Object, boolean)` signature differs from H5 | | `EventListenerIntegratorSpec` | Hibernate 7 event SPI (`integrate(Metadata, BootstrapContext, SessionFactoryImplementor)`) differs from H5 | | `HibernateGormValidationApiSpec` | H7 shares the datastore `GrailsHibernateTemplate`; H5 does not (intentional H7 behavior) | | `TraitPropertyAccessStrategySpec`, `GrailsEntityDirtinessStrategySpec`, `MultiTenantEventListenerSpec`, `HibernateRuntimeUtilsSpec`, `HibernateDatastoreSchemaMultiTenancySpec` | Depend on Hibernate-7 SPI / metamodel types (`EntityMappingType`, etc.) or H7-only classes (`ChildHibernateDatastore`, `CloseSuppressingInvocationHandler`, `HibernatePagedResultList`, `SelectHqlQuery`, `HibernateDetachedCriteria`) absent from H5 | ### Tracked follow-up (next pass) - Promote to the TCK (both sides) where fully generic: `GormEnhancerCleanupSpec`, `PersistentPropertySpec`, the `GroovyProxyFactory` proxy spec. - Reverse gap: H5 `ByteBuddyProxySpec` (default ByteBuddy proxy: getId/`isInitialized` without initialization) has no H7 equivalent - add an H7 version using the H7 `HibernateProxyHandler`. - De-dupe: H7 has a local `NullValueEqualSpec` that duplicates the TCK one. - Functional layer: dedicated H7 apps for `datasources` (OSIV/multi-datasource), `views-functional-tests` and `scaffolding-fields` (association rendering, unique constraints), rather than the removed runtime substitution. Net: every version-agnostic GORM behavior is exercised on both Hibernate lines (TCK + the new H5 specs), and every remaining asymmetry is a Hibernate-implementation difference that was verified by actually running the tests on both sides - not an untested gap. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
