Files
document-haness/docs/clean-architecture-backend-template/final/evidence/raw/249-messaging-startup-profile-validation.txt
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

61 lines
4.0 KiB
Plaintext

# evidence 249 — messaging-startup-profile-validation
# revision: a24ece9cf797f7ea647e33bf846b115208ed1ba5
# cwd: /shared/codebase/clean-architecture-backend-template/src/messaging
# command: sed -n "1,45p" messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/StartupProfileValidation.java; echo; echo ---StartupProfileValidation bean sites---; grep -rn "StartupProfileValidation" --include=*.java */src/main
# ---- raw output ----
package dev.caskeleton.messaging.autoconfigure;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.springframework.beans.factory.InitializingBean;
/**
* Applies one profile validator to every profile of its kind at startup.
*
* <p>The Kafka, RabbitMQ and security validators were all beans and none of them was injected
* anywhere: the context published a validator per broker and validated nothing. A profile that
* promises a guarantee its broker cannot give — an exactly-once claim on a non-transactional
* producer, a quorum ack on a single replica, a plaintext credential on a production listener —
* then boots cleanly and fails on the first message that depends on it, which is the wrong place to
* find out.
*
* <p>Validation runs as {@code afterPropertiesSet} rather than on an application event, so the
* failure happens while the context is still being built and the profile bean that caused it is
* named in the stack.
*
* <p>The profiles arrive through a supplier rather than an {@code ObjectProvider} because there are
* now two sources of them — beans an application declares and profiles compiled from {@code
* app.messaging} — and a validator that saw only one of the two would leave the other half of a
* deployment's configuration unchecked. Which half went unchecked would depend on how the
* deployment happened to be written, which is the worst possible rule.
*
* @param <T> the profile type this instance validates
*/
final class StartupProfileValidation<T> implements InitializingBean {
private final Supplier<List<T>> profiles;
private final Consumer<T> validator;
StartupProfileValidation(Supplier<List<T>> profiles, Consumer<T> validator) {
this.profiles = Objects.requireNonNull(profiles, "profiles must not be null");
this.validator = Objects.requireNonNull(validator, "validator must not be null");
}
@Override
public void afterPropertiesSet() {
profiles.get().forEach(validator);
}
---StartupProfileValidation bean sites---
messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/KafkaMessagingAutoConfiguration.java:54: public StartupProfileValidation<dev.caskeleton.messaging.kafka.KafkaBrokerProfile>
messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/KafkaMessagingAutoConfiguration.java:59: return new StartupProfileValidation<>(
messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/MessagingCoreAutoConfiguration.java:216: public StartupProfileValidation<dev.caskeleton.messaging.security.BrokerSecurityProfile>
messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/MessagingCoreAutoConfiguration.java:221: return new StartupProfileValidation<>(
messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/RabbitMessagingAutoConfiguration.java:48: public StartupProfileValidation<dev.caskeleton.messaging.rabbit.RabbitBrokerProfile>
messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/RabbitMessagingAutoConfiguration.java:55: return new StartupProfileValidation<>(
messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/StartupProfileValidation.java:31:final class StartupProfileValidation<T> implements InitializingBean {
messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/StartupProfileValidation.java:37: StartupProfileValidation(Supplier<List<T>> profiles, Consumer<T> validator) {