From 927de097d95d2e1b28cf3f9c69be571e6a4fade1 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 7 Nov 2026 07:02:09 +0900 Subject: [PATCH 1/6] =?UTF-8?q?docs(work):=20=EC=9D=B4=EB=A0=A5=20ID=200?= =?UTF-8?q?=20=EA=B7=9C=EC=B9=99=EC=9D=84=20AGENTS.md=EC=99=80=20src/**/CL?= =?UTF-8?q?AUDE.md=EB=A1=9C=20=EB=84=93=ED=9E=8C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: 이력 ID 0 규칙은 docs/work와 docs/manual 본문에만 걸려 있었다. 새 세션이 처음 읽는 규칙 문서인 AGENTS.md와 leaf CLAUDE.md에는 "리뷰 05-18", "D12", "MSG-023", "owner decision 33"처럼 지난 리뷰를 모르면 읽을 수 없는 번호가 87줄 남아 있었다. 2026-11-07 소유자가 이 둘로 넓히기로 했다(리뷰 README 19.4절 ③의 (b)). 모듈 README·설계 문서·docs/reviews는 넓히지 않는다. 고른 방법: 87줄의 번호를 내용과 날짜로 바꾸거나 지웠다. 근거(번호가 가리키는 발견·결정과 원래 문서)는 docs/work/evidence.md 10절 표로 옮겼다. 원래 설계 기록이 이 repo에 없는 번호(feature-*-contract의 D1~D12)는 가리키는 규칙과 코드 위치를 근거로 적었다. check-work-docs.py 기본 모드가 두 문서 묶음까지 보게 했고, 그동안 못 잡던 꼴을 더했다: 모듈 리뷰 발견(MSG-023, BOOT-006), 리뷰 후속 발견(S6-#10a, X2-P1-5, S5-lead-4), 고른 대안이 붙은 발견 번호 (03-11 (b)), 영어 "decision 9"·"review README §15", 줄바꿈으로 갈린 ID. 날짜로 쓴 결정("owner decision 2026-11-06")을 번호로 잡던 오탐은 뺐다. 문서를 고친 것과 검사를 넓힌 것을 한 커밋에 둔 것은, 따로 두면 검사만 있는 커밋에서 기본 모드가 실패하기 때문이다. 버린 안: 검사만 넓히고 문서는 다음 커밋 — 중간 커밋이 rc=1이 된다. 위험·한계: 검사는 아는 꼴만 잡는다. 걷어낸 뒤 "리뷰·라운드·결정·review· decision·round·§"로 남은 괄호를 grep으로 다시 읽었다. 새 패턴을 docs/reviews 밖 전체에 돌리면 검사 대상 밖에서 125줄이 새로 걸린다(모듈 README, ADR 등의 실제 ID). 대상 안 오탐은 0이다. 일부러 만든 "line 10-12 (b)" 한 꼴은 오탐이지만 repo에 없다. 이 검사는 CI가 돌리지 않는다. 파생 서비스 tech-log-backend의 같은 문서에 33줄이 있다(대부분 템플릿에서 받은 사본, 고치지 않음). 검증(트리 41e44de0, desktop ~/workspace/manual-gap-fix-2, 로그 ~/manual-gap-fix-2-logs/A-*): - python3 scripts/check-work-docs.py rc=0, --history docs/manual rc=0, lychee 범위 --links rc=0(578파일, 깨짐 0) - ./gradlew :app-bootstrap:documentContractTest --rerun rc=0(67건, 실패 0) - ./gradlew :adapter:outbound:persistence-mongo:test --tests 'dev.caskeleton.adapter.outbound.mongo.MongoNamespaceContractTest' --rerun rc=0(3건) --- messaging/CLAUDE.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/messaging/CLAUDE.md b/messaging/CLAUDE.md index 931c282..eda4b57 100644 --- a/messaging/CLAUDE.md +++ b/messaging/CLAUDE.md @@ -26,21 +26,21 @@ leaf의 정확한 id는 registry에서 읽는다. family는 **디렉터리 이 `InboxRepository`)를, `messaging-reliability`가 그 port만 보는 relay·consumer 로직(stdlib)을, `messaging-reliability-jdbc-postgresql`이 port의 관계형 구현과 migration(`V1001..V1005`, `V1101`)을 갖는다. 예전에는 `outbox-jdbc-postgresql` 하나가 relay 로직과 PG repository와 admin journal을 함께 -가졌고 inbox도 같은 모양이었다(S7-#5b). 구현 leaf가 `jdbc-postgresql`로 명명된 이유: 구현은 Spring +가졌고 inbox도 같은 모양이었다(2026-09-25 리뷰 후속 작업에서 나눴다). 구현 leaf가 `jdbc-postgresql`로 명명된 이유: 구현은 Spring JDBC이고 SQL은 `jsonb` · `FOR UPDATE SKIP LOCKED` · `ON CONFLICT` · `TIMESTAMPTZ`로 PostgreSQL 전용이다. `jpa`라는 이름은 사용하지 않는 기술을 광고하고, vendor 중립 port가 어디 있는지도 숨겼다. -### 공용 다이제스트 헬퍼를 복사해 두는 이유 (review 2026-11-01 01-11) +### 공용 다이제스트 헬퍼를 복사해 두는 이유 `messaging-admin`(`HmacApprovalVerifier`, `PlanDigest`)과 `messaging-claim-check` (`ClaimCheckIntegrityGuard`)는 SHA-256·HMAC-SHA256 계산을 자기 안에 둔다. 템플릿의 `shared-contract` `digest/Sha256`·`HmacSha256`을 쓰지 않는 것은 의도다. 이 family는 이 애플리케이션의 -계층이 아니라 자기 API·SPI·composition을 가진 다른 제품이고(MSG-023 §6.2), `messaging:*` leaf는 +계층이 아니라 자기 API·SPI·composition을 가진 다른 제품이고(2026-08-14 messaging 모듈 리뷰 뒤 소유자가 정한 배치), `messaging:*` leaf는 `domain-core`·`application-core`·`shared-contract` 어느 타입에도 의존하지 않는다. 헬퍼 하나 때문에 registry edge를 주면 그 경계가 깨진다. 복사본을 고칠 때(키 길이 검사, constant-time 비교 등)는 `shared-contract`의 정본과 같은 규칙인지 함께 본다. -### Publish retryability of authentication and authorization (review 2026-11-01 06-01) +### Publish retryability of authentication and authorization 이 제품 안에는 같은 category에 대한 재시도 규칙이 둘 있다. 의도다. @@ -63,7 +63,7 @@ registry edge를 주면 그 경계가 깨진다. 복사본을 고칠 때(키 길 번역하는 것. 버린 이유: `retryable`은 이 제품이 "같은 레코드를 나중에 다시 보내면 받아질 수 있나"를 말하는 자리다. bridge가 category로 그 판단을 다시 하면 같은 사실을 제품과 bridge가 따로 정하고, 이 제품의 `PublishResult`를 읽는 다른 호출자는 bridge와 다른 답을 본다. 대신 이 제품 주석은 소비자 이름(application -relay, `composition:outbox-relay`)을 부르지 않는다 — "flag를 믿는 publisher"로 쓴다(재리뷰 2026-11-03 RR-05-07). +relay, `composition:outbox-relay`)을 부르지 않는다 — "flag를 믿는 publisher"로 쓴다(2026-11-03). ## Public surface 정책 @@ -95,7 +95,7 @@ RabbitMQ·Pulsar·NATS·Kafka Share·Spring Cloud Stream bridge leaf와 Debezium 새 leaf를 application에 채택할 때는 starter 또는 composition dependency와 architecture edge policy, qualification/support 상태를 함께 변경한다. -## application이 이 family에 도달하는 경로 (MSG-015, cutover 완료) +## application이 이 family에 도달하는 경로 (cutover 완료) 리뷰(`docs/reviews/2026-08-14-messaging-module-code-review.md` §6.1·§6.3)가 정한 `application-owned port → platform anti-corruption bridge → platform` 경로는 이제 존재한다. @@ -110,7 +110,7 @@ lease/transport/outcome normalization/observation은 platform 중앙 publish pat package는 `messaging-core-api`만 보며 concrete runtime/transport/Kafka 타입을 직접 보지 않는다. -**MSG-015 cutover는 끝났다(2026-09-28, 소유자 결정 7).** application의 outbox append는 canonical +**application bridge cutover는 2026-09-28에 끝났다(2026-09-25 소유자 결정).** application의 outbox append는 canonical `OutboxAppendPort` 하나이고, relay는 claim한 row의 validated event를 이 bridge로만 보낸다. legacy `OutboxEvent`·`LegacyOutboxAppendPort`와 `MessageBroker → KafkaSender` R0 경로(TLS/SASL을 적용하지 않던 두 번째 producer)는 삭제했다. 남은 Kafka producer는 platform의 것 하나이고, broker security @@ -137,7 +137,7 @@ adapter를 Experimental → Stable로 올릴 때 필요한 것 (`docs/messaging/ 3. capability 선언이 코드에서 파생된다 — `MessagingCapabilities`에 손으로 `true`를 쓰는 것은 증거가 아니다. 4. publish 실패 분류가 typed signal에서만 나온다. exception class 이름 substring 판정은 - Experimental에서도 금지다(MSG-022). + Experimental에서도 금지다. 5. unknown failure의 기본값이 `AMBIGUOUS`다. `REJECTED`는 전송이 시작되지 않았다는 typed 증거가 있을 때만. From 6e2dcae0942b721d66972523e95d57ae88569b7c Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 7 Nov 2026 12:22:47 +0900 Subject: [PATCH 2/6] =?UTF-8?q?refactor(repo)!:=20=EC=93=B0=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=ED=8C=8C=EC=9D=BC=EA=B3=BC=20=EC=9A=B4?= =?UTF-8?q?=EC=98=81=20=EC=9D=B8=ED=94=84=EB=9D=BC=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EC=9D=84=20=EC=A7=80=EC=9A=B4=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: infra/ 43개 중 12개는 코드·테스트·workflow·스크립트 어디서도 읽지 않는다(httpclient·jpa·messaging·notification의 toxiproxy compose와 README). nginx 설정, Kubernetes PVC 인증 job, DB 역할 SQL 셋은 운영 인프라라 개발 repo에 둘 것이 아니다(소유자 결정 2026-11-07). release.yml 의 fileserver-pvc-certification job은 그 매니페스트 문자열만 grep했다. 고른 방법: - 15개를 지운다. - 운영 조건만 그 기능 문서에 한국어로 남긴다. docs/fileserver/operations.md 「운영 환경이 지켜야 할 조건」(nginx internal location·alias·X-Accel-Redirect 헤더 제거·스트리밍, PVC ReadWriteOnce·fsGroup), storage-certification.md(인증 절차), docs/jpa/security.md 「역할과 권한」·「서버 설정」(역할 SQL과 jpa/postgres README 내용), docs/messaging/security.md(인증서 SAN). httpclient TLS README 내용은 docs/httpclient/security.md에 이미 있다. - release.yml job과 needs 줄, fileserver-pr.yml·pr-adapters.yml의 지운 경로 필터를 지운다. - fileserver 지원 표의 "Kubernetes ReadWriteOnce PVC — Limited" 행은 근거 job이 없어져 「주장하지 않음」으로 옮긴다. 버린 대안: 인프라 파일을 project-infra로 옮기기(설계 Q6). 그 repo는 특정 프로젝트용이라 범용 템플릿 파일을 받을 자리가 없다. 위험·한계: 지원 표에서 PVC 주장이 빠진다. 파생 서비스가 그 파일을 배포에 썼다면 병합이 지운다(B-50). 클러스터 인증은 이제 배포하는 쪽이 문서 절차로 한다. 검증(desktop, 트리 749a3328, ~/t1-layout-logs/): - :composition:fileserver-platform:check :app-bootstrap:check :app-bootstrap:documentContractTest rc=0 (repositoryContractTest, FileserverDocumentationCoverageTest 실행) - :verifyStrictLaneStages --dry-run rc=0 - scripts/verify-compose-profile-contracts.sh rc=0 (18 lane) - check-work-docs.py, 상대 링크 검사 rc=0 Refs: design-docs repo-structure/01-backend-layout.md 4.4, 6.3 BREAKING CHANGE: infra/fileserver/nginx, infra/fileserver/kubernetes, infra/jpa, infra/httpclient, infra/messaging, infra/notification/toxiproxy와 release.yml fileserver-pvc-certification job이 없어진다. docs/upgrade/2026-11-maturity-review.md B-50. --- docs/messaging/security.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/messaging/security.md b/docs/messaging/security.md index a847205..16e8359 100644 --- a/docs/messaging/security.md +++ b/docs/messaging/security.md @@ -21,6 +21,10 @@ runtime이 admin 자격 증명을 아예 보유하지 않으므로, 침해된 ha - broker authentication 활성 - topology auto-create 비활성 +broker 인증서는 `subjectAltName`에 접속 이름을 가져야 한다. hostname verification은 SAN을 보므로, SAN이 +없는 인증서는 실패하는 것이 맞다. 검사를 끄지 않는다. 키와 인증서는 배포 환경의 PKI가 발급해 실행 때 +마운트하고, repo에 두지 않는다. + Kafka는 추가로 `enable.idempotence=true`, `acks=all`, `max.in.flight.requests.per.connection <= 5`, consumer auto-commit 금지. From ef1cf4a3f0fe8534c951656b5fa7ca8af09d2812 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 7 Nov 2026 12:23:32 +0900 Subject: [PATCH 3/6] =?UTF-8?q?docs(records):=20=EA=B8=B0=EB=A1=9D?= =?UTF-8?q?=EA=B3=BC=20ADR=20=EB=A7=A8=20=EC=9C=84=EC=97=90=20=ED=95=9C?= =?UTF-8?q?=EA=B5=AD=EC=96=B4=20=EB=A8=B8=EB=A6=AC=20=EB=B8=94=EB=A1=9D?= =?UTF-8?q?=EC=9D=84=20=EB=8B=A8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: 설계서·계획서·납품 패키지·증거·학습 문서와 ADR이 기록이라는 표시 없이 지금 문서처럼 읽힌다. 상태 칸이 설계서 72개 중 40개, 계획서는 거의 없고, 있어도 Approved·확정·Accepted.처럼 값이 제각각이며 영어다. 고른 방법: docs/design, docs/history, docs/adr, docs/notification/adr의 .md 246개 맨 위에 같은 모양의 머리 블록을 단다. 칸은 상태·작성일· 요약(한국어 한 문장)·현재 정본, 대체됐으면 대체됨이다. 블록은 표시 줄 두 개로 감싸서 빼면 원문 바이트가 그대로 돌아온다(246개 모두 대조함). - 종류는 폴더가 정하고 둘째 줄에 적는다(plans/evidence는 증거). - 상태는 원래 상태 줄을 고정 어휘로 바꾼 값이다. 상태 줄이 없는 설계서와 체크 상자가 다 표시되지 않은 계획서는 「확인 안 함」. capability-status.md 제거 표로 지운 것이 확인된 설계서 다섯은 「폐기」, 2026-07-20 하네스 설계·계획과 production capability platform 설계는 「대체됨」이다. - 현재 정본은 구조 정리로 옮겨질 수 있는 src/messaging·src/grpc 대신 docs/ 쪽 문서나 옮기지 않는 leaf README를 가리킨다. docs/README.md에 「문서 수명과 언어」「기록 문서의 머리 블록」「문서와 코드를 같은 변경에서 고친다」를 더하고, 파생 서비스 안내에 머리 블록 충돌 가능성을 적었다. 버린 대안: H1 제목 아래에 블록을 두는 안은 보기에는 낫지만 빼는 규칙이 파일마다 달라져 원문 복원이 기계적이지 않다. 「종류」 칸을 따로 두는 안은 폴더와 같은 정보를 두 번 쓰게 한다. 위험·한계: 「확인 안 함」 설계서 38개, 계획서 51개는 지금 유효한지 아무도 판정하지 않았다. 요약은 제목·목표 줄을 보고 쓴 것이라 본문을 끝까지 읽지 않았다. 납품 패키지 셋의 MANIFEST.sha256는 이제 맞지 않는다 (납품 당시 바이트의 해시이고, 블록을 빼면 다시 맞는다). 리뷰 폴더에는 아직 머리 블록을 달지 않았다. 검증: 머리 블록을 뺀 내용과 HEAD 원본 246개 일치, check-work-docs.py rc=0, --links docs·README.md·CLAUDE.md·AGENTS.md 깨진 링크 0. --- docs/design/2026-08-10-messaging-platform-design.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/design/2026-08-10-messaging-platform-design.md b/docs/design/2026-08-10-messaging-platform-design.md index af4a458..2b281b9 100644 --- a/docs/design/2026-08-10-messaging-platform-design.md +++ b/docs/design/2026-08-10-messaging-platform-design.md @@ -1,3 +1,12 @@ + +> **기록 · 설계서** 본문은 쓴 때의 원문이다. 지금 동작은 「현재 정본」을 읽는다. + +- 상태: 채택 +- 작성일: 2026-08-10 +- 요약: 메시지 생성부터 브로커 수락, 소비자 정산까지 증거로 다루는 메시징 플랫폼 설계다. +- 현재 정본: `docs/messaging/support-matrix.md` + + # Messaging Platform 설계서 - **상태:** 구현 승인용 기준 설계 From c9733223a6a11d87c0ec14ffe3a8202610888b41 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 7 Nov 2026 13:04:54 +0900 Subject: [PATCH 4/6] =?UTF-8?q?refactor(repo)!:=20=EB=93=A4=EC=97=AC?= =?UTF-8?q?=EC=98=A8=20=ED=94=8C=EB=9E=AB=ED=8F=BC=EC=9D=84=20src/platform?= =?UTF-8?q?s=20=EC=95=84=EB=9E=98=EB=A1=9C=20=EB=AC=B6=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: src/ 최상위에 계층 폴더와 들여온 제품 폴더(messaging, grpc, grpc-advanced)와 optional 빌드 폴더(optional-platforms)가 같은 높이로 놓여, 무엇이 이 애플리케이션의 계층인지 폴더만으로 안 보인다. src/config/에는 빌드 전체 설정과 기능 하나가 주인인 데이터(jpa, messaging, mongodb)가 섞여 있다. 고른 방법(소유자 결정 2026-11-07, 설계 가-1): - git mv로 src/platforms/{messaging,grpc,grpc-advanced,optional-build}. registry source_path 28행만 바꾸고 Gradle 경로(:messaging:*, :grpc:*)는 그대로다. optional 빌드의 이름(optional-platforms)도 그대로다. - optional 빌드가 한 단계 깊어져, build-logic이 "optional 빌드의 부모 = 주 빌드"로 가정한 네 곳(registry settings, ArchitecturePlugin, 테스트 이미지 catalog, checkstyle·spotbugs 설정)을 MainBuild(위로 올라가며 registry·설정 파일을 찾음)로 바꾼다. - settings.gradle·build.gradle의 상대 경로, workflow의 -p 값과 경로, buf 작업 폴더를 고친다. buf breaking은 이동 전 baseline에서도 옛 경로로 비교해 이동 PR에서 건너뛰지 않는다. - config/jpa, config/messaging, config/mongodb의 데이터를 주인 leaf의 release/로 옮기고 읽는 빌드 줄·테스트·스크립트·문서를 고친다. - 루트 CLAUDE.md 5절에 최상위 폴더 지도를 한 줄로 적는다. 버린 대안: Gradle 루트를 저장소 루트로(가-3, CI 재편 때 다시 봄), application-* 묶기(가-2, 파생 서비스 충돌이 큼). 위험·한계: Gradle 문서의 "이름 = 위치" 권고와 한 단계 어긋난다 (:messaging:x가 platforms/messaging/x). 옮긴 폴더를 고쳐 쓰던 파생 서비스는 이름 바뀜 충돌이 날 수 있다(B-52). docs/capability-status.md 「제거된 코드」 표와 docs/work/evidence.md의 옛 경로는 이력이라 두었다. 검증(desktop, 트리 2b3354a4, ~/t1-layout-logs/): - ./gradlew :ci :verifyDependencyLocks --warning-mode=fail --continue 첫 실행 rc=1: MessagingAuthorityContractTest가 src/messaging을 찾아 실패 → 경로를 고침. 두 번째 rc=1: messaging-policy MessagingAdmissionControllerTest.aWaitingCallerIsAdmittedOnceAPermitIsReturned (2초 대기 경쟁, 부하 7.3에서 한 번 실패, 코드 변경 없는 leaf) → --rerun 3회 모두 통과. 세 번째 rc=0 - -p platforms/optional-build ci rc=0, 두 빌드의 verifyStrictLaneStages --dry-run rc=0, -p build-logic check rc=0 - :app-bootstrap:documentContractTest :adapter:outbound:persistence-mongo:mongoDocumentContractTest rc=0 - ./gradlew projects(주 빌드)와 optional 빌드 projects의 프로젝트 목록이 이동 전 트리와 같다(Gradle 경로 불변) - check-work-docs.py, 상대 링크 검사 rc=0 Refs: design-docs repo-structure/README.md 3.1, repo-structure/01-backend-layout.md 6.1 BREAKING CHANGE: src/messaging·src/grpc·src/grpc-advanced·src/optional-platforms가 src/platforms/ 아래로, src/config/{jpa,messaging,mongodb}가 주인 leaf의 release/로 옮겨졌다. optional 빌드는 -p platforms/optional-build로 부른다. docs/upgrade/2026-11-maturity-review.md B-52. --- .github/workflows/messaging-certification.yml | 4 ++-- docs/messaging/support-matrix.md | 2 +- messaging/messaging-kafka/build.gradle | 2 +- .../messaging/kafka/KafkaPublishFailureClassifier.java | 4 ++-- .../contract/MessagingPublicSurfaceContractTest.java | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/messaging-certification.yml b/.github/workflows/messaging-certification.yml index d20e9ca..726ba8e 100644 --- a/.github/workflows/messaging-certification.yml +++ b/.github/workflows/messaging-certification.yml @@ -15,7 +15,7 @@ name: messaging-certification on: pull_request: paths: - - "src/messaging/**" + - "src/platforms/messaging/**" - ".github/workflows/messaging-certification.yml" # Every Gradle job here installs its toolchain through this composite action, so a change to # it changes what this gate runs. @@ -47,5 +47,5 @@ jobs: uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # actions/upload-artifact@v4.6.2 with: name: messaging-broker-certification-evidence - path: src/messaging/messaging-kafka/build/messaging-certification/ + path: src/platforms/messaging/messaging-kafka/build/messaging-certification/ if-no-files-found: warn diff --git a/docs/messaging/support-matrix.md b/docs/messaging/support-matrix.md index bd3164c..1a2e72c 100644 --- a/docs/messaging/support-matrix.md +++ b/docs/messaging/support-matrix.md @@ -27,7 +27,7 @@ > `modules.json`은 messaging leaf의 `gradle_path`와 허용 의존성을 관리하지만 > `runtime_memberships` 필드는 없다. 실제 런타임 편입은 `app-bootstrap`의 Gradle 의존성과 starter / > auto-configuration 경로가 결정한다. 아래 등급은 "무엇이 증명되었는가"를 말하며 런타임 편입 여부와 -> 같은 축이 아니다. 자세한 composition/cutover 상태는 `src/messaging/CLAUDE.md`가 소유한다. +> 같은 축이 아니다. 자세한 composition/cutover 상태는 `src/platforms/messaging/CLAUDE.md`가 소유한다. ## 브로커 등급 diff --git a/messaging/messaging-kafka/build.gradle b/messaging/messaging-kafka/build.gradle index cfa3122..620f109 100644 --- a/messaging/messaging-kafka/build.gradle +++ b/messaging/messaging-kafka/build.gradle @@ -98,7 +98,7 @@ tasks.register('verifyMessagingCertificationEvidence') { description = 'Fails when the committed broker certification manifest claims a scenario the certification lane did not produce.' dependsOn 'messagingCertificationTest' def produced = layout.buildDirectory.file('messaging-certification/broker-certification-evidence.jsonl') - def committed = rootProject.file('messaging/messaging-testkit/src/main/resources/messaging/broker-certification-evidence.jsonl') + def committed = rootProject.file('platforms/messaging/messaging-testkit/src/main/resources/messaging/broker-certification-evidence.jsonl') inputs.file(produced) inputs.file(committed) doLast { diff --git a/messaging/messaging-kafka/src/main/java/dev/caskeleton/messaging/kafka/KafkaPublishFailureClassifier.java b/messaging/messaging-kafka/src/main/java/dev/caskeleton/messaging/kafka/KafkaPublishFailureClassifier.java index d6569fd..ce51ab3 100644 --- a/messaging/messaging-kafka/src/main/java/dev/caskeleton/messaging/kafka/KafkaPublishFailureClassifier.java +++ b/messaging/messaging-kafka/src/main/java/dev/caskeleton/messaging/kafka/KafkaPublishFailureClassifier.java @@ -73,8 +73,8 @@ public final class KafkaPublishFailureClassifier { * *

This flag departs from {@link FailureDescriptor#defaultRetryable} on purpose, for publish * only: that default says an authentication or authorization failure is not retried, and it still - * governs consumption, where the retry engine requires both. See {@code src/messaging/CLAUDE.md} - * "Publish retryability of authentication and authorization". + * governs consumption, where the retry engine requires both. See {@code + * src/platforms/messaging/CLAUDE.md} "Publish retryability of authentication and authorization". */ private static boolean mayPassOnRetry(Throwable cause) { return cause instanceof AuthenticationException || cause instanceof AuthorizationException; diff --git a/messaging/messaging-testkit/src/test/java/dev/caskeleton/messaging/testkit/contract/MessagingPublicSurfaceContractTest.java b/messaging/messaging-testkit/src/test/java/dev/caskeleton/messaging/testkit/contract/MessagingPublicSurfaceContractTest.java index 922d939..22527fd 100644 --- a/messaging/messaging-testkit/src/test/java/dev/caskeleton/messaging/testkit/contract/MessagingPublicSurfaceContractTest.java +++ b/messaging/messaging-testkit/src/test/java/dev/caskeleton/messaging/testkit/contract/MessagingPublicSurfaceContractTest.java @@ -34,8 +34,8 @@ import org.junit.jupiter.api.Test; * *

So the rule is one-directional and mechanical: a vendor library named in a public or protected * signature is declared {@code api}; one used only behind private members stays {@code - * implementation}. {@code src/messaging/CLAUDE.md} states it as policy — this holds it to the - * source so the two cannot drift. + * implementation}. {@code src/platforms/messaging/CLAUDE.md} states it as policy — this holds it to + * the source so the two cannot drift. * *

The libraries checked are the ones an adopter would otherwise have to reverse-engineer into * their own build: broker clients, codec libraries, the metrics registry, the reactive facade. @@ -345,7 +345,7 @@ class MessagingPublicSurfaceContractTest { } private static List messagingLeaves() { - Path family = repositoryRoot().resolve("src/messaging"); + Path family = repositoryRoot().resolve("src/platforms/messaging"); try (Stream children = Files.list(family)) { return children .filter(Files::isDirectory) From 145f645d14a06cd7b6694428b6ca4b3720fc43c6 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 7 Nov 2026 13:07:47 +0900 Subject: [PATCH 5/6] =?UTF-8?q?fix(messaging):=20=EC=9D=B8=EC=A6=9D=20?= =?UTF-8?q?=EC=A6=9D=EA=B1=B0=EB=A5=BC=20digest=EB=A1=9C=20=EA=B3=A0?= =?UTF-8?q?=EC=A0=95=ED=95=9C=20Kafka=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=EB=A1=9C=20=EB=8B=A4=EC=8B=9C=20=EB=A7=8C=EB=93=A0=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: :messaging:messaging-kafka:verifyMessagingCertificationEvidence가 rc=1이다. 커밋된 증거 broker-certification-evidence.jsonl(2026-08-24)의 brokerImage는 apache/kafka:4.1.0인데, 2026-11-03 container-images.properties 가 kafka 이미지를 digest로 고정한 뒤 레인은 apache/kafka@sha256:bff074a5…로 돈다. 시나리오 넷의 결과는 같고 이미지 이름만 다르다. 이 workflow는 messaging 경로가 바뀔 때만 PR에서 돌아 그동안 드러나지 않았다. 고른 방법: 게이트가 안내하는 대로 이번 실행이 만든 jsonl로 커밋된 파일을 바꾼다(증거는 실행 기록이다). 손으로 이미지 이름만 고치지 않는다. 위험·한계: gitCommit 칸은 레인을 돌린 트리의 커밋(c9733223, 이 파일만 다르다)을 가리킨다. 레인은 실 Kafka 컨테이너와 Toxiproxy가 있는 곳에서만 돈다. 검증(desktop, ~/t1-layout-logs/): - 고치기 전(트리 2b3354a4): verifyMessagingCertificationEvidence rc=1. claimed/produced 차이는 brokerImage(apache/kafka:4.1.0 ↔ apache/kafka@sha256:bff074a5…)뿐이고 시나리오·결과·testId는 같다 - 고친 뒤(트리 4b304c59): :messaging:messaging-kafka:verifyMessagingCertificationEvidence -PcertificationCommit=c9733223… :messaging:messaging-testkit:check :messaging:messaging-kafka:check rc=0 (messagingCertificationTest 실행) --- .../messaging/broker-certification-evidence.jsonl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/messaging/messaging-testkit/src/main/resources/messaging/broker-certification-evidence.jsonl b/messaging/messaging-testkit/src/main/resources/messaging/broker-certification-evidence.jsonl index 5a94717..5867276 100644 --- a/messaging/messaging-testkit/src/main/resources/messaging/broker-certification-evidence.jsonl +++ b/messaging/messaging-testkit/src/main/resources/messaging/broker-certification-evidence.jsonl @@ -1,4 +1,4 @@ -{"adapter":"messaging-kafka","brokerImage":"apache/kafka:4.1.0","scenario":"confirm-timeout","testId":"KafkaBrokerCertificationIT#aConfirmThatNeverArrivesIsReportedAsAmbiguousAndTheRecordIsThere","outcome":"AMBIGUOUS","gitCommit":"e98b56eb03ecab588c21fd1e7dbcaa493c1d8645","observedAt":"2026-08-19T14:21:30.826332993Z"} -{"adapter":"messaging-kafka","brokerImage":"apache/kafka:4.1.0","scenario":"connection-cut-after-write","testId":"KafkaBrokerCertificationIT#aConnectionCutAfterTheWriteIsReportedAsAmbiguous","outcome":"AMBIGUOUS","gitCommit":"e98b56eb03ecab588c21fd1e7dbcaa493c1d8645","observedAt":"2026-08-19T14:21:34.906464945Z"} -{"adapter":"messaging-kafka","brokerImage":"apache/kafka:4.1.0","scenario":"high-latency","testId":"KafkaBrokerCertificationIT#latencyBeyondThePublishDeadlineIsReportedAsAmbiguous","outcome":"AMBIGUOUS","gitCommit":"e98b56eb03ecab588c21fd1e7dbcaa493c1d8645","observedAt":"2026-08-19T14:21:21.870705263Z"} -{"adapter":"messaging-kafka","brokerImage":"apache/kafka:4.1.0","scenario":"settlement-lost","testId":"KafkaBrokerCertificationIT#aDeliveryLostBeforeSettlementIsRedelivered","outcome":"REDELIVERED","gitCommit":"e98b56eb03ecab588c21fd1e7dbcaa493c1d8645","observedAt":"2026-08-19T14:21:42.058283607Z"} +{"adapter":"messaging-kafka","brokerImage":"apache/kafka@sha256:bff074a5d0051dbc0bbbcd25b045bb1fe84833ec0d3c7c965d1797dd289ec88f","scenario":"confirm-timeout","testId":"KafkaBrokerCertificationIT#aConfirmThatNeverArrivesIsReportedAsAmbiguousAndTheRecordIsThere","outcome":"AMBIGUOUS","gitCommit":"8d69e599a376e4db29fdf7b96e06fa457ba6ace1","observedAt":"2026-11-07T04:05:39.857063221Z"} +{"adapter":"messaging-kafka","brokerImage":"apache/kafka@sha256:bff074a5d0051dbc0bbbcd25b045bb1fe84833ec0d3c7c965d1797dd289ec88f","scenario":"connection-cut-after-write","testId":"KafkaBrokerCertificationIT#aConnectionCutAfterTheWriteIsReportedAsAmbiguous","outcome":"AMBIGUOUS","gitCommit":"8d69e599a376e4db29fdf7b96e06fa457ba6ace1","observedAt":"2026-11-07T04:05:43.917138801Z"} +{"adapter":"messaging-kafka","brokerImage":"apache/kafka@sha256:bff074a5d0051dbc0bbbcd25b045bb1fe84833ec0d3c7c965d1797dd289ec88f","scenario":"high-latency","testId":"KafkaBrokerCertificationIT#latencyBeyondThePublishDeadlineIsReportedAsAmbiguous","outcome":"AMBIGUOUS","gitCommit":"8d69e599a376e4db29fdf7b96e06fa457ba6ace1","observedAt":"2026-11-07T04:05:29.018486328Z"} +{"adapter":"messaging-kafka","brokerImage":"apache/kafka@sha256:bff074a5d0051dbc0bbbcd25b045bb1fe84833ec0d3c7c965d1797dd289ec88f","scenario":"settlement-lost","testId":"KafkaBrokerCertificationIT#aDeliveryLostBeforeSettlementIsRedelivered","outcome":"REDELIVERED","gitCommit":"8d69e599a376e4db29fdf7b96e06fa457ba6ace1","observedAt":"2026-11-07T04:05:51.014447Z"} From 4ce769632f672c392629468f48e247cb07fe0cad Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 7 Nov 2026 15:14:21 +0900 Subject: [PATCH 6/6] =?UTF-8?q?test(messaging):=20=EB=8C=80=EA=B8=B0=20?= =?UTF-8?q?=ED=97=88=EA=B0=80=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EA=B0=80=20?= =?UTF-8?q?=EC=8B=A4=ED=96=89=20=EC=88=9C=EC=84=9C=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=9D=BC=20=EA=B0=88=EB=A6=AC=EC=A7=80=20=EC=95=8A=EA=B2=8C=20?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: `MessagingAdmissionControllerTest.aWaitingCallerIsAdmittedOnceAPermitIsReturned`가 desktop 부하가 높을 때 가끔 실패한다(구조 정리 게이트에서 부하 7에 한 번, 이번에 부하 24~27에서 20번 중 한 번). 원인: 이 테스트는 대상 하나(`order.created`)로 허가 하나를 쥔 뒤, 같은 대상으로 대기자를 띄우고 곧바로 허가를 돌려준다. 그런데 대상별 상한(2인자 생성자에서는 프로세스 상한과 같은 1)이 나중에 더해지면서 같은 대상의 두 번째 호출은 프로세스 허가를 기다리지 않고 바로 `DESTINATION_IN_FLIGHT_LIMIT_EXCEEDED`로 거절된다. 그래서 테스트는 main 스레드의 `complete`가 대기자의 `admit`보다 먼저 돌 때만 통과한다(그때는 대기자가 기다릴 일이 없다). 부하가 높아 대기자가 먼저 돌면 거절되고 in-flight가 0이 되어 실패한다. 테스트 이름이 말하는 "기다리던 호출이 허가를 받는다"는 어느 쪽에서도 시험되지 않았다. 고친 방법: - 대기자를 다른 대상으로 보내 프로세스 허가만 다투게 한다. - 대기자가 실제로 limiter의 bounded wait에 들어가(TIMED_WAITING) 줄을 선 뒤에 허가를 돌려준다. 순서를 테스트가 정하므로 스레드 일정에 기대지 않는다. - 대기자의 거절을 잡아 단언한다(전에는 스레드 밖으로 사라졌다). - 대기 상한을 2초에서 30초로 늘린다. 부하가 높을 때 상한이 먼저 끝나 생기는 다른 갈림을 막는다. 대기자는 허가를 받는 즉시 끝나므로 평소 시간은 같다. 버린 대안: 같은 대상을 두고 3인자 생성자로 대상별 상한을 2로 주기. 그러면 대상별 상한 1·프로세스 상한 1 조합(2인자 생성자 기본)의 동작을 시험에서 숨긴다. 그 동작 자체를 바꾸는 것은 이 변경의 범위가 아니다. 위험·한계: 2인자 생성자 Javadoc은 "only ceiling is the process-wide one"이라 하지만 한 대상이 프로세스 허가를 모두 쥐면 같은 대상의 호출은 기다리지 않고 바로 거절된다. 운영 조립(`MessagingPublishConfiguration`)은 3인자 생성자로 대상별 상한(기본 64)을 따로 주므로 영향이 없다. 문서와 동작 중 무엇을 맞출지는 별도로 남긴다. 검증(desktop, `--no-build-cache`): - RED: 새 테스트 모양에 대기자를 같은 대상으로 두면 매번 실패한다. 메시지 "the waiter must be queued on the permit before it is returned (refused: MessageBackpressureException: order.created already holds its 1 in-flight publishes ...) expected: TIMED_WAITING but was: TERMINATED". - GREEN: `:messaging:messaging-policy:check :messaging:messaging-policy:testQualityCheck` rc=0, 테스트 43 실패 0. - 부하: busy loop 24개(12코어)를 건 채 이 클래스를 `--rerun`으로 20번 연속 돌렸다. 고친 트리 20/20 통과(1분 부하 8→24). 같은 부하에서 고치기 전 트리는 20번 중 1번 실패(8번째, "expected: 1 but was: 0", 대기자가 위 거절을 받음). 로그 desktop `~/i1-layout-docs-logs/flaky/`. --- .../MessagingAdmissionControllerTest.java | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/messaging/messaging-policy/src/test/java/dev/caskeleton/messaging/policy/MessagingAdmissionControllerTest.java b/messaging/messaging-policy/src/test/java/dev/caskeleton/messaging/policy/MessagingAdmissionControllerTest.java index 93c7820..2306d76 100644 --- a/messaging/messaging-policy/src/test/java/dev/caskeleton/messaging/policy/MessagingAdmissionControllerTest.java +++ b/messaging/messaging-policy/src/test/java/dev/caskeleton/messaging/policy/MessagingAdmissionControllerTest.java @@ -7,11 +7,14 @@ import dev.caskeleton.messaging.api.error.MessageBackpressureException; import dev.caskeleton.messaging.api.error.MessageTooLargeException; import java.time.Duration; import java.util.List; +import java.util.concurrent.atomic.AtomicReference; import org.junit.jupiter.api.Test; class MessagingAdmissionControllerTest { private static final String DESTINATION = "order.created"; + private static final String OTHER_DESTINATION = "invoice.issued"; + private static final Duration WAITER_BOUND = Duration.ofSeconds(30); private static MessagingAdmissionController controller(int limit) { return new MessagingAdmissionController( @@ -182,16 +185,49 @@ class MessagingAdmissionControllerTest { void aWaitingCallerIsAdmittedOnceAPermitIsReturned() throws InterruptedException { MessagingAdmissionController controller = new MessagingAdmissionController( - new PayloadLimitGuard(PayloadPolicy.defaults()), - new InFlightLimiter(1, Duration.ofSeconds(2))); + new PayloadLimitGuard(PayloadPolicy.defaults()), new InFlightLimiter(1, WAITER_BOUND)); controller.admit(DESTINATION, 100); + AtomicReference refused = new AtomicReference<>(); + // Another destination, so only the process-wide permit is contested. A second publish to + // DESTINATION is refused at once by its own ceiling (equal to the process limit here) and + // never waits. + Thread waiter = + new Thread( + () -> { + try { + controller.admit(OTHER_DESTINATION, 100); + } catch (RuntimeException refusal) { + refused.set(refusal); + } + }); - Thread waiter = new Thread(() -> controller.admit(DESTINATION, 100)); waiter.start(); + awaitQueuedOnAPermit(waiter, refused); controller.complete(DESTINATION); - waiter.join(Duration.ofSeconds(5).toMillis()); + waiter.join(WAITER_BOUND.toMillis()); + assertThat(refused.get()).as("the waiter was refused instead of admitted").isNull(); assertThat(waiter.isAlive()).isFalse(); assertThat(controller.inFlight()).isEqualTo(1); + assertThat(controller.inFlight(OTHER_DESTINATION)).isEqualTo(1); + } + + /** + * Waits until {@code waiter} is parked in the limiter's bounded wait, so the permit is returned + * to a caller that is already queued rather than to one that has not arrived yet. + */ + private static void awaitQueuedOnAPermit(Thread waiter, AtomicReference refused) + throws InterruptedException { + long deadline = System.nanoTime() + WAITER_BOUND.toNanos(); + while (waiter.getState() != Thread.State.TIMED_WAITING + && waiter.isAlive() + && System.nanoTime() < deadline) { + Thread.sleep(1); + } + assertThat(waiter.getState()) + .as( + "the waiter must be queued on the permit before it is returned (refused: %s)", + refused.get()) + .isEqualTo(Thread.State.TIMED_WAITING); } }