The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.
Follows the import procedure in README.md.
source/ the originating repository verbatim — 78 documents, 28 SVGs,
8 manifests, plus .source-revision recording the commit
final/ the SSOT
document.md 729 lines written from the 29 experiment documents, not
concatenated: what was predicted, what was measured, and
where the measurement itself was wrong
evidence/raw 125 outputs, flattened to <experiment>__<file> because
the originals collided (01-baseline.txt appeared three
times) and the audit only globs the top level
evidence/meta one per raw file; command and exitCode are null and the
README says why rather than inventing them
evidence/browser 22 captures
assets/ three diagrams through techviz
.techviz/ their VizSpecs
A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.
Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.
verify-pipeline.py passes. audit-records.py reports no issues.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
109 lines
5.1 KiB
Markdown
109 lines
5.1 KiB
Markdown
---
|
|
kind: CASE
|
|
slug: mongo-default-throws-on-first-write
|
|
title: 출하 default 조합이 첫 write에서 예외를 던진다
|
|
topic: drift-direction
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: case:mongo-default-throws-on-first-write
|
|
evidenceCapturedOn: 2026-09-01
|
|
body: case-mongo-default-throws-on-first-write.body.md
|
|
assets:
|
|
- key: mongo-default-throws-on-first-write
|
|
file: ../../../final/evidence/rendered/mongo-default-throws-on-first-write.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/mongo-default-throws-on-first-write.txt
|
|
source:
|
|
- 원본 분석 절은 final/document.md#4-2 · analysis/06 §23 이다.
|
|
---
|
|
|
|
# 출하 default 조합이 첫 write에서 예외를 던진다
|
|
|
|
기본 설정은 정책 인식 타입 매퍼를 모든 변환기에 설치하고 레지스트리는 비어 있게 둔다. 그 조합으로 평범한 쓰기를 하면 예외가 난다. 같은 문서를 스프링 기본 매퍼로 쓰면 정상이다.
|
|
|
|
## 관계
|
|
|
|
- **README의 활성화 recipe를 그대로 따르면 애플리케이션이 시작되지 않는다**
|
|
같은 조합이 문서 쪽에서 드러난 사례다.
|
|
- **Bean 애너테이션이 있다는 것은 조립 증거가 아니다**
|
|
기본 빈이 존재하는 것과 그 조합이 동작하는 것이 다르다는 사례다.
|
|
|
|
## 문제
|
|
|
|
두 개의 기본 빈이 함께 온다.
|
|
|
|
정책 인식 타입 매퍼가 모든 매핑 변환기에 설치된다
|
|
타입 메타데이터 레지스트리는 빈 것으로 만들어진다
|
|
|
|
이 조합에서 등록되지 않은 타입을 쓰면 어떻게 되는가.
|
|
|
|
## 결론
|
|
|
|
예외가 난다. 실행해서 확인했다.
|
|
|
|
probe 는 임시 분석 테스트로 추가하고 실행 후 제거했다. 결과는 이렇다.
|
|
|
|
policyFor 는 CLASS_METADATA_ALLOWED 를 돌려준다
|
|
쓰기 타입 결정은 IllegalStateException
|
|
루트 문서 쓰기는 IllegalStateException
|
|
중첩 문서 쓰기도 IllegalStateException
|
|
같은 문서를 스프링 기본 매퍼로 쓰면 키 세 개가 정상 기록된다
|
|
|
|
예외 메시지는 그 타입에 대한 타입 메타데이터 정책이 등록되지 않았다고 말하고, 저장된 문서의 타입 메타데이터는 클래스보다 오래 살아남으므로 그 정책은 기본값이 아니라 기록해야 할 결정이라고 덧붙인다.
|
|
|
|
그 설계 의도는 타당하다. 문제는 같은 컴포넌트가 등록되지 않은 타입에 대해 세 가지 다른 답을 준다는 점이다.
|
|
|
|
정책 조회는 스프링 기본값으로 대체한다
|
|
쓰기 경로는 예외를 던진다
|
|
|
|
조회가 관대하고 쓰기가 엄격하면, 설정을 점검하는 코드는 통과하고 실제 쓰기는 실패한다.
|
|
|
|
그리고 출하 기본값이 이 조합이다. 애플리케이션이 타입을 하나도 등록하지 않은 채 mongo 를 켜면 첫 쓰기에서 실패한다.
|
|
|
|
## 검증 환경
|
|
|
|
OpenJDK : 21.0.12
|
|
Gradle : 9.0.0
|
|
확인 방식 : 임시 분석 테스트를 추가해 실행하고 제거. 실행 전 작업 트리 변경 0
|
|
소스 수정 : x
|
|
|
|
## 재현 조건
|
|
|
|
원문은 final/evidence/raw/129-mongo-empty-type-registry-write-probe.txt 이고 probe 소스는 129a 다.
|
|
|
|
1. 빈 레지스트리로 정책 인식 매퍼를 만든다.
|
|
2. 등록되지 않은 타입에 대해 policyFor 를 호출한다. 기본값이 돌아온다.
|
|
3. 같은 타입으로 쓰기 타입 결정과 루트 쓰기와 중첩 쓰기를 시도한다. 셋 다 예외다.
|
|
4. 같은 문서를 스프링 기본 매퍼로 쓴다. 정상 기록된다.
|
|
5. 기본 빈 정의에서 레지스트리가 비어 있게 만들어지는지, 매퍼가 모든 변환기에 설치되는지 확인한다.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
세 사실이 겹친다.
|
|
|
|
1. 기본 bean이 **비어 있는** registry이고 그 javadoc이 "An empty registry so a deployment with no long-lived collection still starts"로 의도를 적는다.
|
|
2. configurer가 policy-aware mapper를 **모든** `MappingMongoConverter`에 무조건 설치한다.
|
|
3. 그 mapper가 미등록 타입 write에 `IllegalStateException`을 던진다.
|
|
|
|
## MappingMongoConverter 참조 위치
|
|
|
|
:::evidence key="mongo-default-throws-on-first-write" alt="코드베이스에서 MappingMongoConverter 를 검색한 출력 2줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="MappingMongoConverter 코드베이스 검색 — 2줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
## 시작은 하고 첫 write에서 실패한다
|
|
|
|
module을 켜고 type metadata를 등록하지 않은 배포가 그렇다. probe가 shipped default 조합을 실제로 구성해 확인했고, Spring 기본 mapper로 바꾸면 같은 write가 성공한다.
|
|
|
|
## 같은 컴포넌트가 같은 질문에 세 가지로 답한다
|
|
|
|
미등록 타입의 정책은 `CLASS_METADATA_ALLOWED`, type-restricted **query**는 class name을 predicate에 쓰고, **write**는 예외다. 읽기와 쓰기가 정반대로 답하고 어느 쪽도 registry가 문서화한 기본값과 일치하지 않는다.
|
|
|
|
## 확인하지 못한 것
|
|
|
|
실제 MongoDB 서버에 대고 재현하지 않았다. probe 는 매퍼와 레지스트리 수준에서 관측했다.
|
|
|
|
<!-- body:end -->
|