Files
clean-architecture-backend-…/docs/design/2026-09-18-deployment-composition-reachability-remediation.md
DongHyeonka 74108497d4 docs(records): 기록과 ADR 맨 위에 한국어 머리 블록을 단다
문제: 설계서·계획서·납품 패키지·증거·학습 문서와 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.
2026-11-07 12:23:32 +09:00

11 KiB
Raw Permalink Blame History

기록 · 설계서 본문은 쓴 때의 원문이다. 지금 동작은 「현재 정본」을 읽는다.

  • 상태: 확인 안 함
  • 작성일: 2026-09-18
  • 요약: 배포 조립에서 닿지 않던 구성 요소를 고치는 설계다.
  • 현재 정본: docs/capability-status.md

Deployment Composition Reachability Remediation

Goal

Close the deployment-composition gap identified by the 2026-09-18 tech-lead review without undoing the repository's structural optionality model.

The governing rule remains:

  • optional capability packages are excluded from broad component scanning;
  • one auto-configuration root owns each optional capability's reachability;
  • turning a capability off is a structural fact, not a condition repeated on every child bean.

This spec applies the review against the current checkout, not blindly against its 11:50Z snapshot.

Current-state corrections to the review snapshot

Already fixed after the review snapshot:

  • JPA leaf composition ownership and master gating;
  • notification leaf composition ownership;
  • Mongo health composition ownership;
  • HTTP client leaf root and AutoConfiguration.imports entry;
  • PostgreSQL idempotency store ownership;
  • canonical messaging bridge and outbox transport-only cutover;
  • RuntimeEnvironment/tracing policy SSOT;
  • full sample-portfolio check.

Still present and addressed here:

  1. application-wide Clock is supplied only by optional/dead configurations;
  2. bootstrap-owned Redis semantic, outbox, distributed-lock, idempotency and tracing composition roots are not all reachable through shipped AutoConfiguration.imports;
  3. HTTP client child configurations live inside the broad adapter component scan and can be discovered independently of the leaf master switch;
  4. the repository lacks generic reachability/parity checks that would make those defects hard to reintroduce.

Stage 0 — application Clock ownership

Clock is a cross-capability application infrastructure primitive. It must not be owned by an optional capability merely because that capability happened to need one first.

Add one always-discoverable bootstrap auto-configuration:

  • package: dev.caskeleton.bootstrap.autoconfigure.common;
  • class: BootstrapClockAutoConfiguration;
  • annotation: AutoConfiguration;
  • bean: Clock.systemUTC();
  • back-off: ConditionalOnMissingBean(Clock.class);
  • discovery: registered in app-bootstrap AutoConfiguration.imports.

Remove the Clock bean from IdempotencyConfig. Keep GraphQL's conditional clock fallback because the GraphQL leaf can be consumed without app-bootstrap; in the shipped application the bootstrap clock wins.

Required proof:

  • Boot ImportCandidates discovers BootstrapClockAutoConfiguration;
  • with no adopter Clock, exactly one Clock is created;
  • an adopter-supplied Clock wins;
  • idempotency no longer declares a Clock bean.

Stage 0 verified result

  • BootstrapClockAutoConfiguration is discoverable through Boot ImportCandidates and the shipped app-bootstrap AutoConfiguration.imports resource.
  • With no adopter override it supplies exactly one UTC Clock.
  • An adopter-provided Clock backs the default off.
  • IdempotencyConfig no longer declares a Clock bean.
  • GraphQL retains its ConditionalOnMissingBean fallback for standalone leaf use.
  • app-bootstrap unit and architecture regression passed; Spotless and git diff --check passed.
  • A production source scan finds exactly one app-bootstrap Clock bean provider: the common auto-configuration.

Stage 1 — bootstrap capability roots must be reachable

After Stage 0, repair only the bootstrap-owned capability composition roots that are still excluded from component scan and unreachable in the shipped application.

Before each root is registered, preserve its existing master/provider semantics. Do not make an all-off deployment create schedulers, workers, adapters, or settings.

Expected current targets include Redis semantic composition, outbox, distributed-lock, idempotency application composition/provider selection, and tracing. Each target must be evaluated from current code before registration; where a plain Configuration cannot safely be shipped as a root, introduce or convert to an AutoConfiguration root and keep child configurations behind it.

Idempotency requires special handling because EnableScheduling currently lives on IdempotencyConfig; scheduling must not become unconditional in an all-off deployment.

Stage 2 — HTTP client structural off boundary

HttpClientPlatformAutoConfiguration is the correct leaf root, but its imported child Configuration classes currently live in a package still scanned by CaSkeletonApplication.

Add the HTTP-client auto-configuration package to the structural scan-exclusion expression. Do not copy the master condition onto every child; the repository's chosen architecture is one excluded package plus one registered root.

Required proof:

  • HTTP client off through the real composition root produces no platform beans/settings;
  • HTTP client on reaches the registered root and its expected graph;
  • child configurations are not component-scan candidates in the shipped root.

Stage 3 — recurrence prevention

