Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/schema-and-wire-models/concept/concept-adapter-outbound-cache-redis-c07.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

58 lines
3.4 KiB
Markdown

---
kind: CONCEPT
slug: adapter-outbound-cache-redis-c07
title: guard 아래에서는 명령 이름으로 위험을 다시 유도할 수 없다
topic: schema-and-wire-models
project: clean-architecture-backend-template
status: 게시 전
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
rootTreeNode: concept:adapter-outbound-cache-redis-c07
evidenceCapturedOn: 2026-09-01
assets:
- key: adapter-outbound-cache-redis-c07
file: ../../../final/evidence/rendered/adapter-outbound-cache-redis-c07.svg
evidence:
- ../../../final/evidence/raw/adapter-outbound-cache-redis-c07.txt
source:
- 원본 분석 절은 analysis/10-adapter-outbound-cache-redis.md#L350 이다.
module: adapter-outbound-cache-redis
---
# guard 아래에서는 명령 이름으로 위험을 다시 유도할 수 없다
`RedisCommandDescriptor`가 공식 서버 메타데이터와 조직 정책의 접합점이고, 생성자가 그 접합의 모순 네 가지를 거부한다.
## 본문
<!-- body:start -->
`RedisCommandDescriptor`는 "the join between official server metadata and organization policy"이고, 그 아래를 못박는다 — "Nothing downstream of the guard is allowed to re-derive risk, access, or timeout from a command name." 생성자가 그 접합의 모순 네 가지를 거부한다.
| 불변식 | 의미 |
|---|---|
| `BLOCKED``access == NONE` | 차단된 명령은 ACL 계정을 갖지 않는다 |
| `R4``BLOCKED` | 최고 위험은 반드시 차단 |
| `R3``ADMIN_ONLY` 또는 `BLOCKED` | 관리 위험은 애플리케이션에 열리지 않는다 |
| 쓰기 ∧ `retrySafe``mayBeAmbiguous` ⇒ 거부 | 모호할 수 있는 쓰기를 재시도 안전으로 선언 불가 |
마지막 하나가 §23의 런타임 불변식과 같은 규칙의 **선언 시점** 짝이다 — 하나는 정책 파일이 거짓말하지 못하게 하고, 하나는 실패 객체가 거짓말하지 못하게 한다.
## RedisCommandDescriptor 참조 위치
:::evidence key="adapter-outbound-cache-redis-c07" alt="코드베이스에서 RedisCommandDescriptor 를 검색한 출력 28줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="RedisCommandDescriptor 코드베이스 검색 — 28줄 · exit 0" zoom="true"
:::
## KeySpec과 CommandId가 없애는 불일치
`KeySpec`은 공식 Redis 규약(1-based, 음수 lastKey는 뒤에서부터, `movable`은 정적 유도 불가)을 그대로 따르고, `movable`이면 `resolvePositions`가 던진다 — "movable key specification must be resolved by the server". `CommandId`는 항상 대문자로 정규화해 "a policy file, a server metadata reply, and an SDK call site cannot disagree because of casing."
## permit이 절대 넓히지 못하는 것
permit 세 종은 인터페이스이고 javadoc이 경계를 명확히 한다 — "Application code may implement this interface, but a self-made instance never passes `RedisPermitVerifier`… The final enforcement boundary remains the Redis ACL account, which a permit never widens." `PersistentKeyPermit`은 한 줄 더 붙인다: "Cache, session, lock, idempotency, and rate-limit APIs never accept this permit."
## 예산이 선택이 아닌 이유
`OperationBudget`도 규칙을 문서로 못박는다 — "Every R2 API requires a budget. The budget is never optional and never defaulted, because the whole point is that the caller states the cost it is prepared to pay before Redis is asked."
<!-- body:end -->