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>
65 lines
3.9 KiB
Markdown
65 lines
3.9 KiB
Markdown
---
|
|
kind: CONCEPT
|
|
slug: messaging-claim-check-c03
|
|
title: 보존이 생성자 불변식이고 삭제를 부르는 쪽이 없다
|
|
topic: state-machines-and-ownership
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: concept:messaging-claim-check-c03
|
|
evidenceCapturedOn: 2026-09-01
|
|
assets:
|
|
- key: messaging-claim-check-c03
|
|
file: ../../../final/evidence/rendered/messaging-claim-check-c03.svg
|
|
- key: messaging-claim-check-c03-diagram
|
|
file: ../../../final/assets/diagrams/messaging-claim-check-c03.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/messaging-claim-check-c03.txt
|
|
source:
|
|
- 원본 분석 절은 analysis/messaging/messaging-claim-check.md#L124 이다.
|
|
module: messaging-claim-check
|
|
---
|
|
|
|
# 보존이 생성자 불변식이고 삭제를 부르는 쪽이 없다
|
|
|
|
`ClaimCheckPolicy`는 보존이 브로커 보존 + 전체 재시도·DLQ 창을 넘지 않으면 생성자가 거부한다. 그런데 `ClaimCheckStore.delete`를 부르는 쪽이 이 리프에 없다.
|
|
|
|
## 관계
|
|
|
|
- **leaf의 각 public 클래스는 자기 레인에 테스트를 갖는다**
|
|
같은 분석 리프에서 끌어낸 규칙이다.
|
|
- **같은 튜닝 값이 두 계층에 있으면 어느 쪽이 이기는지 정한다**
|
|
같은 분석 리프에서 끌어낸 규칙이다.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
보존이 생성자 불변식이다. `retention`이 `brokerRetention.plus(maxRedeliveryWindow)`보다 짧으면 `CLAIM_CHECK_RETENTION_TOO_SHORT`로 던진다. javadoc이 이유를 적는다.
|
|
|
|
> "A claim check object deleted while its message is still deliverable turns a large message into an undeliverable one — the consumer fetches, gets nothing, and the message dead-letters for a reason that has nothing to do with the message."
|
|
|
|
**이것이 `messaging-reliability-api`의 `InboxRepository.purgeProcessedBefore` javadoc이 요구하고 강제하지 않는 것과 같은 형태의 규칙인데, 이쪽은 생성자가 강제한다.**
|
|
|
|
## 이 리프가 하는 것과 하지 않는 것
|
|
|
|
:::evidence key="messaging-claim-check-c03-diagram" alt="리프 경계 안에 오프로드와 참조 전달과 무결성 검증이 들어 있고 보존 sweep 이 경계 밖 빗금 상자로 놓인 구조" caption="이 리프가 하는 것과 하지 않는 것" zoom="false"
|
|
:::
|
|
|
|
**`ClaimCheckStore.delete`가 이 leaf에서 호출되지 않는다.** 인터페이스에 선언돼 있고 publisher가 의도적으로 안 부른다("Nothing here deletes on failure") — `REJECTED`와 `AMBIGUOUS`를 구분할 수 없는 시점에 삭제하면 모호한 발행의 payload를 지운다. 보존 sweep이 부를 것을 전제하는데 그 sweep이 이 leaf에 없다.
|
|
|
|
## InboxRepository 참조 위치
|
|
|
|
:::evidence key="messaging-claim-check-c03" alt="코드베이스에서 InboxRepository 를 검색한 출력 20줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="InboxRepository 코드베이스 검색 — 20줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
## 기본값이 주는 여유
|
|
|
|
`defaults()`가 브로커 1일 보존 + 1일 재시도 경로에 대해 3일 보존을 준다 — 요구치(2일)보다 1일 여유. `DEFAULT_THRESHOLD_BYTES = 262,144` = 1 MiB의 1/4이고 javadoc이 그렇게 부른다.
|
|
|
|
## 복사와 검사 순서
|
|
|
|
오프로드된 메시지는 payload를 **아예 갖지 않는다**. `Offloaded` record가 양방향 방어 복사를 한다(생성자 `payload.clone()`, 접근자 `payload.clone()`) — `EncodedMessage`(schema-api)·`OutboxRecord`(reliability-api)와 같은 패턴이다. 크기 검사가 digest보다 먼저인 것이 합리적이다 — 크기 불일치는 SHA-256 계산 없이 즉시 판정된다. `sha256(byte[])`가 `HexFormat.of().formatHex(...)`로 **소문자** hex를 만들고 `ClaimCheckReference`의 정규식이 `[a-f0-9]{64}`이므로 두 쪽이 맞는다. `verify`가 검증된 payload의 **복사본**을 반환한다.
|
|
|
|
<!-- body:end -->
|