Add generic checks instead of capability-specific memories:

  1. auto-configuration import parity — shipped roots are discoverable through Boot ImportCandidates;
  2. scan-exclusion parity — configurations imported by structurally optional roots cannot also be independently component-scanned by CaSkeletonApplication;
  3. off import-filter parity — hard-coded Boot auto-configuration deny lists must be checked against the actual target classes they claim to cover.

These checks must test deployment reachability, not merely manually supply the configuration under test.

Non-goals

  • no POLLING_V2 activation;
  • no Redis semantic adapter redesign beyond composition reachability;
  • no global configuration namespace rewrite;
  • no sample-domain redesign;
  • no commit, stage or push;
  • no weakening of structural-off guarantees.

Stages 1–3 verified result

Shipped composition reachability

The real CaSkeletonApplication composition root is now the verification surface, not a manually supplied ApplicationContextRunner configuration.

The all-off system case starts successfully and creates none of the optional Redis, HTTP client, outbox relay, distributed-lock decorator, idempotency executor or tracing runtime beans.

The enabled cases also start from the shipped root:

  • Redis: the SDK root and semantic RedisCapabilitySettings are both reachable while semantic roles remain independently gated.
  • Tracing: enabling the tracing switch creates exactly one Tracer.
  • HTTP client: a concrete client definition reaches HttpClientPlatformAutoConfiguration, binds HttpClientPlatformSettings and creates one HttpServiceRegistry.
  • JDBC idempotency: the repository's official local H2 opt-out path reaches the JPA leaf store, application executor and scheduling processor.
  • Distributed lock: the H2/JPA path creates the real jdbcDistributedLock and the bootstrap distributedLockProvider. The system safety validator intentionally requires the other multi-instance coordination capabilities as a bundle, so this focused proof supplies only those unrelated sibling bean names while leaving both lock beans real.
  • Outbox: the H2/JPA path creates the real outbox store and outbox composition. Messaging remains enabled with the shipped Kafka provider path, but the external Kafka producer is replaced by a typed no-op test bean so reachability is not confused with broker/DNS availability. Relay remains explicitly disabled in this composition proof.

ShippedCompositionHarness now provides key-replacing all-off overrides and a unique in-memory H2 helper so the system cases do not depend on duplicate command-line option semantics or shared database state.

HTTP client structural off boundary

The HTTP client auto-configuration package is excluded from the broad application component scan, while HttpClientPlatformAutoConfiguration remains discoverable through its leaf AutoConfiguration.imports. The generic imported-child parity test proves component-scannable children of shipped roots remain behind the structural exclusion.

Recurrence prevention and Boot 4 drift found

The generic parity checks did not merely confirm the current tree; they found real stale hard-coded Spring Boot targets:

  • JPA referenced a non-candidate JpaBaseConfiguration and the old JpaRepositoriesAutoConfiguration name. The filter now targets the current DataJpaRepositoriesAutoConfiguration.
  • GraphQL used pre-Boot-4 security package names and omitted query-by-example candidates. Its deny list now matches the current Boot 4 GraphQL candidate family.
  • Messaging still listed the removed Rabbit annotation-driven auto-configuration and did not include Rabbit metrics. The defensive broker filter now matches the current Boot 4 Kafka and AMQP candidate sets.
  • Mongo already matched its current candidate family and required no production change.

The messaging adapter deliberately does not add Boot Kafka/AMQP auto-configuration modules to its production runtime. spring-boot-kafka and spring-boot-amqp are test-only dependencies so the optional adopter-compatibility filter can be checked against the actual Boot version. The messaging dependency lock was refreshed only for those test configurations.

The negative parity fixtures prove that a missing project import, a component-scanned imported child and a stale Boot filter target all fail closed.

Verification

Passed:

  • app-bootstrap test
  • app-bootstrap systemTest
  • adapter:inbound:graphql check
  • adapter:outbound:messaging check
  • adapter:outbound:httpclient check
  • verifyCleanArchitectureDependencies
  • sample-portfolio check
  • messaging and GraphQL Spotless checks
  • git diff --check

app-bootstrap Spotless reports only the pre-existing modified SecretReloadContractTest; the reachability files themselves were formatted with the repository Spotless configuration. The unrelated file was temporarily backed up while formatting and restored byte-for-byte with matching SHA-256 before and after.

app-bootstrap architectureTest is not a reachability failure. Compilation stops in the pre-existing modified ArchitectureViolationFixtureTest because an earlier edit removed the closing text of a multiline Javadoc code tag, producing four Error Prone UnrecognisedJavadocTag warnings under -Werror. This slice leaves that unrelated worktree change untouched, so the architecture regression remains explicitly unverified rather than being reported as green.

2026-09-19 regression closure

The previously unverified app-bootstrap architecture regression is now green. The shared-worktree Javadoc syntax error in ArchitectureViolationFixtureTest was repaired without changing any rule. Two genuine violations in the newly added PublishNextOutboxDeliveryUseCase were also corrected: its declared transaction mode now matches the existing REQUIRES_NEW transaction boundary, and the class is proxyable for RequiresPermission.

Final affected gate:

  • app-bootstrap Spotless: PASS;
  • app-bootstrap unit test: PASS;
  • app-bootstrap architectureTest: PASS (178 tests);
  • direct bootstrap WARN/ERROR structured-field inventory: PASS;
  • git diff --check: PASS.