Merge remote-tracking branch 'origin/claude/r9-g2-stomp-interceptor-f5675d' into claude/integration-r9-f1bc5c

충돌 하나를 정리했다.

- docs/upgrade/2026-11-maturity-review.md 머리 「커밋:」 줄: 앞서 합친 G3·G1
  항목을 두고, G2의 「STOMP channel interceptor를 사용자 전송으로 셈」을 끝에
  더했다(G2가 둔 자리도 끝이다).
This commit is contained in:
DongHyeonka
2026-11-07 10:01:06 +09:00
15 changed files with 354 additions and 34 deletions
+5
View File
@@ -501,6 +501,11 @@ ArchUnit 규칙이 **금지**하는 타입을 fixture 가 일부러 import 해
- `graphql-java` (`architectureTestCompileOnly`) — `SYSTEM_CALLERS_ARE_SYSTEM_DRIVEN_INBOUND_ADAPTERS`의
사용자 전송 타입 목록 중 `graphql..` 항목을 증명하는 fixture(`GraphQlJavaSystemCallerFixture`)가
graphql-java 타입 하나만 쓴다. runtime 은 GraphQL adapter 가 이미 같은 버전을 싣는다(lock 동일).
- `spring-messaging` (`architectureTestCompileOnly`) — 사용자 전송 타입 목록의 STOMP channel interceptor
항목(`ChannelInterceptor`·`ExecutorChannelInterceptor`)을 증명하는 위반 fixture
(`violations/configuration/stomp/`)와 허용 fixture(inbound channel 설정만 하는
`SystemCallerBesideStompBrokerSetupFixture`, 따로 둔 interceptor 설정 `FrameInterceptorConfigurationFixture`)가 쓴다. runtime 은 WebSocket adapter 가 이미 같은 버전을
싣는다(lock 동일).
- `spring-cloud-context` — `@RefreshScope` 금지(no-refresh-scope) fixture 용. Spring Cloud 는
production 에 없고 규칙은 애너테이션을 FQN 문자열로 참조한다. BOM 이 spring-cloud 좌표를 관리하지
않아 버전을 명시 고정한다.
+5
View File
@@ -282,6 +282,11 @@ dependencies {
// type list is a raw graphql-java data fetcher. The adapter brings graphql-java onto this source
// set's runtime already (capabilityProjects); compile-only here so no shipped graph changes.
architectureTestCompileOnly 'com.graphql-java:graphql-java'
// architecture-only: the STOMP fixtures for the channel-interceptor entries of the user-transport
// type list implement spring-messaging's ChannelInterceptor. The websocket adapter brings it onto
// this source set's runtime already (capabilityProjects); compile-only here so no shipped graph
// changes.
architectureTestCompileOnly 'org.springframework:spring-messaging'
// Kafka producer ownership lives in adapter:outbound:messaging. The composition root sees only
// the adapter module; it no longer implements the broker seam itself.
testCompileOnly 'jakarta.ws.rs:jakarta.ws.rs-api' // jakarta.ws.rs..
+1 -1
View File
@@ -361,7 +361,7 @@ org.springframework:spring-context:7.0.9=architectureTestCompileClasspath,archit
org.springframework:spring-core:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,qualificationRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.springframework:spring-expression:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,qualificationRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.springframework:spring-jdbc:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,qualificationRuntimeClasspath,systemTestCompileClasspath,testCompileClasspath,testRuntimeClasspath
org.springframework:spring-messaging:7.0.9=architectureTestRuntimeClasspath,bootRunH2Classpath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,qualificationRuntimeClasspath,testRuntimeClasspath
org.springframework:spring-messaging:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,qualificationRuntimeClasspath,testRuntimeClasspath
org.springframework:spring-orm:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,qualificationRuntimeClasspath,systemTestCompileClasspath,testCompileClasspath,testRuntimeClasspath
org.springframework:spring-test:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.springframework:spring-tx:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,qualificationRuntimeClasspath,systemTestCompileClasspath,testCompileClasspath,testRuntimeClasspath
@@ -460,9 +460,10 @@ class ApplicationBoundaryArchitectureTest {
/**
* The framework packages user-transport endpoints are built from, each with its subpackages.
* {@code org.springframework.messaging} is named only for STOMP ({@code simp}, {@code
* MessageMapping} in {@link #USER_TRANSPORT_TYPE_NAMES}): a broker listener's {@code @Payload}
* and {@code @Header} live beside them and are a system consumer's, not a user's.
* {@code org.springframework.messaging} is named only for STOMP ({@code simp} here; {@code
* MessageMapping} and the channel interceptors in {@link #USER_TRANSPORT_TYPE_NAMES}): a broker
* listener's {@code @Payload} and {@code @Header} live beside them and are a system consumer's,
* not a user's.
*
* <p>This is a list, unlike the package allowlist above: a transport library missing from it is
* not recognised as one. A service that brings in a new transport library adds its packages here
@@ -479,11 +480,18 @@ class ApplicationBoundaryArchitectureTest {
"jakarta.ws.rs",
"graphql");
/** The single user-transport types named beside the framework packages. */
/**
* The single user-transport types named beside the framework packages. A STOMP client-inbound
* channel interceptor sees every frame a client sends and needs no {@code simp} type to act on
* one, so the two interceptor types are named here (review 2026-11-07 RR8-02-01); the rest of
* their package is a broker's plumbing, not an endpoint.
*/
static final Set<String> USER_TRANSPORT_TYPE_NAMES =
Set.of(
"org.springframework.stereotype.Controller",
"org.springframework.messaging.handler.annotation.MessageMapping");
"org.springframework.messaging.handler.annotation.MessageMapping",
"org.springframework.messaging.support.ChannelInterceptor",
"org.springframework.messaging.support.ExecutorChannelInterceptor");
/**
* What makes a class a way in for a user request: a user-transport adapter package, or the
@@ -500,7 +508,9 @@ class ApplicationBoundaryArchitectureTest {
JavaClass.Predicates.resideInAnyPackage(
withSubpackages(USER_TRANSPORT_FRAMEWORK_PACKAGES)))
.or(namedAnyOf("user-transport annotations", USER_TRANSPORT_TYPE_NAMES))
.as("user-transport types (web, JAX-RS, GraphQL, gRPC, WebSocket/STOMP endpoints)");
.as(
"user-transport types (web, JAX-RS, GraphQL, gRPC, WebSocket/STOMP endpoints and"
+ " STOMP channel interceptors)");
/** Spring's configuration stereotype, which {@code @AutoConfiguration} carries as well. */
private static final String CONFIGURATION =
@@ -543,21 +553,27 @@ class ApplicationBoundaryArchitectureTest {
"io.grpc.ServerCallHandler",
"io.grpc.ServerInterceptor",
"io.grpc.ServerCall",
"io.grpc.stub.StreamObserver");
"io.grpc.stub.StreamObserver",
"org.springframework.messaging.support.ChannelInterceptor",
"org.springframework.messaging.support.ExecutorChannelInterceptor");
/**
* The framework types request-handling code is written against or registered with: an annotated
* controller, a functional route or handler function, a servlet, filter or handler interceptor, a
* WebSocket handler, a GraphQL data fetcher, runtime wiring or request interceptor, a gRPC
* service, call handler or server interceptor. A configuration that names one holds or registers
* request-handling code, and then the configuration is an endpoint: a route or data fetcher
* written as a lambda compiles into a method of the configuration itself (review 2026-11-05
* RR6-01-01), and a route registered by method reference names the same route builder although
* its handling code is in another class (review 2026-11-06 RR7-01-02). Class dependencies cannot
* tell that registration from handling code, so routes are registered in a configuration apart
* from the one that builds a system caller. The types a configuration names to set a transport up
* — {@link #ARE_TRANSPORT_SETUP_TYPES}, the controller beans it builds — do not count
* (RR4-01-02).
* service, call handler or server interceptor, a STOMP channel interceptor. A configuration that
* names one holds or registers request-handling code, and then the configuration is an endpoint:
* a route or data fetcher written as a lambda compiles into a method of the configuration itself
* (review 2026-11-05 RR6-01-01), a route registered by method reference names the same route
* builder although its handling code is in another class (review 2026-11-06 RR7-01-02). A
* configuration that is the channel interceptor it registers runs its own method on every client
* frame, and one that hands an interceptor out as a bean names the interceptor type as route
* registration names the builder (review 2026-11-07 RR8-02-01). Setting the inbound channel up
* names only {@code ChannelRegistration}, a setup type. Class dependencies cannot tell that
* registration from handling code, so routes and interceptors are registered in a configuration
* apart from the one that builds a system caller. The types a configuration names to set a
* transport up — {@link #ARE_TRANSPORT_SETUP_TYPES}, the controller beans it builds — do not
* count (RR4-01-02).
*
* <p>Only a configuration itself is read with this list; a class nested in one is read with the
* wider user-transport list (RR7-01-01). Like that list, this one is a list: a request-handler
@@ -802,13 +818,14 @@ class ApplicationBoundaryArchitectureTest {
+ "through (a user-transport package; a configuration that holds or registers "
+ "request-handling code such as a functional route, a data fetcher or an "
+ "interceptor; a class nested in a configuration built from a web, JAX-RS, "
+ "GraphQL, gRPC or WebSocket type other than a setup type such as "
+ "WebMvcConfigurer; any other class built from one of those types) does not "
+ "GraphQL, gRPC, WebSocket or STOMP type — a channel interceptor among them — "
+ "other than a setup type such as WebMvcConfigurer; any other class built from "
+ "one of those types) does not "
+ "reach a @SystemCaller or a "
+ "project type one extends or implements, directly or through other classes — "
+ "the system caller runs a @SystemInvoked write with no permission check. "
+ "Register routes in a configuration apart from the one that builds the system "
+ "caller. A user-triggered run of the same work is its own use case with "
+ "Register routes, data fetchers and interceptors in a configuration apart from "
+ "the one that builds the system caller. A user-triggered run of the same work is its own use case with "
+ "@RequiresPermission (manual 07 「시스템이 부르는 쓰기」)")
.allowEmptyShould(true);
@@ -13,12 +13,15 @@ import dev.caskeleton.bootstrap.architecture.allowed.adapter.inbound.messaging.S
import dev.caskeleton.bootstrap.architecture.allowed.adapter.inbound.messaging.SystemCallerWithNestedValueTypesFixture;
import dev.caskeleton.bootstrap.architecture.allowed.adapter.inbound.web.PingControllerFixture;
import dev.caskeleton.bootstrap.architecture.allowed.application.CleanProjectionQueryPort;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.FrameCountingInterceptorFixture;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.FrameInterceptorConfigurationFixture;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.OrderHandlerFixture;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.OrderRoutesConfigurationFixture;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.SystemCallerBesideControllerRegistrationFixture;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.SystemCallerBesideCorsMappingFixture;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.SystemCallerBesideCorsSourceFixture;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.SystemCallerBesideFieldReadingWebMvcConfigurerFixture;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.SystemCallerBesideStompBrokerSetupFixture;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.SystemCallerBesideWebMvcRegistrationFixture;
import dev.caskeleton.bootstrap.architecture.allowed.persistence.flyway.SchemaPolicyFlywayFixture;
import dev.caskeleton.bootstrap.architecture.fixtures.application.RootWriteTransactionBoundaryUseCase;
@@ -376,6 +379,37 @@ class ArchitectureViolationFixtureTest {
"dev.caskeleton.bootstrap.architecture.violations.configuration.jsr356",
"dev.caskeleton.bootstrap.architecture.allowed.adapter.inbound.messaging");
// RR8-02-01: a STOMP client-inbound channel interceptor runs on every frame a client sends, so it
// is a way in wherever it is kept — nested in a configuration, on its own, or the configuration
// itself — whether or not it reads a STOMP header, and a configuration handing one out as a bean
// is read as one registering routes is. Setting the inbound channel's threads up beside a system
// caller registers no interceptor and is setup; the interceptor bean in a configuration of its
// own passes.
private static final String STOMP_INTERCEPTOR_FIXTURES =
"dev.caskeleton.bootstrap.architecture.violations.configuration.stomp";
private static final JavaClasses STOMP_INTERCEPTORS_CALLING_A_SYSTEM_CALLER_FIXTURE_ONLY =
new ClassFileImporter()
.importPackages(
STOMP_INTERCEPTOR_FIXTURES,
"dev.caskeleton.bootstrap.architecture.allowed.adapter.inbound.messaging");
private static final JavaClasses SYSTEM_CALLER_BESIDE_STOMP_BROKER_SETUP_FIXTURE_ONLY =
new ClassFileImporter()
.importClasses(
SystemCallerBesideStompBrokerSetupFixture.class,
SystemCallerHandlerFixture.class,
SystemInvokedFixtureUseCase.class);
private static final JavaClasses INTERCEPTOR_APART_FROM_A_SYSTEM_CALLER_FIXTURE_ONLY =
new ClassFileImporter()
.importClasses(
FrameInterceptorConfigurationFixture.class,
FrameCountingInterceptorFixture.class,
SystemCallerHandlerRegistrationFixture.class,
SystemCallerHandlerFixture.class,
SystemInvokedFixtureUseCase.class);
// RR7-01-02: routes registered by method reference make their configuration an endpoint, so the
// configuration that also builds a system caller is caught and the same routes in a configuration
// of their own pass. A CORS setup naming RequestMethod is setup, in the configuration and in its
@@ -751,6 +785,52 @@ class ArchitectureViolationFixtureTest {
.contains(SystemCallerHandlerFixture.class.getName()));
}
@ParameterizedTest
@ValueSource(
strings = {
"RunNowOnFrameConfigurationFixture$1",
"RunNowOnFrameConfigurationFixture$RunNowAfterHandling",
"RunNowOnFrameInterceptorFixture",
"RunNowInterceptingConfigurationFixture",
"InterceptorBesideASystemCallerConfigurationFixture"
})
void aStompChannelInterceptorThatCallsASystemCallerIsCaughtWhereverItIsKept(String interceptor) {
// when
EvaluationResult result =
ApplicationBoundaryArchitectureTest.USER_TRANSPORTS_DO_NOT_REACH_SYSTEM_CALLERS.evaluate(
STOMP_INTERCEPTORS_CALLING_A_SYSTEM_CALLER_FIXTURE_ONLY);
// then
assertThat(result.getFailureReport().getDetails())
.anySatisfy(
detail ->
assertThat(detail)
.contains("<" + STOMP_INTERCEPTOR_FIXTURES + "." + interceptor + ">")
.contains(SystemCallerHandlerFixture.class.getName()));
}
@Test
void aStompBrokerSetUpBesideASystemCallerPasses() {
// when
EvaluationResult result =
ApplicationBoundaryArchitectureTest.USER_TRANSPORTS_DO_NOT_REACH_SYSTEM_CALLERS.evaluate(
SYSTEM_CALLER_BESIDE_STOMP_BROKER_SETUP_FIXTURE_ONLY);
// then
assertThat(result.getFailureReport().getDetails()).isEmpty();
}
@Test
void aChannelInterceptorHandedOutApartFromTheSystemCallersConfigurationPasses() {
// when
EvaluationResult result =
ApplicationBoundaryArchitectureTest.USER_TRANSPORTS_DO_NOT_REACH_SYSTEM_CALLERS.evaluate(
INTERCEPTOR_APART_FROM_A_SYSTEM_CALLER_FIXTURE_ONLY);
// then
assertThat(result.getFailureReport().getDetails()).isEmpty();
}
@Test
void aConfigurationThatRegistersMethodReferenceRoutesBesideASystemCallerIsCaught() {
// when
@@ -0,0 +1,18 @@
package dev.caskeleton.bootstrap.architecture.allowed.configuration;
import java.util.concurrent.atomic.AtomicLong;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.ChannelInterceptor;
/** A STOMP client-inbound channel interceptor that only counts the frames it sees. */
public final class FrameCountingInterceptorFixture implements ChannelInterceptor {
private final AtomicLong frames = new AtomicLong();
@Override
public Message<?> preSend(Message<?> message, MessageChannel channel) {
frames.incrementAndGet();
return message;
}
}
@@ -0,0 +1,20 @@
package dev.caskeleton.bootstrap.architecture.allowed.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.support.ChannelInterceptor;
/**
* A feature's channel interceptor bean in a configuration of its own, apart from the one that
* builds the message handler. Handing an interceptor out names a request-handler type, as
* registering a route does, so it does not sit beside a system caller (review 2026-11-07
* RR8-02-01).
*/
@Configuration(proxyBeanMethods = false)
public class FrameInterceptorConfigurationFixture {
@Bean
ChannelInterceptor frameCountingInterceptor() {
return new FrameCountingInterceptorFixture();
}
}
@@ -0,0 +1,32 @@
package dev.caskeleton.bootstrap.architecture.allowed.configuration;
import dev.caskeleton.bootstrap.architecture.allowed.adapter.inbound.messaging.SystemCallerHandlerFixture;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
/**
* One feature configuration: its STOMP broker and the client-inbound channel's threads, set up
* beside the feature's message handler. Setting the channel up registers no interceptor, so no
* client frame runs code of this configuration (review 2026-11-07 RR8-02-01).
*/
@Configuration(proxyBeanMethods = false)
public class SystemCallerBesideStompBrokerSetupFixture implements WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/topic");
}
@Override
public void configureClientInboundChannel(ChannelRegistration registration) {
registration.taskExecutor().corePoolSize(2);
}
@Bean
SystemCallerHandlerFixture systemCallerHandler() {
return new SystemCallerHandlerFixture();
}
}
@@ -1,10 +1,11 @@
/**
* "Allowed-as-data" composition for {@code USER_TRANSPORTS_DO_NOT_REACH_SYSTEM_CALLERS}: a
* feature's configuration that registers its message handler beside its web beans — a {@code
* WebMvcConfigurer}, a CORS setup, or the feature's controller. A configuration is the composition
* root, not a way a user request comes in, so naming a web type does not make it a user transport
* (review 2026-11-04 RR4-01-02); registering routes does, so the feature's routes sit in a
* configuration of their own (review 2026-11-06 RR7-01-02). Manual 09 「소비」 step 4 registers the
* handler in "this leaf's configuration class", which is where both kinds of bean meet.
* WebMvcConfigurer}, a CORS setup, a STOMP broker setup, or the feature's controller. A
* configuration is the composition root, not a way a user request comes in, so naming a web type
* does not make it a user transport (review 2026-11-04 RR4-01-02); registering routes does, so the
* feature's routes sit in a configuration of their own (review 2026-11-06 RR7-01-02), and so does
* its STOMP channel interceptor bean (review 2026-11-07 RR8-02-01). Manual 09 「소비」 step 4 registers
* the handler in "this leaf's configuration class", which is where both kinds of bean meet.
*/
package dev.caskeleton.bootstrap.architecture.allowed.configuration;
@@ -0,0 +1,29 @@
package dev.caskeleton.bootstrap.architecture.violations.configuration.stomp;
import dev.caskeleton.bootstrap.architecture.allowed.adapter.inbound.messaging.SystemCallerHandlerFixture;
import dev.caskeleton.bootstrap.architecture.allowed.configuration.FrameCountingInterceptorFixture;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.support.ChannelInterceptor;
/**
* Negative fixture for {@code USER_TRANSPORTS_DO_NOT_REACH_SYSTEM_CALLERS}: one feature
* configuration hands a channel interceptor out as a bean, the usual way to register one, and
* builds its message handler. The interceptor itself runs no job. Handing it out still names the
* interceptor type, a request-handler type, so the configuration is read as an endpoint that
* reaches the handler, as one registering routes is. The interceptor bean goes in a configuration
* of its own ({@code FrameInterceptorConfigurationFixture}) (review 2026-11-07 RR8-02-01).
*/
@Configuration(proxyBeanMethods = false)
public class InterceptorBesideASystemCallerConfigurationFixture {
@Bean
ChannelInterceptor frameCountingInterceptor() {
return new FrameCountingInterceptorFixture();
}
@Bean
SystemCallerHandlerFixture systemCallerHandler() {
return new SystemCallerHandlerFixture();
}
}
@@ -0,0 +1,33 @@
package dev.caskeleton.bootstrap.architecture.violations.configuration.stomp;
import dev.caskeleton.bootstrap.architecture.allowed.adapter.inbound.messaging.SystemCallerHandlerFixture;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.messaging.support.ChannelInterceptor;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
/**
* Negative fixture for {@code USER_TRANSPORTS_DO_NOT_REACH_SYSTEM_CALLERS}: a feature configuration
* that is itself the channel interceptor it registers. Its own method runs on each client frame, so
* the configuration is the endpoint, as one holding a route written as a lambda is (review
* 2026-11-07 RR8-02-01).
*/
@Configuration(proxyBeanMethods = false)
public class RunNowInterceptingConfigurationFixture
implements WebSocketMessageBrokerConfigurer, ChannelInterceptor {
private final SystemCallerHandlerFixture handler = new SystemCallerHandlerFixture();
@Override
public void configureClientInboundChannel(ChannelRegistration registration) {
registration.interceptors(this);
}
@Override
public Message<?> preSend(Message<?> message, MessageChannel channel) {
handler.handle();
return message;
}
}
@@ -0,0 +1,51 @@
package dev.caskeleton.bootstrap.architecture.violations.configuration.stomp;
import dev.caskeleton.bootstrap.architecture.allowed.adapter.inbound.messaging.SystemCallerHandlerFixture;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.messaging.support.ChannelInterceptor;
import org.springframework.messaging.support.ExecutorChannelInterceptor;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
/**
* Negative fixture for {@code USER_TRANSPORTS_DO_NOT_REACH_SYSTEM_CALLERS}: STOMP client-inbound
* channel interceptors a feature configuration registers beside the system caller it holds. Every
* frame a client sends passes through them, so each is a way a user request comes in, although the
* configuration names only setup types and neither interceptor reads a STOMP header (review
* 2026-11-07 RR8-02-01). The anonymous one runs the job before the frame is sent on, the nested one
* after the frame is handled on the channel's executor. Loaded with {@code importPackages}:
* spring-messaging is compile-only here.
*/
@Configuration(proxyBeanMethods = false)
public class RunNowOnFrameConfigurationFixture implements WebSocketMessageBrokerConfigurer {
private final SystemCallerHandlerFixture handler = new SystemCallerHandlerFixture();
@Override
public void configureClientInboundChannel(ChannelRegistration registration) {
registration.interceptors(
new ChannelInterceptor() {
@Override
public Message<?> preSend(Message<?> message, MessageChannel channel) {
handler.handle();
return message;
}
},
new RunNowAfterHandling());
}
/** Runs the job after each client frame is handled on the inbound channel's executor. */
public static final class RunNowAfterHandling implements ExecutorChannelInterceptor {
private final SystemCallerHandlerFixture job = new SystemCallerHandlerFixture();
@Override
public void afterMessageHandled(
Message<?> message, MessageChannel channel, MessageHandler handler, Exception failure) {
job.handle();
}
}
}
@@ -0,0 +1,23 @@
package dev.caskeleton.bootstrap.architecture.violations.configuration.stomp;
import dev.caskeleton.bootstrap.architecture.allowed.adapter.inbound.messaging.SystemCallerHandlerFixture;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.ChannelInterceptor;
/**
* Negative fixture for {@code USER_TRANSPORTS_DO_NOT_REACH_SYSTEM_CALLERS}: a STOMP client-inbound
* channel interceptor of its own, outside every user-transport package, that runs the job on each
* frame a client sends. It reads no STOMP header, so it names no {@code simp} type (review
* 2026-11-07 RR8-02-01).
*/
public final class RunNowOnFrameInterceptorFixture implements ChannelInterceptor {
private final SystemCallerHandlerFixture handler = new SystemCallerHandlerFixture();
@Override
public Message<?> preSend(Message<?> message, MessageChannel channel) {
handler.handle();
return message;
}
}