Skip to content

[GenAI] Add support for org.mongodb.morphia:morphia:1.3.2 using gpt-5.5#7583

Closed
vjovanov wants to merge 21 commits into
masterfrom
ai/vjovanov/add-lib-support-org.mongodb.morphia-morphia-1.3.2
Closed

[GenAI] Add support for org.mongodb.morphia:morphia:1.3.2 using gpt-5.5#7583
vjovanov wants to merge 21 commits into
masterfrom
ai/vjovanov/add-lib-support-org.mongodb.morphia-morphia-1.3.2

Conversation

@vjovanov
Copy link
Copy Markdown
Member

What does this PR do?

Fixes: #2797

This PR introduces tests and metadata for org.mongodb.morphia:morphia:1.3.2, enabling support for this library.

Summary:

  • Strategy: dynamic_access_main_sources_pi_gpt-5.5
  • Agent: pi
  • Model: gpt-5.5
  • Input tokens: 621154
  • Cached input tokens: 7534592
  • Output tokens: 89316
  • Metadata entries: 57
  • Test-only metadata entries: 3
  • Iterations: 24
  • Library coverage percentage: 6.02
  • Generated lines of code: 390
  • Tested library lines of code: 411

Metadata Forge

  • Forge monitored branch: origin/master
  • Forge branch: master
  • Forge commit hash: c973a8aab682315d994dee041a10fca2ad74847e

Stats from stats/<groupId>/<artifactId>/<metadata-version>/stats.json:

Library coverage:

  • Instruction: 1752/33504 (5.23%)
  • Line: 411/6824 (6.02%)
  • Method: 101/1868 (5.41%)

Post-Generation Intervention

  • Stage: metadata_fix_failed

  • Intervention file: post-gen-interventions/org.mongodb.morphia_morphia_1.3.2.md

Post-generation intervention report

Library: org.mongodb.morphia:morphia:1.3.2
Stage: metadata_fix_failed

Summary

The reported Gradle failure was not a remaining reachability-metadata failure. Native-image failed during nativeTestCompile while writing the object file:

java.lang.InternalError: a fault occurred in an unsafe memory access operation
  at org.graalvm.nativeimage.objectfile/com.oracle.objectfile.ObjectFile.writeBuffer(...)

No Missing*RegistrationError appeared in this failure. The Codex metadata-fix log shows that the earlier metadata gaps had been reduced to Morphia/CGLIB reflection issues and Codex added library metadata for those. The later failures were caused by generated tests that exercised unsupported or unstable native-image behavior rather than by missing metadata.

Root causes and intervention

  1. AnnotationBuilderTest caused the nativeTestCompile object-file writer crash when included with the rest of the suite. The test used a large hand-written fake MongoDB driver scaffold plus Unsafe.allocateInstance to bypass MongoClient construction. The resulting native-image failure was an internal image-generation error, not a metadata-registration error. I removed this generated test and its test-only native-image registrations.

  2. The Morphia mapping/lazy-proxy tests exercised CGLIB runtime class generation. In native execution this failed with:

com.oracle.svm.core.jdk.UnsupportedFeatureError: Classes cannot be defined at runtime by default when using ahead-of-time Native Image compilation.
Tried to define class: net.sf.cglib.proxy.Enhancer$EnhancerKey$$KeyFactoryByCGLIB$$...

The follow-on failures were NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer. This is a native-image limitation around runtime bytecode generation/class definition, not missing Morphia metadata. I removed the generated CGLIB/lazy-proxy coverage (LazyFeatureDependenciesTest, MappedClassTest, MappedFieldTest, MapperTest, ReferenceMapperTest) and the two DefaultCreatorTest methods that call Mapper.addMappedClass(...) and trigger the same CGLIB path. Test-only CGLIB bridge/pre-generation support was also removed because it only existed to support those failing tests.

Preserved generated support

The remaining generated tests still cover meaningful Morphia behavior that is compatible with native-image:

  • primitive/wrapper converter behavior (ByteConverterTest, CharArrayConverterTest, ClassConverterTest, FloatConverterTest, ShortConverterTest),
  • DefaultCreator construction and class-name resolution paths that do not initialize CGLIB,
  • weak-reference cache behavior (ReferenceMapTest),
  • reflection utility scanning and generic/array resolution (ReflectionUtilsTest), and
  • serialization round trips (SerializerTest).

These tests preserve useful coverage for the generated support and for the metadata that Codex already added, while avoiding native-image-incompatible CGLIB runtime class definition and the AnnotationBuilderTest native-image builder crash.

Verification

After removing the non-metadata-related generated failures, the targeted test passed with the requested GraalVM environment:

./gradlew test -Pcoordinates=org.mongodb.morphia:morphia:1.3.2 --stacktrace

The final native test run reported 21 tests successful and 0 tests failed.

Local CI Verification

  • Status: success
  • Commands run: 17
  • Fixup attempts: 1

vjovanov added 21 commits May 23, 2026 15:20
@vjovanov vjovanov added library-new-request Request for supporting a new library, or updating the existing one. GenAI PRs produced by generative AI labels May 23, 2026
Copy link
Copy Markdown
Member

@jormundur00 jormundur00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final patch removes the tests that exercised the lazy-proxy / mapping paths (, , , , ), but the library metadata still keeps registrations for those paths, including / CGLIB and . New-library PRs need a remaining test path that exercises the behavior requiring the metadata. Please either restore coverage for those paths or drop the unsupported/unexercised registrations.

Copy link
Copy Markdown
Member

@jormundur00 jormundur00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final patch removes the tests that exercised the lazy-proxy / mapping paths (LazyFeatureDependenciesTest, MappedFieldTest, MapperTest, MappedClassTest, ReferenceMapperTest), but the library metadata still keeps registrations for those paths, including LazyFeatureDependencies / CGLIB and MappedField. New-library PRs need a remaining test path that exercises the behavior requiring the metadata. Please either restore coverage for those paths or drop the unsupported/unexercised registrations.

@jormundur00 jormundur00 added the human-intervention Requires manual follow-up because automated dynamic-access coverage remained too low label May 25, 2026
@jormundur00
Copy link
Copy Markdown
Member

Closing this human-intervention PR and returning the linked issue to Todo.

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

Labels

GenAI PRs produced by generative AI human-intervention Requires manual follow-up because automated dynamic-access coverage remained too low library-new-request Request for supporting a new library, or updating the existing one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for org.mongodb.morphia:morphia:1.3.2

2 participants