docs(core): core·조립·빌드·플랫폼 모듈 문서를 한국어로 옮긴다
문제: core 계층(application·domain·shared-contract), app-bootstrap, composition, registry, build-logic, optional 빌드의 모듈 문서가 영어다. 세션이 처음 읽는 지역 규칙인데 소유자는 2026-11-07에 살아 있는 문서를 모두 한국어로 쓰기로 정했다. leaf CLAUDE.md 셋은 Spring Boot 버전을 4.0.0으로 복사해 두었는데 실제 버전(libs.versions.toml)과 다르다. 방법: 뜻을 그대로 옮기고 코드·명령·경로·식별자·표 구조는 원문으로 둔다. 버전은 `src/gradle/libs.versions.toml`을 가리키는 말로 바꾼다. 다른 문서·코드가 제목으로 가리키는 절(application-core의 Naming convention·Package ownership·Canonical use case shape·Allowed transactional shapes, shared-contract의 Responsibility·Forbidden, messaging의 발행 재시도 절)은 영어 원제를 괄호로 남겨 그 참조가 계속 찾아지게 한다. 참조하는 쪽을 고치는 것은 이 작업 범위 밖이다. 코드와 어긋난 주장은 코드에 맞춘다: TransactionPort 구현을 `adapter-persistence`에서 `adapter:outbound:persistence-jpa`의 `SpringTransaction`으로, registry README의 빈 의존 목록 예를 persistence-mongo(실제 목록은 application-core·shared-contract)에서 domain-core·shared-contract·messaging-core-api로 고친다. TemplatePackageOwnershipDocumentTest는 표 머리 문자열로 표를 찾으므로 머리 상수를 한국어 머리(`| 패키지 (...) |`)로 맞춘다. 표와 기계 사본을 대조하는 계약은 그대로다. 위험: 영어 원제를 괄호로 남긴 제목은 참조하는 문서가 한국어 제목으로 바뀌면 괄호를 지울 수 있다. 본문의 짧은 이력 번호(07-08, 06-01, 11-M9)는 뜻을 바꾸지 않으려고 그대로 옮겼다. 검증: python3 scripts/check-docs.py rc=0(번역한 파일의 language 줄 8개, number 줄 3개 지움), check-work-docs.py rc=0, --links(gates.md 범위) 깨진 링크 0, unittest discover scripts/tests 43개 통과.
This commit is contained in:
@@ -1,72 +1,68 @@
|
||||
# shared-contract — skeleton-wide operational contract
|
||||
# shared-contract — 골격 전체가 쓰는 운영 계약
|
||||
|
||||
## Registered identity
|
||||
## 등록 정보
|
||||
|
||||
- Module ID: `shared-contract`
|
||||
- Gradle path: `:shared-contract`
|
||||
- Focused test (derived from Gradle path): `./gradlew :shared-contract:test --console=plain`
|
||||
- Runtime baseline: Java 21; repository framework baseline: Spring Boot 4.0.0.
|
||||
- Registry SSOT: `src/config/architecture/modules.json`.
|
||||
- 모듈 ID: `shared-contract`
|
||||
- Gradle 경로: `:shared-contract`
|
||||
- 이 모듈만 시험(Gradle 경로에서 나온 명령): `./gradlew :shared-contract:test --console=plain`
|
||||
- 실행 기준: Java 21. 프레임워크 기준인 Spring Boot 버전은 `src/gradle/libs.versions.toml`이 정한다.
|
||||
- registry 정본: `src/config/architecture/modules.json`.
|
||||
|
||||
Package root: `dev.caskeleton.shared`.
|
||||
패키지 루트: `dev.caskeleton.shared`.
|
||||
|
||||
Design decisions previously kept as code comments (error-code classification, response
|
||||
envelope shape, metric cardinality bounds, tracing seam, domain-context propagation) live in
|
||||
[README.md](README.md). This file stays the SSOT for module rules.
|
||||
예전에 코드 주석에 두던 설계 결정(오류 코드 분류, 응답 envelope 모양, metric cardinality 한계,
|
||||
tracing 이음매, domain-context 전파)은 [README.md](README.md)에 있다. 이 파일은 모듈 규칙의 정본으로
|
||||
남는다.
|
||||
|
||||
## Responsibility
|
||||
- Response envelope (`response/Envelope`, `response/ApiError`, `response/BulkEnvelope`, `response/BulkItemResult`).
|
||||
- Error code contract (`error/ApiErrorCode` interface, `error/OperationalError` enum,
|
||||
`error/ApiErrorCarrier`) and the one client-facing wording table (`error/ClientErrorMessages`,
|
||||
Korean, one message per `Category`, used by every transport).
|
||||
- Cross-cutting mapper sentinel (`error/MappingException`).
|
||||
- Request value contract (`request/Patch`).
|
||||
- Tracing contract types (`tracing/TraceParent`, `tracing/SpanErrorRecorder`) — W3C
|
||||
`traceparent` value type and the span-error-recording seam (feature-distributed-tracing-contract; the OTel
|
||||
tracer runtime is a fork-activated seam, so these stay Java-stdlib-only).
|
||||
- Stdlib helpers every leaf used to copy (moved here in the 2026-09-25 review follow-up): `digest/Sha256` (the
|
||||
SHA-256 digest value and the one `MessageDigest.getInstance("SHA-256")`), `digest/HmacSha256`
|
||||
(sign and constant-time verify), `retry/Backoff` (capped exponential ceiling; "full jitter" means
|
||||
`U[0, ceiling]` and nothing else). Vendored `messaging:*` and the optional gRPC build do not depend
|
||||
on this module and keep their own copies; each family's CLAUDE.md says why (a different product,
|
||||
decided after the 2026-08-14 messaging module review). Every template leaf that needs one of these has the `shared-contract` edge and uses them
|
||||
instead of copying: identifier, persistence-mongo, application-objectstorage and redis-sdk took the
|
||||
edge for exactly this (decided 2026-11-03), each with a test
|
||||
that pins its output to a vector computed outside the JVM.
|
||||
- `observability/MdcKeys`: the snake_case MDC key names (registry `docs/registries/mdc-keys.yaml`)
|
||||
every transport puts a request's correlation under — web, GraphQL, STOMP and gRPC alike.
|
||||
- `ratelimit/`: the provider-neutral edge rate-limit port (`EdgeRateLimitPort`) and its value types,
|
||||
between the web edge and the Redis adapter (README 「ratelimit」).
|
||||
- `security/Permission`: the `resource:action` permission value `AuthorizationPort` is asked about
|
||||
(README 「security」).
|
||||
- `concurrency/`: the domain-context propagation port and its `ThreadLocal` default (README
|
||||
「concurrency」).
|
||||
- `runtime/RuntimeEnvironment`: the one runtime-profile vocabulary every leaf answers "is this
|
||||
production?" with.
|
||||
- `metrics/ForbiddenMetricTags`: the high-cardinality tag keys no metric may carry.
|
||||
- These are the module's packages and the only ones it may have:
|
||||
`ForbiddenApiArchitectureTest.SHARED_CONTRACT_CONTAINS_ONLY_OPERATIONAL_CONTRACT_PACKAGES` refuses a
|
||||
class in any other package below `dev.caskeleton.shared` or directly in the root, which holds only
|
||||
its `package-info`. A new contract package goes into that test's `SHARED_CONTRACT_PACKAGES` and
|
||||
into this list together; `SharedContractPackageRuleTest` fails when `SHARED_CONTRACT_PACKAGES` and
|
||||
the module's packages differ.
|
||||
- Registry-rule mirrors read only by contract tests live in `testFixtures`, not `main`:
|
||||
## 책임 (Responsibility)
|
||||
- 응답 envelope(`response/Envelope`, `response/ApiError`, `response/BulkEnvelope`, `response/BulkItemResult`).
|
||||
- 오류 코드 계약(`error/ApiErrorCode` 인터페이스, `error/OperationalError` enum,
|
||||
`error/ApiErrorCarrier`)과 클라이언트에 보여 줄 문구 표 하나(`error/ClientErrorMessages`.
|
||||
한국어이고 `Category`마다 문구 하나이며 모든 전송 계층이 쓴다).
|
||||
- 계층을 가로지르는 mapper 표지 예외(`error/MappingException`).
|
||||
- 요청 값 계약(`request/Patch`).
|
||||
- tracing 계약 타입(`tracing/TraceParent`, `tracing/SpanErrorRecorder`) — W3C `traceparent` 값 타입과
|
||||
span 오류 기록 이음매(feature-distributed-tracing-contract. OTel tracer 런타임은 fork가 켜는
|
||||
이음매라서 이 타입들은 Java 표준 라이브러리만 쓴다).
|
||||
- 모든 leaf가 복사해 쓰던 표준 라이브러리 도우미(2026-09-25 리뷰 후속으로 여기로 옮겼다):
|
||||
`digest/Sha256`(SHA-256 digest 값과 유일한 `MessageDigest.getInstance("SHA-256")`),
|
||||
`digest/HmacSha256`(서명과 상수 시간 검증), `retry/Backoff`(상한 있는 지수 ceiling. "full jitter"는
|
||||
`U[0, ceiling]`이고 다른 뜻이 아니다). 들여온 `messaging:*`와 optional gRPC 빌드는 이 모듈에
|
||||
의존하지 않고 자기 사본을 둔다. 각 제품의 CLAUDE.md가 이유를 적는다(다른 제품이다. 2026-08-14 메시징
|
||||
모듈 리뷰 뒤에 정했다). 이 도우미가 필요한 템플릿 leaf는 모두 `shared-contract` edge를 두고 복사하지
|
||||
않고 쓴다. identifier, persistence-mongo, application-objectstorage, redis-sdk가 바로 이 때문에
|
||||
edge를 받았고(2026-11-03에 정함), 각각 JVM 밖에서 계산한 벡터로 출력을 고정하는 시험이 있다.
|
||||
- `observability/MdcKeys`: 모든 전송 계층(web, GraphQL, STOMP, gRPC)이 요청의 correlation을 넣는
|
||||
snake_case MDC 키 이름(registry `docs/registries/mdc-keys.yaml`).
|
||||
- `ratelimit/`: web edge와 Redis 어댑터 사이에 있는 provider 중립 edge rate-limit 포트
|
||||
(`EdgeRateLimitPort`)와 그 값 타입(README 「ratelimit」).
|
||||
- `security/Permission`: `AuthorizationPort`에 묻는 `resource:action` 권한 값(README 「security」).
|
||||
- `concurrency/`: domain-context 전파 포트와 그 `ThreadLocal` 기본 구현(README 「concurrency」).
|
||||
- `runtime/RuntimeEnvironment`: 모든 leaf가 「운영 환경인가?」에 답할 때 쓰는 유일한 runtime profile
|
||||
어휘.
|
||||
- `metrics/ForbiddenMetricTags`: 어떤 metric도 실으면 안 되는 high-cardinality tag 키.
|
||||
- 이 모듈의 패키지는 위가 전부이고 다른 패키지는 둘 수 없다:
|
||||
`ForbiddenApiArchitectureTest.SHARED_CONTRACT_CONTAINS_ONLY_OPERATIONAL_CONTRACT_PACKAGES`가
|
||||
`dev.caskeleton.shared` 아래 다른 패키지에 있는 클래스와 루트에 바로 있는 클래스를 거절한다. 루트에는
|
||||
`package-info`만 있다. 새 계약 패키지는 그 시험의 `SHARED_CONTRACT_PACKAGES`와 이 목록에 함께
|
||||
넣는다. `SharedContractPackageRuleTest`는 `SHARED_CONTRACT_PACKAGES`와 모듈의 패키지가 다르면
|
||||
실패한다.
|
||||
- 계약 시험만 읽는 registry 규칙 사본은 `main`이 아니라 `testFixtures`에 둔다:
|
||||
`metrics/MetricNaming`, `metrics/CardinalityBounds`, `metrics/AlertSeverity`,
|
||||
`tracing/BaggageAllowlist`. Move one to `main` only when production code consumes it.
|
||||
- Generic messaging envelope schema resources under `contracts/messaging/envelope/`.
|
||||
They own transport-neutral envelope metadata only; feature payload schemas remain in their
|
||||
feature-owner modules. Resource presence is not runtime discovery or registration.
|
||||
`tracing/BaggageAllowlist`. 운영 코드가 쓰게 될 때만 `main`으로 옮긴다.
|
||||
- `contracts/messaging/envelope/` 아래의 범용 메시징 envelope schema 리소스. 전송 중립 envelope
|
||||
metadata만 가진다. 기능 payload schema는 그 기능을 가진 모듈에 남는다. 리소스가 있다고 런타임에
|
||||
찾아지거나 등록되는 것은 아니다.
|
||||
|
||||
## Allowed
|
||||
- Java standard library ONLY. No Spring, no Jackson, no JPA imports.
|
||||
## 허용
|
||||
- Java 표준 라이브러리**만**. Spring, Jackson, JPA import는 없다.
|
||||
|
||||
## Forbidden
|
||||
- business/domain concept (domain error codes belong in the consuming module).
|
||||
- framework imports (HTTP status is expressed as transport-neutral `int`; the web module maps it).
|
||||
- claiming Draft 2020-12 validator compatibility before the messaging adapter's Task 6 validator
|
||||
qualification exists.
|
||||
## 금지 (Forbidden)
|
||||
- 업무·도메인 개념(도메인 오류 코드는 그것을 쓰는 모듈에 둔다).
|
||||
- 프레임워크 import(HTTP 상태는 전송 중립 `int`로 나타내고 web 모듈이 대응시킨다).
|
||||
- 메시징 어댑터의 Task 6 validator 검증이 생기기 전에 Draft 2020-12 validator 호환을 주장하기.
|
||||
|
||||
## Test
|
||||
## 테스트
|
||||
```bash
|
||||
cd src
|
||||
./gradlew :shared-contract:test
|
||||
|
||||
Reference in New Issue
Block a user