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>
This commit is contained in:
DongHyeonka
2026-09-04 22:51:59 +09:00
co-authored by Claude Opus 5
parent 43bccd08a8
commit b2963105a8
5017 changed files with 372751 additions and 4943 deletions
@@ -0,0 +1,95 @@
---
kind: CONCEPT
slug: the-eight-phase-shutdown-contract
title: 8단계 종료 순서 계약과 실제 종료 경로
topic: drain-and-shutdown-ordering
project: clean-architecture-backend-template
status: 게시 전
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
rootTreeNode: concept:the-eight-phase-shutdown-contract
evidenceCapturedOn: 2026-09-01
assets:
- key: the-eight-phase-shutdown-contract
file: ../../../final/evidence/rendered/the-eight-phase-shutdown-contract.svg
- key: the-eight-phase-shutdown-contract-diagram
file: ../../../final/assets/diagrams/the-eight-phase-shutdown-contract.svg
evidence:
- ../../../final/evidence/raw/the-eight-phase-shutdown-contract.txt
source:
- 원본 분석 절은 analysis/messaging/messaging-transport-spi.md §17 이다.
---
# 8단계 종료 순서 계약과 실제 종료 경로
전송 SPI 가 종료를 8단계로 선언하고 그 순서를 계약이라고 못 박는다. 실제 종료는 스타터의 다른 클래스가 하고 8단계 중 셋만 명시적으로 수행한다.
## 관계
- **순서 계약을 구현하는 것이 없고, 그것을 검증한다는 테스트는 enum 선언 순서만 본다**
이 계약이 코드에 닿지 않는다는 사례다.
- **새 승인을 거절한다는 메서드가 단계만 기록하고 아무것도 거절하지 않는다**
단계 하나가 이름만 남은 사례다.
- **비밀을 힙에서 지우는 마지막 단계가 종료 경로에 연결되지 않았다**
단계 하나가 통째로 빠진 사례다.
## 본문
<!-- body:start -->
`MessagingLifecycle` 이 종료를 8단계로 선언하고 javadoc 이 그 순서를 계약이라고 못 박는다 — "The order in ShutdownPhase is the contract, not an implementation detail. Each adapter implements the phases; none of them chooses the order."
## 순서가 계약인 이유
각 단계가 앞 단계의 결과 위에 서기 때문이다. 새 승인을 멈추기 전에 드레인하면 드레인이 끝나지 않고, 핸들러가 끝나기 전에 플러시하면 그 핸들러가 만들 정착을 잃는다.
## MessagingLifecycle 참조 위치
:::evidence key="the-eight-phase-shutdown-contract" alt="코드베이스에서 MessagingLifecycle 를 검색한 출력 2줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="MessagingLifecycle 코드베이스 검색 — 2줄 · exit 0" zoom="true"
:::
## 선언과 실제의 거리
:::evidence key="the-eight-phase-shutdown-contract-diagram" alt="선언된 단계에 승인 정지와 드레인과 플러시 및 나머지가 놓이고 실제 수행에서 마지막 칸만 빗금이다" caption="선언과 실제의 거리" zoom="false"
:::
실제 종료는 스타터의 `MessagingShutdownLifecycle` 이 하고 8단계 중 셋만 명시적으로 수행한다 — 승인 정지 · 새 핸들러 정지 · 드레인. 나머지는 Spring 의 `getPhase()` 정수와 빈 소멸 순서에 위임되거나 명시 단계가 없다.
## 순서를 결정하는 것
`ShutdownPhase` 가 아니다.
:::note
실제 종료 시퀀스를 부팅해 관측하지 않았다. 두 클래스의 코드로 판정했다
:::
## 왜 순서가 계약인가
각 단계가 앞 단계의 결과 위에 선다.
새 승인을 멈추기 전에 드레인을 시작하면 드레인이 끝나지 않는다. 계속 들어오는 요청이 남은 작업 수를 다시 늘린다.
핸들러가 끝나기 전에 플러시하면 그 핸들러가 만들 정착을 잃는다. 아직 만들어지지 않은 것은 플러시할 수 없다.
인터페이스 javadoc 이 그 성질을 직접 적는다.
> The order in ShutdownPhase is the contract, not an implementation detail. Each adapter implements the phases; none of them chooses the order.
어댑터가 각 단계를 구현하고, 순서는 어느 어댑터도 고르지 않는다는 뜻이다.
## 실제로 무엇이 도는가
종료를 수행하는 것은 스타터의 종료 수명주기 클래스다. 그 클래스가 명시적으로 하는 것은 셋이다. 승인 정지, 새 핸들러 정지, 드레인.
나머지는 Spring 의 단계 정수와 빈 소멸 순서에 위임되거나, 대응하는 명시 단계가 없다.
즉 순서를 결정하는 것은 선언된 단계 열거형이 아니라 프레임워크의 소멸 순서다.
## 두 이름의 거리
선언된 계약과 실행되는 절차가 이름을 공유하지 않는다. 계약 쪽은 여덟 단계를 갖고 구현체가 없으며, 실행 쪽은 세 동작을 갖고 그 동작을 단계 이름으로 부르지 않는다.
그래서 계약을 읽은 사람과 실행을 읽은 사람이 같은 시스템에 대해 다른 그림을 갖는다.
<!-- body:end -->