--- 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`가 공식 서버 메타데이터와 조직 정책의 접합점이고, 생성자가 그 접합의 모순 네 가지를 거부한다. ## 본문 `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."