refactor: 부가 기능을 capability 모듈로 포장하고 기본 조립을 web-only로 전환

설계: docs/superpowers/specs/2026-09-25-capability-module-packaging-design.md
계획/진행 기록: docs/superpowers/plans/2026-09-25-capability-module-packaging.md

- Wave 0: 규칙 고정(AGENTS.md capability 완료 기준·테스트 규칙) + 차단 결함 7건
  (compose overlay 검사, redis-sdk CI job, 적용된 V9/V13 원복 + V16, @EnableScheduling,
  messaging bridge 순서, prod 에러 상세 validator, sample loggers read-only)
- Wave 1: 데이터·보안 Critical 10건 (durable operation 25P02, operation 유스케이스 이동,
  outbox 재인코딩, Kafka TLS/SASL, 알림 트랜잭션, SNS 서명, tus checksum, GraphQL fragment,
  Redis lane, gRPC FAILED_TERMINAL)
- Wave 2: 리팩터링 잔재·실험용 자리 삭제, outbox v1 fencing(V17), 멱등성 V2 정본화
- Wave 3: 라이브러리형 코드 정리(동작하지 않는 설정·인터페이스·gate 제거, web-advanced 분리)
- Wave 4: capability 11개를 "있으면 켜짐" 모듈로 포장, 끄는 장치 제거, 기본 조립 web-only,
  qualificationBootJar 분리
- Wave 5: 빌드 로직 축소(17.2k -> 10.8k줄), sample 테스트 컨벤션 적용

삭제한 코드는 docs/capability-status.md "제거된 코드" 표에 복구 커밋(b5114b9b)과 함께 기록.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-25 12:49:07 +09:00
co-authored by Claude Opus 5.5
parent b5114b9bb4
commit 5e44be9ab4
122 changed files with 725 additions and 9914 deletions
@@ -301,6 +301,14 @@ public final class DefaultMessagePublisher implements MessagePublisher, EncodedM
}
private <T> MessageEnvelope<EncodedMessage> encode(MessageEnvelope<T> message) {
// The outbox relay, dead lettering and the retry topic republish bytes a codec already wrote.
// Encoding them again handed the codec a payload that is not its type, so each such publish was
// REJECTED (or, with a lenient codec, sent the envelope's toString). They go out as they are.
if (message.payload() instanceof EncodedMessage alreadyEncoded) {
MessageEnvelope<EncodedMessage> encoded = message.withPayload(alreadyEncoded);
requireEncodedEnvelope(encoded);
return encoded;
}
MessageCodec codec = codecs.find(message.contentType()).orElseGet(codecs::defaultCodec);
EncodedMessage bytes =
codec.encode(message.messageType(), message.schemaVersion(), message.payload());
@@ -10,9 +10,14 @@ import dev.caskeleton.messaging.api.MessageType;
import dev.caskeleton.messaging.api.ProducerId;
import dev.caskeleton.messaging.api.SchemaVersion;
import dev.caskeleton.messaging.api.TraceContext;
import dev.caskeleton.messaging.api.delivery.DeliveryContext;
import dev.caskeleton.messaging.api.delivery.DeliveryMetadata;
import dev.caskeleton.messaging.api.delivery.MessageDelivery;
import dev.caskeleton.messaging.api.destination.DestinationCapabilities;
import dev.caskeleton.messaging.api.destination.DestinationName;
import dev.caskeleton.messaging.api.destination.MessageDestination;
import dev.caskeleton.messaging.api.error.FailureCategory;
import dev.caskeleton.messaging.api.error.FailureDescriptor;
import dev.caskeleton.messaging.api.error.MessagingConfigurationException;
import dev.caskeleton.messaging.api.header.MessageHeaders;
import dev.caskeleton.messaging.api.publish.ConfirmationLevel;
@@ -21,6 +26,7 @@ import dev.caskeleton.messaging.api.publish.PublishEvidence;
import dev.caskeleton.messaging.api.publish.PublishOptions;
import dev.caskeleton.messaging.api.publish.PublishResult;
import dev.caskeleton.messaging.api.publish.RoutingOutcome;
import dev.caskeleton.messaging.policy.DeadLetterOrchestrator;
import dev.caskeleton.messaging.policy.InFlightLimiter;
import dev.caskeleton.messaging.policy.MessagingAdmissionController;
import dev.caskeleton.messaging.policy.PayloadLimitGuard;
@@ -120,6 +126,55 @@ class DefaultMessagePublisherTest {
assertThat(admission.inFlight()).isZero();
}
@Test
void aDeadLetterPublishedThroughThisPublisherReachesTheTransportWithTheOriginalBytes() {
// given
DestinationName deadLetters = new DestinationName("order-events-dlq");
DefaultMessagePublisher publisher =
new DefaultMessagePublisher(
DestinationProfileRegistry.of(
Map.of(
ORDERS,
RuntimeFixtures.profile(ORDERS),
deadLetters,
RuntimeFixtures.profile(deadLetters))),
new DestinationAccessPolicy(
java.util.Set.of(deadLetters), java.util.Set.of(), java.util.Set.of()),
new SingleCodecRegistry(),
admission,
new FixedRuntimeRegistry(transport),
transport);
byte[] wireBytes = "{\"orderId\":\"o-1\"}".getBytes(StandardCharsets.UTF_8);
MessageDelivery<EncodedMessage> failed =
new MessageDelivery<>(
envelope()
.withPayload(new EncodedMessage(wireBytes, ContentType.JSON, Optional.empty())),
new DeliveryMetadata(
ORDERS,
3,
true,
Optional.empty(),
Optional.empty(),
Optional.of("order-projection"),
Instant.parse("2026-08-14T00:00:05Z")),
new DeliveryContext(Instant.parse("2026-08-14T00:00:35Z"), false, "order-projection"));
// when
new DeadLetterOrchestrator(publisher)
.deadLetter(
RuntimeFixtures.profile(ORDERS),
failed,
FailureDescriptor.of(FailureCategory.PERMANENT_BUSINESS, "ORDER_REJECTED", "rejected"),
() -> CompletableFuture.completedFuture(null))
.toCompletableFuture()
.join();
// then
assertThat(transport.lastRequest().envelope().payload().bytes())
.as("encoding an already-encoded payload again rewrites the bytes or fails the codec")
.containsExactly(wireBytes);
}
@Test
@DisplayName("an unregistered destination is rejected before anything is encoded")
void anUnregisteredDestinationIsRejected() {