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>
61 lines
3.9 KiB
Markdown
61 lines
3.9 KiB
Markdown
---
|
|
kind: CONCEPT
|
|
slug: adapter-outbound-persistence-mongo-c02
|
|
title: 선언된 축이 컴파일되지 않으면 startup에서 거부된다
|
|
topic: schema-and-wire-models
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: concept:adapter-outbound-persistence-mongo-c02
|
|
evidenceCapturedOn: 2026-09-01
|
|
assets:
|
|
- key: adapter-outbound-persistence-mongo-c02
|
|
file: ../../../final/evidence/rendered/adapter-outbound-persistence-mongo-c02.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/adapter-outbound-persistence-mongo-c02.txt
|
|
source:
|
|
- 원본 분석 절은 analysis/06-adapter-outbound-persistence-mongo.md#L493 이다.
|
|
module: adapter-outbound-persistence-mongo
|
|
---
|
|
|
|
# 선언된 축이 컴파일되지 않으면 startup에서 거부된다
|
|
|
|
이 package의 나머지는 api manifest를 말이 아니라 코드로 만든다 — 조립 순서, startup 거부, 축 컴파일, 실제 등록된 변환기로 만든 guard, 정밀도 검사.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
P1과 별개로, 이 package의 나머지는 api manifest를 말이 아니라 코드로 만든다.
|
|
|
|
## 변환기 선택이 실행마다 달라지지 않는다
|
|
|
|
`MongoCustomConversionsFactory.converters(...)`가 변환기를 **명시적 List 순서로** 조립한다. 이유가 주석에 있다 — Spring의 conversion service는 첫 매칭 변환기를 쓰므로 `Set`이나 classpath 스캔에서 조립하면 JVM 실행마다 다른 변환기가 선택될 수 있다. `fingerprint(manifest)`가 manifest fingerprint에 변환기 클래스 이름을 이어 붙여 golden BSON snapshot이 비교할 identity를 만든다.
|
|
|
|
## 등록하지 않은 축은 startup에서 걸린다
|
|
|
|
같은 factory가 `requireEveryAxisImplemented(...)`로 `LOCAL_DATE_TIME_WITH_REGISTERED_CONVERTER`를 startup에서 거부한다. enum 상수 자신이 "selecting this without registering the named converter is a startup failure"라고 적어 둔 규칙을 실제로 집행하는 지점이다.
|
|
|
|
## LocalDateTimeMappingGuard 참조 위치
|
|
|
|
:::evidence key="adapter-outbound-persistence-mongo-c02" alt="코드베이스에서 LocalDateTimeMappingGuard 를 검색한 출력 14줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="LocalDateTimeMappingGuard 코드베이스 검색 — 14줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
## 선언만 있고 컴파일되지 않았던 축
|
|
|
|
`BigIntegerRepresentationConverters.forRepresentation(...)`은 manifest의 BigInteger 축을 세 변환기 쌍으로 컴파일한다. 주석이 과거 상태를 기록한다 — 이 축은 선언만 있고 컴파일되지 않아 `STRING`과 `DECIMAL128`이 동일한 document를 만들었고, 하나는 사전식으로 다른 하나는 수치로 정렬된다.
|
|
|
|
## guard를 실제 등록된 변환기로 만든다
|
|
|
|
`LocalDateTimeMappingGuard`는 `MongoMappingConfiguration`이 **실제 등록된 변환기**로 만든다. javadoc이 이전 결함을 적는다 — guard를 `withoutConverters()`로 만들고 manifest를 검증하게 해서, 명명된 변환기를 등록한 배포와 등록하지 않은 배포를 똑같이 거부했다.
|
|
|
|
## 조용한 반올림이 금액을 바꾸지 못한다
|
|
|
|
`BigDecimalToDecimal128Converter`는 driver 호출 전에 34 유효숫자·지수 범위를 검사한다. `Decimal128`은 초과 정밀도를 조용히 반올림하므로, 검사가 없으면 금액이 다른 값으로 저장되고 아무 오류도 나지 않는다.
|
|
|
|
## 저장된 문자열이 클래스를 고르지 못한다
|
|
|
|
`PolicyAwareMongoTypeMapper`는 alias에 점을 금지하고, 읽을 때 점의 유무로 "legacy class name"과 "alias"를 구분한다 — 그래서 미등록 alias가 class loading으로 fallback하는 일이 없다. `readType(source, basicType)`은 저장된 타입이 caller의 기대 타입과 호환되지 않으면 조용히 caller 타입으로 읽지 않고 schema 오류를 던진다.
|
|
|
|
<!-- body:end -->
|