Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/duplicate-mechanisms/decision/decision-one-audit-mechanism-per-entity.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

2.5 KiB

kind, slug, title, topic, project, status, sourceRevision, rootTreeNode, decisionStatus, decidedOn, source
kind slug title topic project status sourceRevision rootTreeNode decisionStatus decidedOn source
PROJECT_DECISION one-audit-mechanism-per-entity 감사 메커니즘은 엔티티당 정확히 하나여야 한다 duplicate-mechanisms clean-architecture-backend-template 게시 전 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 decision:one-audit-mechanism-per-entity ADOPTED 2026-08-30
src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/audit
src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/envers
analysis/05-adapter-outbound-persistence-jpa.md

감사 메커니즘은 엔티티당 정확히 하나여야 한다

결정문

한 엔티티의 감사 기록은 하나의 메커니즘이 소유하고, 둘 이상이 같은 엔티티를 기록하지 않는다.

판단 이유

감사 메커니즘이 둘이면 같은 변경이 두 번 기록되거나, 두 기록이 서로 다른 내용을 담거나, 둘 중 하나만 도는데 어느 쪽인지 알 수 없게 된다.

세 결과 모두 감사의 목적을 무너뜨린다. 감사 기록은 나중에 사람이 판단의 근거로 쓰는 것이고, 근거가 둘이면 판단이 서지 않는다.

그리고 감사는 조용히 실패하는 계열이다. 기록이 남지 않아도 업무 트랜잭션은 성공하므로, 두 메커니즘 중 하나가 꺼져 있어도 증상이 없다.

그래서 소유권을 엔티티 단위로 정한다. 어떤 엔티티가 어떤 메커니즘의 소유인지가 한 곳에서 결정되고, 그 결정이 코드로 확인 가능해야 한다.

영향

감수하는 것

메커니즘마다 다른 능력을 갖는데 엔티티는 하나만 고를 수 있다. 이력 조회가 필요한 엔티티와 변경 시각만 필요한 엔티티가 같은 선택지를 공유하지 않는다.

메커니즘을 바꾸면 그 엔티티의 과거 기록과 새 기록이 다른 형태가 된다.

얻는 것

한 변경에 대한 감사 기록이 정확히 하나다.

메커니즘 하나가 배선되지 않았을 때 그 엔티티의 기록이 통째로 비므로, 부분적으로만 기록되는 상태보다 발견하기 쉽다.

근거

  • 같은 개념의 두 어휘가 공존하면 하나를 죽은 것으로 표시한다 이 결정이 속한 계열의 규칙이다.
  • 중복 장치를 찾으면 어느 쪽이 조립됐는지 먼저 확인한다 중복이 이미 있을 때의 확인 절차다.