revision=a24ece9cf797f7ea647e33bf846b115208ed1ba5
executedAt=2026-08-29T23:47:51+00:00
cwd=/shared/codebase/clean-architecture-backend-template/src
command=./gradlew :adapter:outbound:persistence-mongo:test --tests "*AnalysisEmptyRegistryWriteProbe*" --console=plain --rerun-tasks
probe source=evidence/raw/129a-mongo-empty-type-registry-write-probe.java (temporary analysis test, removed after the run)
gitStatusBefore=0

question: the shipped default installs PolicyAwareMongoTypeMapper on every MappingMongoConverter
          and an EMPTY MongoTypeMetadataRegistry. What does an ordinary write do?

> Task :build-logic:extractPluginRequests
> Task :build-logic:generatePluginAdapters
> Task :build-logic:compileJava
> Task :build-logic:compileGroovy
> Task :build-logic:compileGroovyPlugins
> Task :build-logic:pluginDescriptors
> Task :build-logic:processResources
> Task :build-logic:classes
> Task :build-logic:jar
> Task :adapter:outbound:persistence-mongo:compileJava
> Task :adapter:outbound:persistence-mongo:processResources
> Task :adapter:outbound:persistence-mongo:classes
> Task :adapter:outbound:persistence-mongo:compileTestkitJava
> Task :adapter:outbound:persistence-mongo:processTestkitResources NO-SOURCE
> Task :adapter:outbound:persistence-mongo:testkitClasses
> Task :adapter:outbound:persistence-mongo:compileTestJava
> Task :adapter:outbound:persistence-mongo:processTestResources NO-SOURCE
> Task :adapter:outbound:persistence-mongo:testClasses
> Task :adapter:outbound:persistence-mongo:test

BUILD SUCCESSFUL in 15s
13 actionable tasks: 13 executed
Consider enabling configuration cache to speed up this build: https://docs.gradle.org/9.0.0/userguide/configuration_cache_enabling.html
gradleExit=0

--- probe stdout ---
  <system-out><![CDATA[emptyRegistry.policyFor=CLASS_METADATA_ALLOWED
emptyRegistry.writeTypeRestrictions={"_class": {"$in": ["dev.caskeleton.adapter.outbound.mongo.mapping.type.AnalysisEmptyRegistryWriteProbe$ProbeDocument"]}}
emptyRegistry.writeType=IllegalStateException
emptyRegistry.rootWrite=IllegalStateException: no type metadata policy is registered for dev.caskeleton.adapter.outbound.mongo.mapping.type.AnalysisEmptyRegistryWriteProbe$ProbeDocument; a stored document's type metadata outlives the class, so the policy is a decision to record rather than to default
emptyRegistry.nestedWrite=IllegalStateException: no type metadata policy is registered for dev.caskeleton.adapter.outbound.mongo.mapping.type.AnalysisEmptyRegistryWriteProbe$ProbeDocument; a stored document's type metadata outlives the class, so the policy is a decision to record rather than to default
springDefault.rootWrite=written keys=[_id, value, _class]
]]></system-out>

--- the three answers the same component gives for an unregistered type ---
75:            .orElseThrow(
134:              .orElse(MongoTypeMetadataPolicy.CLASS_METADATA_ALLOWED);
182:        .orElseThrow(
200:        .orElseThrow(
73:  /** The effective policy for a type; unregistered types keep Spring Data's default. */
74-  public MongoTypeMetadataPolicy policyFor(Class<?> documentType) {
75-    return find(documentType)
76-        .map(MongoTypeMetadataDescriptor::policy)
77-        .orElse(MongoTypeMetadataPolicy.CLASS_METADATA_ALLOWED);
78-  }

--- the shipped default beans ---
106-  @ConditionalOnMissingBean
107-  public MongoTypeMetadataRegistry mongoTypeMetadataRegistry() {
108:    return MongoTypeMetadataRegistry.empty();
31:    converters.forEach(converter -> converter.setTypeMapper(typeMapper));

--- what the existing tests construct the mapper with ---
19:      MongoTypeMetadataRegistry.fromAnnotations(
22:  private final PolicyAwareMongoTypeMapper mapper = new PolicyAwareMongoTypeMapper(registry);
