Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/state-machines-and-ownership/concept/concept-adapter-outbound-persistence-jpa-c03.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

52 lines
2.9 KiB
Markdown

---
kind: CONCEPT
slug: adapter-outbound-persistence-jpa-c03
title: 위험한 shape 자체를 표현하기 어렵게 만든다
topic: state-machines-and-ownership
project: clean-architecture-backend-template
status: 게시 전
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
rootTreeNode: concept:adapter-outbound-persistence-jpa-c03
evidenceCapturedOn: 2026-09-01
assets:
- key: adapter-outbound-persistence-jpa-c03
file: ../../../final/evidence/rendered/adapter-outbound-persistence-jpa-c03.svg
evidence:
- ../../../final/evidence/raw/adapter-outbound-persistence-jpa-c03.txt
source:
- 원본 분석 절은 analysis/05-adapter-outbound-persistence-jpa.md#L208 이다.
module: adapter-outbound-persistence-jpa
---
# 위험한 shape 자체를 표현하기 어렵게 만든다
error hierarchy의 핵심은 예외 class를 많이 만든 것이 아니라 provider-specific signal을 bounded semantic category로 변환하는 것이다.
## 본문
<!-- body:start -->
error hierarchy의 핵심은 "예외 class를 많이 만든 것"이 아니라 provider-specific signal을 bounded semantic category로 변환하는 것이다. 대표 category는 serialization failure, deadlock, optimistic conflict, lock not available, connection unavailable, timeout 계열, unique/FK/not-null/check constraint, entity not found, schema mismatch, data corruption, completion unknown이다. 이 category는 뒤의 retry policy/metric이 SQLSTATE/provider message를 직접 해석하지 않게 하는 중간 vocabulary다.
## JpaFailureContext 참조 위치
:::evidence key="adapter-outbound-persistence-jpa-c03" alt="코드베이스에서 JpaFailureContext 를 검색한 출력 31줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="JpaFailureContext 코드베이스 검색 — 31줄 · exit 0" zoom="true"
:::
## 표현 자체를 막는 네 불변식
`JpaFailureContext`가 가지는 정보는 operation, SQLSTATE/constraint, attempt, retryability, completion-unknown, elapsed, trace 등으로 제한된다.
- arbitrary identifier는 그대로 담지 않고 bounded/redacted form으로 축약
- malformed SQLSTATE는 `redacted`, absent SQLSTATE는 sentinel로 표현
- completion unknown과 retryable=true를 동시에 표현할 수 없음
- completion-unknown factory는 항상 automatic retry를 차단하는 형태를 만든다
즉 "exception이 발생한 뒤 로그에서 실수하지 말자"보다 앞선 위치에서 **failure context가 위험한 shape 자체를 표현하기 어렵게** 만든다.
## 메시지가 provider cause를 복사하지 않는다
base exception message는 provider cause message를 그대로 복사하지 않고 category + bounded context로 만든다. dedicated test도 provider cause에 email marker를 넣었을 때 top-level exception message에 노출되지 않는 것을 검증한다. 동시에 raw `Throwable cause`는 보존한다.
<!-- body:end -->