Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/schema-and-data-contracts/case/case-grpc-proto-contract-f04.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

81 lines
3.4 KiB
Markdown

---
kind: CASE
slug: grpc-proto-contract-f04
title: 열거형 안의 reserved 는 수집되지 않는다
topic: schema-and-data-contracts
project: clean-architecture-backend-template
status: 게시 전
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
rootTreeNode: case:grpc-proto-contract-f04
evidenceCapturedOn: 2026-09-01
assets:
- key: grpc-proto-contract-f04
file: ../../../final/evidence/rendered/grpc-proto-contract-f04.svg
evidence:
- ../../../final/evidence/raw/grpc-proto-contract-f04.txt
source:
- 원본 분석 절은 analysis/grpc/grpc-proto-contract.md#L265 이다.
module: grpc-proto-contract
priority: P3
---
# 열거형 안의 reserved 는 수집되지 않는다
scan 은 스코프 종류로 갈라진다. reserved 수집은 scanMessageMember 안에만 있다.
## 문제
scan 은 스코프 종류로 갈라진다.
reserved 수집은 scanMessageMember 안에만 있다.
## 결론
proto3 는 열거형에도 reserved 2, 15; 와 reserved "OLD_VALUE"; 를 허용하고, 열거형 값을 지울 때 번호를 예약하는 것은 필드와 같은 이유로 필요하다 — 예약하지 않고 재사용하면 옛 클라이언트가 보낸 정수가 다른 뜻으로 해석된다.
지금 SchemaHistory 에 열거형 이름으로 삭제 이력을 넣으면, 스키마가 정확히 예약했더라도 scan.reservedNumbers 에 그 이름이 없으므로 RESERVED_HISTORY 오탐이 난다.
§17.1 의 범위 문법 문제와 같은 방향(fail-closed)이고 같은 자리에서 고칠 수 있다.
reserved 수집을 스코프 종류와 무관하게 먼저 시도한 뒤 나머지 판정을 갈래로 보낸다.
## 검증 환경
OpenJDK : 21.0.12 java -version 으로 확인
Gradle : 9.0.0 src/gradle/wrapper/gradle-wrapper.properties 의 distributionUrl 로 확인
확인 방식 : SchemaHistory 참조 10건 검색과 scan 의 스코프 분기별 reserved 수집 위치 확인
소스 수정 : x
## 재현 조건
원문은 analysis/grpc/grpc-proto-contract.md#L265 에 있다.
## 본문
<!-- body:start -->
`scan` 은 스코프 종류로 갈라진다. `reserved` 수집은 `scanMessageMember` 안에만 있다.
## SchemaHistory 참조 위치
:::evidence key="grpc-proto-contract-f04" alt="코드베이스에서 SchemaHistory 를 검색한 출력 10줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="SchemaHistory 코드베이스 검색 — 10줄 · exit 0" zoom="true"
:::
## proto3 는 열거형에도 reserved 를 허용한다
`reserved 2, 15;``reserved "OLD_VALUE";` 다. 열거형 값을 지울 때 번호를 예약하는 것은 필드와 같은 이유로 필요하다 — 예약하지 않고 재사용하면 옛 클라이언트가 보낸 정수가 다른 뜻으로 해석된다.
## 그래서 오탐이 난다
`SchemaHistory` 에 열거형 이름으로 삭제 이력을 넣으면, 스키마가 정확히 예약했더라도 `scan.reservedNumbers` 에 그 이름이 없으므로 `RESERVED_HISTORY` 오탐이 난다.
## 같은 자리에서 고칠 수 있다
§17.1 의 범위 문법 문제와 같은 방향(fail-closed)이다. `reserved` 수집을 스코프 종류와 무관하게 먼저 시도한 뒤 나머지 판정을 갈래로 보낸다.
## 확인하지 못한 것
열거형 reserved 오탐을 실행으로 재현하지 않았다. 스코프 분기 코드로 판정했다. 블록 주석 안의 선언이 스캔되는지도 확인하지 않았다.
<!-- body:end -->