Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/delivery-and-settlement-models/concept/concept-adapter-outbound-persistence-jpa-c04.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

3.0 KiB

kind, slug, title, topic, project, status, sourceRevision, rootTreeNode, evidenceCapturedOn, assets, evidence, source, module
kind slug title topic project status sourceRevision rootTreeNode evidenceCapturedOn assets evidence source module
CONCEPT adapter-outbound-persistence-jpa-c04 offset을 표현할 수 없는 타입과 count 질의 없는 hasNext delivery-and-settlement-models clean-architecture-backend-template 게시 전 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 concept:adapter-outbound-persistence-jpa-c04 2026-09-01
key file
adapter-outbound-persistence-jpa-c04 ../../../final/evidence/rendered/adapter-outbound-persistence-jpa-c04.svg
key file
adapter-outbound-persistence-jpa-c04-diagram ../../../final/assets/diagrams/adapter-outbound-persistence-jpa-c04.svg
../../../final/evidence/raw/adapter-outbound-persistence-jpa-c04.txt
원본 분석 절은 analysis/05-adapter-outbound-persistence-jpa.md#L302 이다.
adapter-outbound-persistence-jpa

offset을 표현할 수 없는 타입과 count 질의 없는 hasNext

질의 API가 offset과 page number를 타입으로 표현하지 않고, fetchSize()가 size + 1을 반환해 별도 count 질의 없이 hasNext를 정한다.

본문

offset/page number를 아예 표현하지 않으므로 keyset API를 사용하는 consumer가 실수로 large offset pagination으로 회귀하기 어렵다.

질의 API가 표현하지 않는 것

:::evidence key="adapter-outbound-persistence-jpa-c04-diagram" alt="정렬 키와 size 더하기 1과 서명된 커서가 질의 API 안에 놓이고 offset과 total count 질의가 바깥에 빗금으로 놓인다" caption="질의 API가 표현하지 않는 것" zoom="false" :::

count 질의 없이 hasNext를 정한다

fetchSize()는 요청 size + 1을 반환한다. 즉 별도 count query 없이 한 row를 더 읽어 hasNext를 판단하는 계약이다. hasNext=true이면 nextCursor 필수, terminal slice이면 nextCursor 금지, items는 defensive copy. page number/total count가 없다는 것은 API omission이 아니라 의도된 성능 정책이다 — "keyset을 쓰면서 매번 count(*)도 수행"하는 모순을 contract shape에서 제거한다.

QueryName 참조 위치

:::evidence key="adapter-outbound-persistence-jpa-c04" alt="코드베이스에서 QueryName 를 검색한 출력 21줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="QueryName 코드베이스 검색 — 21줄 · exit 0" zoom="true" :::

raw SQL이 metric identity가 될 수 없다

QueryName도 bounded registry key다. QueryObservation.start(QueryName)QueryScope 구조에서 QueryScope.failure 문서가 "throwable message를 log하지 말 것"을 직접 계약한다. Micrometer implementation이 이를 실제로 지키는지는 observation sub-scope에서 확인한다.

backend가 없어도 흐름이 갈라지지 않는다

NoopQueryObservation은 backend가 없을 때도 caller control flow가 갈라지지 않게 singleton no-op scope를 제공한다. app-bootstrap JpaObservabilityAutoConfiguration에서 actual fallback consumer가 존재한다.