Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/schema-and-data-contracts/case/case-messaging-schema-json-f01.md
T
DongHyeonkaandClaude Opus 5 b2963105a8 docs(keycloak-session-store): import the session-storage lab as a new project
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>
2026-09-04 22:51:59 +09:00

89 lines
4.4 KiB
Markdown

---
kind: CASE
slug: messaging-schema-json-f01
title: 포맷 중립 payload 정책이, 자기 상수를 두고 JSON codec의 상수를 참조한다
topic: schema-and-data-contracts
project: clean-architecture-backend-template
status: 게시 전
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
rootTreeNode: case:messaging-schema-json-f01
evidenceCapturedOn: 2026-09-01
assets:
- key: messaging-schema-json-f01
file: ../../../final/evidence/rendered/messaging-schema-json-f01.svg
- key: messaging-schema-json-f01-diagram
file: ../../../final/assets/diagrams/messaging-schema-json-f01.svg
evidence:
- ../../../final/evidence/raw/messaging-schema-json-f01.txt
source:
- 원본 분석 절은 analysis/messaging/messaging-schema-json.md#L463 이다.
module: messaging-schema-json
priority: P2
---
# 포맷 중립 payload 정책이, 자기 상수를 두고 JSON codec의 상수를 참조한다
MessagingCoreAutoConfiguration:410-413이 new PayloadPolicy(JacksonMessageCodec.DEFAULT_MAX_BYTES, JacksonMessageCodec.DEFAULT_MAX_BYTES / 2)를 만든다. 그런데 PayloadPolicy 자신이 같은 값의 public 상수 PayloadPolicy.DEFAULT_MAX_BYTES(messaging-policy/PayloadPolicy.java:17)를 갖고 있다.
## 관계
- **실패 코드는 운영자의 다음 행동이 갈리는 지점마다 나눈다**
같은 분석 리프에서 끌어낸 규칙이다.
## 문제
MessagingCoreAutoConfiguration:410-413이 new PayloadPolicy(JacksonMessageCodec.DEFAULT_MAX_BYTES, JacksonMessageCodec.DEFAULT_MAX_BYTES / 2)를 만든다.
그런데 PayloadPolicy 자신이 같은 값의 public 상수 PayloadPolicy.DEFAULT_MAX_BYTES(messaging-policy/PayloadPolicy.java:17)를 갖고 있다.
## 결론
MessagingAdmissionController는 목적지의 codec이 무엇이든 지나는 관문이다.
그 상한이 한 포맷 클래스의 상수에서 나오면 두 가지가 깨진다.
(1) @ConditionalOnMissingBean이 허용하는 대로 애플리케이션이 자기 MessageCodecRegistry를 내놓아 JSON codec을 대체해도, 정책은 여전히 JSON codec의 값을 읽는다.
(2) 다섯 곳의 리터럴 중 하나만 바뀌면 조용히 갈라지고, RawBytesMessageCodec javadoc이 이미 "shared with the Stable codecs"라고 사실과 다르게 부르고 있다.
정책 소유자가 이미 존재하는데 배선이 그것을 지나쳤다.
## 검증 환경
OpenJDK : 21.0.12 java -version 으로 확인
Gradle : 9.0.0 src/gradle/wrapper/gradle-wrapper.properties 의 distributionUrl 로 확인
확인 방식 : PayloadPolicy 참조 25건 검색과 정책이 읽는 상수의 소유 클래스 확인
소스 수정 : x
## 재현 조건
원문은 analysis/messaging/messaging-schema-json.md#L463 에 있다.
## 본문
<!-- body:start -->
`MessagingCoreAutoConfiguration:410-413``new PayloadPolicy(JacksonMessageCodec.DEFAULT_MAX_BYTES, JacksonMessageCodec.DEFAULT_MAX_BYTES / 2)`를 만든다. 그런데 `PayloadPolicy` 자신이 같은 값의 public 상수 `PayloadPolicy.DEFAULT_MAX_BYTES`(`messaging-policy/PayloadPolicy.java:17`)를 갖고 있다.
## 참조가 뒤집힌 자리
:::evidence key="messaging-schema-json-f01-diagram" alt="JacksonMessageCodec 상수만 정책이 읽는 상수 안에 놓이고 PayloadPolicy 자기 상수가 바깥에 빗금으로 놓인다" caption="참조가 뒤집힌 자리" zoom="false"
:::
`MessagingAdmissionController`는 목적지의 codec이 무엇이든 지나는 관문이다.
## PayloadPolicy 참조 위치
:::evidence key="messaging-schema-json-f01" alt="코드베이스에서 PayloadPolicy 를 검색한 출력 25줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="PayloadPolicy 코드베이스 검색 — 25줄 · exit 0" zoom="true"
:::
## 한 포맷 클래스의 상수에서 나오면 둘이 깨진다
(1) `@ConditionalOnMissingBean`이 허용하는 대로 애플리케이션이 자기 `MessageCodecRegistry`를 내놓아 JSON codec을 대체해도, 정책은 여전히 JSON codec의 값을 읽는다. (2) 다섯 곳의 리터럴 중 하나만 바뀌면 조용히 갈라지고, `RawBytesMessageCodec` javadoc이 이미 "shared with the Stable codecs"라고 사실과 다르게 부르고 있다. 정책 소유자가 이미 존재하는데 배선이 그것을 지나쳤다.
## 확인하지 못한 것
실제 배포에서 MessageContracts bean 이 채워지는지 확인하지 못했다. 그 답은 starter 리프가 소유한다.
<!-- body:end -->