From 27f23add08f89d82e1ae8fb22c44132017aeaf92 Mon Sep 17 00:00:00 2001 From: donghyeon-ka Date: Tue, 29 Sep 2026 17:01:54 +0900 Subject: [PATCH] =?UTF-8?q?review-followup=20Wave=203:=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20prefix=20app.*=20=ED=86=B5=EC=9D=BC(P20),=20Wave=20?= =?UTF-8?q?3=20=EC=A2=85=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 결정 16: `ca-skeleton.*`·`backend.graphql` 등 → `app.*`(APP_* env 키 이름 유지), selector 키 상수 하나(`CapabilitySelectors`), 바인딩만 되던 `streaming-idle` 삭제 - `StrictSettingsBinder`가 env 오타까지 거부 — 모든 capability(graphql·websocket·mongo는 edge 제약으로 파일만 strict), httpclient 리플렉션 `HttpClientEnvironmentKeys` 삭제 - persistence-jpa가 `APP_DATASOURCE_PASSWORD` secret 요구를 기여(bootstrap이 JPA 스위치를 읽지 않음), Redis ACL fixture에서 pub/sub 권한 제거 - 결함 수정: SMTP 설정 env 이름 충돌(P20-new-1), `bindExcept`가 system env까지 filter(P20-new-2), graphql 빈 deployment-mode 메시지(P20-new-6) - 통합: P30과 충돌 11건(P30의 명시적 bean 구조 유지), P30 코드의 옛 키를 app.*로, persistence-jpa 포맷 - 현황표: 소유자 결정 36(persistence-jpa 설정은 플랫폼 키만 app.persistence-jpa.*로, 공유 기능 트리 예외), 재개 문서에 일시 정지 상태 Wave 3 종료 검증: check · ci verifyDependencyLocks --warning-mode=fail(714 task) · mainCheck · architectureCheck verifyPublicPathSnapshot :app-bootstrap:verifyEnvKeys configContractCheck · :app-bootstrap:integrationTest :sample-portfolio:integrationTest :sample-portfolio:systemTest · integrationCheck · -p build-logic test · -p optional-platforms ci · :app-bootstrap:qualificationBootJar releaseCheck 통과 Co-Authored-By: Claude Opus 5.5 (1M context) --- docs/capability-status.md | 7 + .../grpc-advanced-support-matrix.md | 2 +- docs/fileserver/configuration.md | 6 +- docs/fileserver/design-deviations.md | 2 +- docs/fileserver/upgrade-guide.md | 8 +- docs/httpclient/configuration-reference.md | 1 - docs/httpclient/env-fields.yaml | 8 +- docs/messaging/configuration-reference.md | 2 +- docs/mongodb/support-matrix.md | 2 +- docs/notification/at-rest-threat-model.md | 2 +- docs/notification/configuration-reference.md | 6 +- docs/registries/env-keys.yaml | 66 ++--- docs/registries/secrets-classification.yaml | 33 +-- .../W3-P20.md | 99 ++++++++ .../2026-09-25-review-followup-status.md | 21 +- ...026-09-28-review-followup-resume-prompt.md | 11 + docs/runbooks/grpc-advanced-capabilities.md | 2 +- docs/runbooks/grpc-platform-operations.md | 8 +- docs/runbooks/outbox-publish-failed.md | 4 +- docs/security/public-paths-snapshot.txt | 2 +- .../plans/2026-09-25-review-followup.md | 5 +- docs/web/advanced-capabilities.md | 6 +- docs/web/repository-adaptation.md | 4 +- docs/web/runbook.md | 2 +- docs/web/streaming-contract.md | 2 +- docs/web/virtual-thread-profile.md | 2 +- infra/redis-sdk/acl/all-accounts.acl | 4 +- infra/redis-sdk/acl/application-advanced.acl | 2 +- infra/redis-sdk/acl/application.acl | 2 +- scripts/verify-httpclient-docs.py | 4 +- src/README.md | 6 +- src/adapter/inbound/graphql/CLAUDE.md | 2 +- src/adapter/inbound/graphql/README.md | 6 +- src/adapter/inbound/graphql/build.gradle | 4 +- ...hQlActivationEnvironmentPostProcessor.java | 50 +++- .../autoconfigure/GraphQlDeploymentMode.java | 2 +- .../GraphQlExecutionChainConfiguration.java | 6 +- .../GraphQlPlatformSettings.java | 37 ++- .../GraphQlPlatformStartupValidator.java | 12 +- .../GraphQlRequestContextConfiguration.java | 4 +- .../GraphQlRetiredSafetyAxis.java | 18 +- .../GraphQlRootAutoConfiguration.java | 6 +- .../src/main/resources/config/graphql.yml | 6 +- .../GraphqlHttpBoundaryQualificationTest.java | 4 +- .../GraphQlPlatformExecutionPathTest.java | 10 +- .../GraphQlBatchLoaderWiringTest.java | 3 +- .../GraphQlCapabilityActivationTest.java | 14 ++ .../GraphQlDeploymentModeContractTest.java | 58 +++-- .../GraphQlObservationWiringTest.java | 3 +- .../GraphQlPlatformAutoConfigurationTest.java | 39 ++- .../GraphQlPolicyRequestPathTest.java | 3 +- ...atformWebInterceptorRequestBoundsTest.java | 3 +- .../GraphQlRequestStageErrorMappingTest.java | 3 +- src/adapter/inbound/grpc/CLAUDE.md | 6 +- src/adapter/inbound/grpc/README.md | 6 +- .../inbound/grpc/GrpcServerConfig.java | 6 +- .../inbound/grpc/GrpcServerSettings.java | 4 +- .../inbound/grpc/GrpcP1BoundaryWireTest.java | 10 +- .../inbound/grpc/GrpcSafeActivationTest.java | 48 ++-- .../grpc/GrpcServerRunnerBootTest.java | 18 +- src/adapter/inbound/web-advanced/README.md | 6 +- .../mvc/MvcJsonSequenceConfiguration.java | 2 +- .../MvcStreamingExecutorConfiguration.java | 5 +- .../mvc/VirtualThreadMvcConfiguration.java | 2 +- .../advanced/mvc/VirtualThreadSettings.java | 4 +- .../mvc/MvcAdvancedConfigurationTest.java | 30 +-- .../release/WebAdvancedRollbackIT.java | 4 +- .../NotificationWebAutoConfiguration.java | 2 +- .../CallbackMvcSecurityConfiguration.java | 2 +- .../CallbackRequestConfiguration.java | 2 +- .../NotificationCallbackMvcController.java | 5 +- .../NotificationSubmissionController.java | 2 +- .../NotificationTemplateController.java | 2 +- .../NotificationWebAutoConfigurationTest.java | 8 +- .../CallbackRequestConfigurationTest.java | 2 +- src/adapter/inbound/web/README.md | 4 +- .../inbound/web/auth/JwtDecoderConfig.java | 5 +- .../web/auth/RedisSessionWebConfig.java | 2 +- .../inbound/web/auth/SecurityConfig.java | 2 +- .../web/authz/RolePermissionPolicy.java | 8 +- .../WebMvcPlatformAutoConfiguration.java | 2 +- .../autoconfigure/WebMvcPlatformSettings.java | 4 +- .../EdgeRateLimitTransportSettings.java | 2 +- .../inbound/web/settings/CorsSettings.java | 16 +- .../web/settings/PresentationSettings.java | 6 +- .../web/settings/SecuritySettings.java | 7 +- .../CorsSecurityFilterIntegrationTest.java | 24 +- .../JwtJwksSecurityFilterIntegrationTest.java | 10 +- .../web/auth/RedisSessionWebConfigTest.java | 15 +- .../web/auth/SecurityModeWebContractTest.java | 32 +-- .../web/authz/RolePermissionPolicyTest.java | 8 +- .../RequestBodyBoundaryTest.java | 2 +- .../WebMvcPlatformAutoConfigurationTest.java | 2 +- .../web/settings/CorsSettingsTest.java | 40 +-- .../settings/PresentationSettingsTest.java | 4 +- .../web/settings/SecuritySettingsTest.java | 19 +- .../resources/application-web-contract.yaml | 2 +- .../websocket/stomp/WebSocketSettings.java | 2 +- .../stomp/WebSocketSettingsTest.java | 15 ++ src/adapter/outbound/cache-redis/README.md | 14 +- .../redis/capability/RedisCacheConfig.java | 5 +- .../capability/RedisCapabilityConfig.java | 20 +- .../capability/RedisCapabilitySettings.java | 44 +++- .../RedisCorrectnessRoleSelectors.java | 11 +- .../capability/RedisIdempotencyConfig.java | 9 +- .../redis/capability/RedisLeaseConfig.java | 3 +- .../capability/RedisRateLimitConfig.java | 11 +- .../config/module-defaults/cache-redis.yml | 2 - .../RedisCapabilityCompositionTest.java | 63 +++-- .../RedisProductionSecretsTest.java | 13 +- .../RedisReadinessGroupPostProcessorTest.java | 4 +- .../HttpClientEnvironmentKeys.java | 179 ------------- .../HttpClientPlatformSettings.java | 3 +- .../HttpClientPlatformSettingsBinder.java | 23 +- .../HttpClientProfileFactory.java | 3 +- .../httpclient/profile/TimeoutSettings.java | 7 +- .../HttpClientPlatformEnvManifestTest.java | 50 +++- .../httpclient/testkit/ClientProfiles.java | 6 +- .../outbound/messaging/MessagingConfig.java | 2 - .../outbound/messaging/MessagingSettings.java | 38 ++- .../MessagingBridgeRootAutoConfiguration.java | 14 +- ...ngPlatformBridgeAutoConfigurationTest.java | 34 +++ .../notification/NotificationConfig.java | 21 +- .../NotificationRoutesSettings.java | 6 +- ...ionActivationEnvironmentPostProcessor.java | 4 +- .../NotificationCallbackProviderConfig.java | 2 +- ...NotificationPlatformAutoConfiguration.java | 7 +- .../NotificationPlatformCodecConfig.java | 2 +- .../NotificationPlatformCoreConfig.java | 29 ++- .../NotificationPlatformDispatchConfig.java | 2 +- ...tificationPlatformObservabilityConfig.java | 2 +- .../NotificationPlatformPolicyConfig.java | 2 +- .../NotificationPlatformProviderConfig.java | 2 +- .../NotificationPlatformRegistriesConfig.java | 2 +- .../NotificationPlatformRuntimeConfig.java | 2 +- .../NotificationPlatformSecretsConfig.java | 23 +- .../NotificationPlatformSettings.java | 5 +- .../NotificationPlatformWorkerConfig.java | 4 +- .../NotificationProviderAssembly.java | 2 +- .../NotificationSmtpProviderConfig.java | 22 +- .../NotificationSmtpSettings.java | 26 +- ...ficationLegacyNamespaceRetirementTest.java | 6 +- ...ficationPlatformCoreConfigurationTest.java | 75 +++--- .../NotificationPlatformSettingsTest.java | 6 +- .../NotificationWorkerLifecycleTest.java | 2 +- src/adapter/outbound/objectstorage/CLAUDE.md | 7 +- .../outbound/objectstorage/build.gradle | 3 +- .../config/ObjectStorageCapabilityConfig.java | 18 +- .../ObjectStorageCapabilitySettings.java | 35 ++- .../ObjectStorageCapabilityConfigTest.java | 20 ++ .../outbound/persistence-jpa/CLAUDE.md | 10 +- .../outbound/persistence-jpa/README.md | 14 +- .../autoconfigure/JpaAdapterBeansConfig.java | 16 +- .../PersistenceJpaAutoConfiguration.java | 18 +- .../PersistenceJpaRuntimeConfig.java | 2 +- .../PostgreSqlIdempotencyStoreConfig.java | 11 +- .../config/PersistenceVendorSettings.java | 19 +- .../persistence/h2/H2PersistenceConfig.java | 4 +- .../idempotency/jpa/IdempotencyReaper.java | 2 +- .../postgresql/IdempotencySchemaStream.java | 4 +- .../DistributedLockPersistenceConfig.java | 30 ++- .../persistence/lock/LockSettings.java | 34 ++- .../persistence/outbox/jpa/OutboxReaper.java | 2 +- ...JpaActivationEnvironmentPostProcessor.java | 3 +- .../startup/JpaSafetySettings.java | 17 +- .../startup/JpaStartupAutoConfiguration.java | 29 ++- .../startup/MigrationStartupRunner.java | 6 +- .../PersistenceVendorProdSafetyValidator.java | 10 +- .../module-defaults/persistence-jpa.yml | 8 +- .../readiness/OutboxIntegrationSupport.java | 2 +- .../IdempotencyReaperWiringTest.java | 4 +- .../JpaLiveEventReplayActivationTest.java | 13 +- .../autoconfigure/OutboxReaperWiringTest.java | 14 +- .../OutboxSwitchWiringContractTest.java | 2 +- .../PersistenceJpaAutoConfigurationTest.java | 19 +- .../PersistenceJpaCapabilityAssemblyTest.java | 14 +- .../PersistenceJpaRuntimeConfigTest.java | 4 +- .../PostgreSqlIdempotencyStoreConfigTest.java | 8 +- .../PersistenceVendorSelectionTest.java | 27 +- .../DistributedLockPersistenceConfigTest.java | 19 +- ...ctivationEnvironmentPostProcessorTest.java | 8 +- .../JpaStartupAutoConfigurationTest.java | 52 +++- .../outbound/persistence-mongo/CLAUDE.md | 4 +- .../outbound/persistence-mongo/README.md | 12 +- ...MongoDefaultsEnvironmentPostProcessor.java | 15 +- .../mongo/MongoPersistenceConfig.java | 2 +- .../mongo/MongoPersistenceSettings.java | 4 +- .../mongo/MongoRootAutoConfiguration.java | 4 +- .../autoconfigure/MongoPlatformSettings.java | 4 +- ...rofileClientSettingsAutoConfiguration.java | 2 +- .../src/main/resources/config/mongo.yml | 6 +- .../mongo/MongoConnectionSourceRuleTest.java | 14 +- .../mongo/MongoPersistenceConfigTest.java | 25 +- .../MongoDriverObservabilityWiringTest.java | 2 +- .../MongoPlatformWiringTest.java | 4 +- ...leClientSettingsAutoConfigurationTest.java | 12 +- .../NotificationJpaPersistenceConfig.java | 5 +- .../NotificationSchemaActivation.java | 2 +- .../NotificationJpaPersistenceFacade.java | 5 +- ...NotificationPersistenceActivationTest.java | 4 +- .../RedisRuntimeAutoConfigurationTest.java | 3 +- .../outbound/support/CapabilitySelectors.java | 31 +++ .../support/StrictSettingsBinder.java | 237 ++++++++++++++---- .../support/StrictSettingsBinderTest.java | 102 ++++++++ src/app-bootstrap/README.md | 10 +- .../FileserverCompositionIntegrationTest.java | 5 +- ...SqlIdempotencyProviderIntegrationTest.java | 2 +- ...jectStorageCompositionIntegrationTest.java | 2 +- ...leOperationCompositionIntegrationTest.java | 4 +- .../async/AsyncExecutorSettings.java | 14 +- .../operation/DurableOperationConfig.java | 4 +- .../runtime/SecretSourceSettings.java | 6 +- .../runtime/SecretSourceStrategy.java | 4 +- .../runtime/SecretSourceValidator.java | 36 +-- .../security/AuthenticationModeSettings.java | 2 +- .../bootstrap/settings/BootstrapSettings.java | 7 +- .../bootstrap/settings/LoggingSettings.java | 8 +- .../settings/RuntimeSafetySettings.java | 4 +- .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application-local.yml | 4 +- .../src/main/resources/application-prod.yml | 2 +- .../main/resources/config/observability.yml | 2 +- .../src/main/resources/config/runtime.yml | 4 +- .../src/main/resources/config/security.yml | 2 +- ...strapCapabilityReachabilitySystemTest.java | 2 +- .../ShippedCompositionHarness.java | 12 +- .../async/AsyncExecutorConfigTest.java | 6 +- .../async/AsyncExecutorSettingsTest.java | 8 +- .../jpa/LocalJpaVendorParityTest.java | 7 +- .../contract/ActuatorSecurityHttpTest.java | 2 +- .../ConfigurationNamespaceContractTest.java | 154 ++++++------ .../ProfileSeparationContractTest.java | 6 +- .../StructuredLogFieldContractTest.java | 2 +- .../TracingActivationContextTest.java | 8 +- .../MessagingAuthorityContractTest.java | 7 +- .../support/ShippedConfiguration.java | 4 +- .../runtime/SecretSourceValidatorTest.java | 17 +- .../runtime/StartupSafetyValidatorTest.java | 6 +- ...thenticationModeCompositionConfigTest.java | 8 +- .../PublicHealthPathAgreementTest.java | 9 +- .../security/PublicPathSnapshotTest.java | 2 +- .../settings/BootstrapSettingsTest.java | 4 +- .../settings/LoggingSettingsTest.java | 44 ++-- .../src/test/resources/application-test.yml | 5 +- src/application-core/CLAUDE.md | 2 +- src/application-core/README.md | 2 +- src/composition/idempotency/README.md | 4 +- .../IdempotencyAutoConfiguration.java | 18 +- .../idempotency/IdempotencySettings.java | 9 +- .../config/module-defaults/idempotency.yml | 2 +- .../IdempotencyAutoConfigurationTest.java | 12 +- .../IdempotencyModuleDefaultsTest.java | 4 +- .../idempotency/IdempotencySettingsTest.java | 11 +- .../notification-platform/README.md | 2 +- ...plicationCompositionAutoConfiguration.java | 2 +- .../NotificationSubmissionConfiguration.java | 2 +- .../config/module-defaults/notification.yml | 10 +- ...ationCompositionAutoConfigurationTest.java | 2 +- .../NotificationModuleDefaultsTest.java | 16 +- src/composition/outbox-relay/README.md | 12 +- src/composition/outbox-relay/build.gradle | 2 +- .../outbox/OutboxRelayAutoConfiguration.java | 12 +- .../outbox/OutboxRelayScheduler.java | 2 +- .../composition/outbox/OutboxSettings.java | 8 +- .../OutboxRelayAutoConfigurationTest.java | 19 +- .../outbox/OutboxSettingsTest.java | 18 +- src/composition/service-runtime/README.md | 8 +- .../runtime/logging/PrivacySettings.java | 24 +- .../logging/PseudonymizationConfig.java | 8 +- .../runtime/tracing/TracingConfig.java | 15 +- ...acingSamplingEnvironmentPostProcessor.java | 2 +- .../runtime/tracing/TracingSettings.java | 22 +- .../ServiceRuntimeRegistrationTest.java | 25 +- .../runtime/logging/PrivacySettingsTest.java | 16 +- .../logging/PseudonymizationConfigTest.java | 2 +- ...gSamplingEnvironmentPostProcessorTest.java | 2 +- .../runtime/tracing/TracingSettingsTest.java | 78 +++--- src/grpc-advanced/CLAUDE.md | 2 +- src/grpc-advanced/grpc-advanced/build.gradle | 2 +- .../bootstrap/GrpcAdvancedCapability.java | 4 +- .../GrpcAdvancedModuleGuardTest.java | 5 +- .../boot/GrpcPlatformAutoConfiguration.java | 2 +- .../grpc/boot/GrpcPlatformProperties.java | 4 +- .../boot/GrpcPlatformStartupValidator.java | 2 +- ...cPlatformAutoConfigurationContextTest.java | 36 +-- src/sample-portfolio/README.md | 6 +- ...ampleIdempotencyReplayIntegrationTest.java | 2 +- .../src/main/resources/application.yml | 13 +- .../systemTest/resources/application-test.yml | 6 +- .../web/versioning/VersioningPrefixTest.java | 2 +- .../SamplePublicAccessSecurityConfigTest.java | 4 +- .../contract/OpenApiDriftContractTest.java | 4 +- .../web/date/DateHeaderContractTest.java | 4 +- .../web/filter/VirtualThreadMdcE2ETest.java | 4 +- .../web/openapi/OpenApiSnapshotTest.java | 4 +- 295 files changed, 2284 insertions(+), 1484 deletions(-) create mode 100644 docs/reviews/2026-09-25-review-followup-results/W3-P20.md delete mode 100644 src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientEnvironmentKeys.java create mode 100644 src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/CapabilitySelectors.java diff --git a/docs/capability-status.md b/docs/capability-status.md index 43e112cc..e3dcd686 100644 --- a/docs/capability-status.md +++ b/docs/capability-status.md @@ -519,3 +519,10 @@ web 경로의 `W/`는 `src/adapter/inbound/web/src/main/java/dev/caskeleton/adap | `PersistenceEntityScanCoverageTest.operationAndLiveEventAdaptersAreScanned` | `src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceEntityScanCoverageTest.java` | `0ebb77b5` | 같은 이유(스캔 목록 고정) — `JpaAdapterBeansConfigTest.everyAdapterTheScanUsedToRegisterIsDeclaredAsABean`로 대체 | | `MongoPlatformWiringTest.theMappingConfigurationCarriesThePlatformSwitch`·`thePlatformIsOffUnlessTheSwitchIsOn` | `src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoPlatformWiringTest.java` | `0ebb77b5` | 반복 스위치를 고정하던 테스트 — 반복 조건을 없애고 ArchUnit 두 규칙으로 대체 | | `PortfolioEventContracts` | `src/sample-portfolio/src/main/java/dev/caskeleton/sample/portfolio/application/event/PortfolioEventContracts.java` | `0ebb77b5` | 공유 registry가 `event` → 모든 기능 역방향 의존 — `poster/PosterEventContracts`·`posterimage/PosterImageEventContracts`로 분할, `all()`은 테스트로(S6-#10a, `62a669c8`) | +| `HttpClientEnvironmentKeys`(설정 record 트리를 리플렉션으로 순회해 env 이름 역산·거부) | `src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientEnvironmentKeys.java` | `0ebb77b5` | S3-lead-2: env 오타 거부를 `StrictSettingsBinder`가 모든 capability에 대해 한다. manifest 도출은 `HttpClientPlatformEnvManifestTest`로 | +| `StrictSettingsBinder.bind(env, prefix, type, Predicate)` overload | `src/adapter/outbound/support/.../StrictSettingsBinder.java` | `0ebb77b5` | httpclient 전용 우회였다. system env 제외가 기본 동작이 됨 | +| 설정 키 `app.httpclient.clients[N].timeout.streaming-idle`(`APP_HTTPCLIENT_CLIENTS_N_TIMEOUT_STREAMING_IDLE`)과 `TimeoutSettings.streamingIdle`·`HttpClientPlatformSettings.Timeout.streamingIdle` | `src/adapter/outbound/httpclient/.../profile/TimeoutSettings.java`, `docs/httpclient/env-fields.yaml` | `0ebb77b5` | P11-new-1: 바인딩만 되고 읽는 곳 없음(capability 규칙 3) | +| yml 키 `ca-skeleton.rate-limit.{limit,window,algorithm}` | `src/app-bootstrap/src/test/resources/application-test.yml`, `src/sample-portfolio/src/systemTest/resources/application-test.yml` | `0ebb77b5` | 읽는 코드 없음. `app.rate-limit` 아래로 옮기면 web `EdgeRateLimitTransportSettings` 트리에 섞인다 | +| `SecretSourceValidator`의 `RELATIONAL_PERSISTENCE_PROPERTY`·`isRelationalPersistenceOn()`(모듈 스위치 해석) | `src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidator.java` | `0ebb77b5` | P22-new-1: persistence-jpa가 기여 | +| 설정 키 `app.notification.platform.smtp.max-concurrency`(이름 변경 → `dispatch-concurrency`, env `APP_NOTIFICATION_PLATFORM_SMTP_DISPATCH_CONCURRENCY` 그대로) | `NotificationSmtpSettings.java`, `notification.yml` | `0ebb77b5` | P20-new-1 | +| Redis ACL `+@pubsub`·`&prod:*`(application 계정 2개) | `infra/redis-sdk/acl/*.acl` | `0ebb77b5` | P22-new-2 | diff --git a/docs/compatibility/grpc-advanced-support-matrix.md b/docs/compatibility/grpc-advanced-support-matrix.md index 7660104d..9df35cbf 100644 --- a/docs/compatibility/grpc-advanced-support-matrix.md +++ b/docs/compatibility/grpc-advanced-support-matrix.md @@ -4,7 +4,7 @@ Every capability in `:grpc-advanced:*`, its grade, and what it would take to rai `GrpcAdvancedSupportMatrix` is the machine-readable form; `GrpcAdvancedCapability.defaultGrade` carries the same values. -All capabilities are off by default. Flags are `ca-skeleton.grpc.advanced..enabled`. +All capabilities are off by default. Flags are `app.grpc.advanced..enabled`. ## Grades diff --git a/docs/fileserver/configuration.md b/docs/fileserver/configuration.md index 96fa86bd..72bed55b 100644 --- a/docs/fileserver/configuration.md +++ b/docs/fileserver/configuration.md @@ -14,8 +14,8 @@ exposes. ## Minimum to start ```yaml -ca-skeleton: - fileserver: +app: + fileserver-platform: enabled: true instance-id: ${HOSTNAME} # writer-lease owner; must be unique per node storage: @@ -47,7 +47,7 @@ Startup fails, rather than degrading, when any of these is missing or unsafe: These roles decide the tier inside each operation. In front of it, every operation's use case carries a `file:*` permission that the web adapter's method security checks against -`ca-skeleton.authz.role-permissions`; `security.yml` grants `file:read` to `ROLE_FILE_READ`, +`app.authz.role-permissions`; `security.yml` grants `file:read` to `ROLE_FILE_READ`, `file:upload`, `file:delete`, `file:copy` and `file:move` to `ROLE_FILE_WRITE`, and `file:admin` to `ROLE_FILE_ADMIN`. Renaming a tier role here means mapping the new name there as well, or the caller is refused before the tier is consulted (`docs/fileserver/design-deviations.md` §5). diff --git a/docs/fileserver/design-deviations.md b/docs/fileserver/design-deviations.md index 17124522..0bf0a744 100644 --- a/docs/fileserver/design-deviations.md +++ b/docs/fileserver/design-deviations.md @@ -198,7 +198,7 @@ append, finalize, cancel, the single-request upload), `file:delete`, `file:copy` `ROLE_FILE_WRITE` and `ROLE_FILE_ADMIN` — the fileserver's own default tier roles — so a caller holding a tier holds its permissions. A deployment that renames the tier roles, or supplies its own `FileAccessPolicyPort` under other role names, maps those names in -`ca-skeleton.authz.role-permissions` too; `security.access-policy: unenforced` relaxes only the +`app.authz.role-permissions` too; `security.access-policy: unenforced` relaxes only the tier and ownership check, never the permission gate. The resumable transfers run on the transfer pool, and method security reads the security context diff --git a/docs/fileserver/upgrade-guide.md b/docs/fileserver/upgrade-guide.md index b430a097..e9bbf8bf 100644 --- a/docs/fileserver/upgrade-guide.md +++ b/docs/fileserver/upgrade-guide.md @@ -6,8 +6,8 @@ The Fileserver ships off. Nothing is registered — no endpoint, no thread pool, is enabled explicitly. ```yaml -ca-skeleton: - fileserver: +app: + fileserver-platform: enabled: true instance-id: ${HOSTNAME} default-namespace: default @@ -26,8 +26,8 @@ to an unkeyed digest, which would be reversible for an enumerable identifier spa Each is a separate switch, and each defaults to off: ```yaml -ca-skeleton: - fileserver: +app: + fileserver-platform: admin: enabled: false # management plane; intended for a management port tus: diff --git a/docs/httpclient/configuration-reference.md b/docs/httpclient/configuration-reference.md index fed9b00a..01f8ebb1 100644 --- a/docs/httpclient/configuration-reference.md +++ b/docs/httpclient/configuration-reference.md @@ -99,7 +99,6 @@ materialise a nameless client in every deployment, which the aggregate validatio | `response-header` | `2s` | Until final response headers | | `read-idle` | `3s` | Between response chunks | | `total-call` | `4s` | The whole logical call, including retry backoff | -| `streaming-idle` | `30s` | Silence on a long-lived stream | `total-call` must not be shorter than `connect` or `response-header`; the validator emits `INVALID_TIMEOUT_BUDGET` otherwise. diff --git a/docs/httpclient/env-fields.yaml b/docs/httpclient/env-fields.yaml index a3642386..e0578fa5 100644 --- a/docs/httpclient/env-fields.yaml +++ b/docs/httpclient/env-fields.yaml @@ -1,8 +1,8 @@ # HTTP Client platform — Java field path to environment variable template. # -# The SSOT is HttpClientPlatformSettings. HttpClientEnvironmentKeys derives this list from the -# record tree at runtime, HttpClientPlatformEnvManifestTest fails when the two disagree in either -# direction, and the platform refuses to start on an APP_HTTPCLIENT_ variable that is not here. So a +# The SSOT is HttpClientPlatformSettings. HttpClientPlatformEnvManifestTest derives this list from +# the record tree and fails when the two disagree in either direction, and the shared strict binder +# refuses to start on an APP_HTTPCLIENT_ variable that names no field. So a # field added with no entry, an entry whose field was renamed, and a misspelled variable in a # deployment are all failures rather than silence. # @@ -81,8 +81,6 @@ fields: env: APP_HTTPCLIENT_CLIENTS_N_TIMEOUT_READ_IDLE - field: clients[N].timeout.total-call env: APP_HTTPCLIENT_CLIENTS_N_TIMEOUT_TOTAL_CALL - - field: clients[N].timeout.streaming-idle - env: APP_HTTPCLIENT_CLIENTS_N_TIMEOUT_STREAMING_IDLE - field: clients[N].redirect.enabled env: APP_HTTPCLIENT_CLIENTS_N_REDIRECT_ENABLED - field: clients[N].redirect.max-hops diff --git a/docs/messaging/configuration-reference.md b/docs/messaging/configuration-reference.md index 0f87d731..3fc19e98 100644 --- a/docs/messaging/configuration-reference.md +++ b/docs/messaging/configuration-reference.md @@ -28,7 +28,7 @@ producing-service identity다. outbox는 canonical 하나다(2026-09-28). use case가 `IntegrationEventEncoderPort`로 만든 `ValidatedIntegrationEvent`를 `OutboxAppendPort`로 append하고, relay는 claim한 row의 exact envelope -bytes를 `IntegrationEventPublishPort`로 보낸다. 예전의 `ca-skeleton.outbox.canonical-transport-enabled` +bytes를 `IntegrationEventPublishPort`로 보낸다. 예전의 `app.outbox.canonical-transport-enabled` gate와 legacy `MessageBroker → KafkaSender` 경로는 삭제됐다. 발행할 contract의 logical destination마다 아래 destination profile을 선언한다(템플릿의 durable operation event는 `durable-operations`). diff --git a/docs/mongodb/support-matrix.md b/docs/mongodb/support-matrix.md index 1fa103b1..7eedc004 100644 --- a/docs/mongodb/support-matrix.md +++ b/docs/mongodb/support-matrix.md @@ -82,7 +82,7 @@ feature request: | Tier | Capabilities | Enablement | |---|---|---| -| Stable, auto-configured | Mapping and BSON converters, imperative execution, atomic update, bulk partial results, consistency profiles, retry/translation, operation budgets, observability, typed client profiles, startup validation, health | Beans registered when `ca-skeleton.persistence-mongo.enabled=true`. | +| Stable, auto-configured | Mapping and BSON converters, imperative execution, atomic update, bulk partial results, consistency profiles, retry/translation, operation budgets, observability, typed client profiles, startup validation, health | Beans registered when `app.persistence-mongo.enabled=true`. | | Stable, library API | Transactions, causal sessions, optimistic revision, query builder and keyset pagination, aggregation executor, schema/index/validator manifests and diffs, TTL contract, GeoJSON, migration runner, admin plane, native capability gateway | The adopter's adapter leaf takes this leaf as `implementation` and constructs the type. | | Advanced, library API | Sharding-aware query and shard admin, CSFLE, Queryable Encryption (equality/range), shared-collection tenancy policies | Same, plus a `MongoAdvancedCapabilityGuard` whose flags enable the capability. No configuration property. | | Experimental, library API | Database-per-tenant client registry and migration coordinator, reshard approval | Same as Advanced; promotion additionally requires the evidence in [ADR-MONGO-ADV-001](../adr/ADR-MONGO-ADV-001-capability-promotion.md). | diff --git a/docs/notification/at-rest-threat-model.md b/docs/notification/at-rest-threat-model.md index 03b90b07..0c067d6b 100644 --- a/docs/notification/at-rest-threat-model.md +++ b/docs/notification/at-rest-threat-model.md @@ -104,7 +104,7 @@ the three they achieved. one thing — `AesGcmCallbackPayloadProtection`, which protects raw callback bodies — and by nothing on the accept path. Demanding it would make a deployment supply a key that protects nothing while the payload it appears to be about stays in plaintext. The repository already has one defect of that -exact shape: `backend.graphql.cursor.key-ids` (key removed 2026-09-25), which production refuses to start without and which no +exact shape: `app.graphql.cursor.key-ids` (key removed 2026-09-25), which production refuses to start without and which no code signs a cursor with (GQL-INT-003). Adding a second would make the pattern a habit. ## Consequence diff --git a/docs/notification/configuration-reference.md b/docs/notification/configuration-reference.md index e8643617..230377c6 100644 --- a/docs/notification/configuration-reference.md +++ b/docs/notification/configuration-reference.md @@ -1,6 +1,6 @@ # Configuration reference -The notification delivery platform binds under `ca-skeleton.notification.platform`. The tree lives in +The notification delivery platform binds under `app.notification.platform`. The tree lives in `src/composition/notification-platform/src/main/resources/config/module-defaults/notification.yml`, which the support leaf's `ModuleDefaultsEnvironmentPostProcessor` loads at the lowest precedence, so an application without the module carries none of it. The module is in no default composition: a @@ -60,7 +60,7 @@ nonce and tag. A larger configured value would pass every check above the databa ## Provider profiles Profiles are a map under `providers`, keyed by profile id. Arbitrary deployment-chosen ids can be -supplied as YAML or through Spring relaxed binding (`CA_SKELETON_NOTIFICATION_PLATFORM_PROVIDERS__`). +supplied as YAML or through Spring relaxed binding (`APP_NOTIFICATION_PLATFORM_PROVIDERS__`). The shipped reference profiles `smtp` and `ses` additionally expose explicit `APP_NOTIFICATION_PLATFORM_SMTP_*` and `APP_NOTIFICATION_PLATFORM_SES_*` aliases so operators do not have to invent binding names. @@ -135,7 +135,7 @@ already owns them and a second spelling would be a second thing to keep in step. | Property | Environment variable | Default | Bound | |---|---|---|---| | `smtp.sender-identity` | `APP_NOTIFICATION_PLATFORM_SMTP_SENDER_IDENTITY` | `no-reply@example.invalid` | address | -| `smtp.max-concurrency` | `APP_NOTIFICATION_PLATFORM_SMTP_DISPATCH_CONCURRENCY` | `4` | positive | +| `smtp.dispatch-concurrency` | `APP_NOTIFICATION_PLATFORM_SMTP_DISPATCH_CONCURRENCY` | `4` | positive | SMTP transport configuration has one owner: Spring Mail. The actual `JavaMailSenderImpl` must use required STARTTLS (`mail.smtp.starttls.enable=true` plus `mail.smtp.starttls.required=true`) or implicit TLS (`mail.smtp.ssl.enable=true`). It must also have positive `mail.smtp.connectiontimeout`, `mail.smtp.timeout`, and `mail.smtp.writetimeout` values. SMTP assembly fails before serving traffic when those properties are absent or invalid. diff --git a/docs/registries/env-keys.yaml b/docs/registries/env-keys.yaml index 4b717e27..612406ac 100644 --- a/docs/registries/env-keys.yaml +++ b/docs/registries/env-keys.yaml @@ -337,7 +337,7 @@ env_keys: - name: APP_PERSISTENCE_VENDOR # source: persistence vendor selector used by application-local.yml and bootRunH2. # PostgreSQL is the shipped default; H2 is an explicit developer-only selection. - property: ca-skeleton.persistence.vendor + property: app.persistence.vendor type: enum default: postgresql allowed_values: [postgresql, h2] @@ -350,7 +350,7 @@ env_keys: required_test: jpa-contract:local-vendor-parity - name: APP_REALTIME_REPLAY_ENABLED - property: ca-skeleton.realtime.replay.enabled + property: app.realtime.replay.enabled owner_module: adapter-outbound-persistence-jpa type: boolean default: false @@ -364,7 +364,7 @@ env_keys: required_test: jpa-contract:realtime-replay-env - name: APP_REALTIME_REPLAY_RETENTION - property: ca-skeleton.realtime.replay.retention + property: app.realtime.replay.retention owner_module: adapter-outbound-persistence-jpa type: duration default: 1h @@ -1596,7 +1596,7 @@ env_keys: required_test: rate-limit-contract:cleanup-grace-bounded - name: APP_IDEMPOTENCY_TTL - # ca-skeleton.capabilities.idempotency.replay-ttl: how long a completed response stays + # app.capabilities.idempotency.replay-ttl: how long a completed response stays # replayable. One value for every provider; IdempotencySettings refuses more than 72h at startup. type: duration default: 24h @@ -1610,7 +1610,7 @@ env_keys: required_test: idempotency-contract:ttl-applied - name: APP_IDEMPOTENCY_PROVIDER - # ca-skeleton.capabilities.idempotency.provider. redis and postgresql each contribute only the + # app.capabilities.idempotency.provider. redis and postgresql each contribute only the # store; app-bootstrap builds the one IdempotencyExecutor and refuses startup unless exactly one # store exists. postgresql uses the primary data source, applies its Flyway streams at startup # and refuses a non-PostgreSQL data source, so bootRunH2 runs with disabled or redis. Selection @@ -2350,7 +2350,7 @@ env_keys: # DEPRECATED 2026-08-10: this was a second Redis master switch, and the settings class that # bound it was removed with the previous Redis generation, so the key reached nothing. # APP_REDIS_ENABLED is the sole global activation authority; the cache role is selected by - # ca-skeleton.capabilities.cache.bindings.default. The row is kept rather than deleted so a + # app.capabilities.cache.bindings.default. The row is kept rather than deleted so a # deployment still setting this key can be told what replaced it. deprecated_orphaned: true deprecated_alias_for: APP_REDIS_ENABLED @@ -3682,7 +3682,7 @@ env_keys: required_test: async-contract:executor-queue-bounded # === Notification delivery platform (NTF-025 — configuration surface) === - # The tree exists in application.yml as ca-skeleton.notification.platform, disabled by + # The tree exists in application.yml as app.notification.platform, disabled by # default. Every key carries an inline default so a deployment that leaves the platform off # supplies nothing. Reference: docs/notification/configuration.md. @@ -3816,7 +3816,7 @@ env_keys: allowed_values: null classification: sensitive-config required: false - required_when: ca-skeleton.persistence-mongo.enabled=true AND no active-profile uri-secret + required_when: app.persistence-mongo.enabled=true AND no active-profile uri-secret reload_policy: restart-only owner_branch: persistence-mongo-runtime-remediation validation: mongodb_uri_when_selected_as_connection_source @@ -3934,8 +3934,8 @@ env_keys: compatibility_impact: behavior-change required_test: adapter-contract:graphql-disabled-safe - name: APP_GRAPHQL_DEPLOYMENT_MODE - # source: five-adapter-runtime-remediation §5.1 / GQL-INT-002 — replaces backend.graphql.production - # and backend.graphql.environment, which defaulted to production=false with + # source: five-adapter-runtime-remediation §5.1 / GQL-INT-002 — replaces app.graphql.production + # and app.graphql.environment, which defaulted to production=false with # environment=PRODUCTION_PUBLIC and let anonymous-principal and allow-by-default authorization # read one axis while the other claimed production. type: enum @@ -3950,7 +3950,7 @@ env_keys: compatibility_impact: behavior-change required_test: adapter-contract:graphql-deployment-mode - name: APP_GRAPHQL_VALIDATION_POLICY_VERSION - property: backend.graphql.validation-policy-version + property: app.graphql.validation-policy-version owner_module: adapter-inbound-graphql type: string default: v1 @@ -3965,7 +3965,7 @@ env_keys: required_test: graphql-contract:wired-operator-settings - name: APP_GRAPHQL_OBSERVED_OPERATION_NAMES - property: backend.graphql.observed-operation-names + property: app.graphql.observed-operation-names owner_module: adapter-inbound-graphql type: csv default: "" @@ -3980,7 +3980,7 @@ env_keys: required_test: graphql-contract:wired-operator-settings - name: APP_GRAPHQL_GRAPHIQL_ENABLED - property: backend.graphql.console.graphiql-enabled + property: app.graphql.console.graphiql-enabled owner_module: adapter-inbound-graphql type: boolean default: false @@ -3995,7 +3995,7 @@ env_keys: required_test: graphql-contract:wired-operator-settings - name: APP_GRAPHQL_INTROSPECTION_ENABLED - property: backend.graphql.console.introspection-enabled + property: app.graphql.console.introspection-enabled owner_module: adapter-inbound-graphql type: boolean default: false @@ -4010,7 +4010,7 @@ env_keys: required_test: graphql-contract:wired-operator-settings - name: APP_GRAPHQL_MAXIMUM_PAGE_SIZE - property: backend.graphql.limits.maximum-page-size + property: app.graphql.limits.maximum-page-size owner_module: adapter-inbound-graphql type: integer default: 100 @@ -4025,7 +4025,7 @@ env_keys: required_test: graphql-contract:wired-operator-settings - name: APP_GRAPHQL_MAXIMUM_COMPLEXITY - property: backend.graphql.limits.maximum-complexity + property: app.graphql.limits.maximum-complexity owner_module: adapter-inbound-graphql type: integer default: 10000 @@ -4040,7 +4040,7 @@ env_keys: required_test: graphql-contract:wired-operator-settings - name: APP_GRAPHQL_PREPARSED_CACHE_ENTRIES - property: backend.graphql.limits.preparsed-cache-entries + property: app.graphql.limits.preparsed-cache-entries owner_module: adapter-inbound-graphql type: integer default: 1000 @@ -4055,7 +4055,7 @@ env_keys: required_test: graphql-contract:wired-operator-settings - name: APP_GRAPHQL_PREPARSED_CACHE_WEIGHT - property: backend.graphql.limits.preparsed-cache-weight + property: app.graphql.limits.preparsed-cache-weight owner_module: adapter-inbound-graphql type: integer default: 10000000 @@ -4070,7 +4070,7 @@ env_keys: required_test: graphql-contract:wired-operator-settings - name: APP_GRAPHQL_PREPARSED_CACHE_EXPIRE_AFTER_ACCESS - property: backend.graphql.limits.preparsed-cache-expire-after-access + property: app.graphql.limits.preparsed-cache-expire-after-access owner_module: adapter-inbound-graphql type: duration default: 30m @@ -4147,7 +4147,7 @@ env_keys: - name: APP_NOTIFICATION_PLATFORM_CONTACT_ENCRYPTION_KEY # source: NTF-INT-007 — Encrypts recipient contact points at rest — addresses and phone numbers. # Full row owned by secrets-classification.yaml. Bound by - # ca-skeleton.notification.platform.secrets.contact-encryption-key; the platform decodes it at startup and + # app.notification.platform.secrets.contact-encryption-key; the platform decodes it at startup and # refuses to boot if it is blank, shorter than 32 bytes, or equal to another purpose's key. type: string default: null @@ -4163,7 +4163,7 @@ env_keys: - name: APP_NOTIFICATION_PLATFORM_CONTACT_LOOKUP_HMAC_KEY # source: NTF-INT-007 — Blind index over contact points, so a lookup never needs the plaintext. # Full row owned by secrets-classification.yaml. Bound by - # ca-skeleton.notification.platform.secrets.contact-lookup-hmac-key; the platform decodes it at startup and + # app.notification.platform.secrets.contact-lookup-hmac-key; the platform decodes it at startup and # refuses to boot if it is blank, shorter than 32 bytes, or equal to another purpose's key. type: string default: null @@ -4179,7 +4179,7 @@ env_keys: - name: APP_NOTIFICATION_PLATFORM_CALLBACK_SIGNING_KEY # source: NTF-INT-007 — Signs the callback URLs a provider posts delivery outcomes back to. # Full row owned by secrets-classification.yaml. Bound by - # ca-skeleton.notification.platform.secrets.callback-signing-key; the platform decodes it at startup and + # app.notification.platform.secrets.callback-signing-key; the platform decodes it at startup and # refuses to boot if it is blank, shorter than 32 bytes, or equal to another purpose's key. type: string default: null @@ -4195,7 +4195,7 @@ env_keys: - name: APP_NOTIFICATION_PLATFORM_PROVIDER_CREDENTIAL_KEY # source: NTF-INT-007 — Encrypts stored provider credentials, which are themselves secrets. # Full row owned by secrets-classification.yaml. Bound by - # ca-skeleton.notification.platform.secrets.provider-credential-key; the platform decodes it at startup and + # app.notification.platform.secrets.provider-credential-key; the platform decodes it at startup and # refuses to boot if it is blank, shorter than 32 bytes, or equal to another purpose's key. type: string default: null @@ -4211,7 +4211,7 @@ env_keys: - name: APP_NOTIFICATION_PLATFORM_PAYLOAD_ENCRYPTION_KEY # source: NTF-INT-007 — Encrypts notification variables and retained callback bodies at rest. # Full row owned by secrets-classification.yaml. Bound by - # ca-skeleton.notification.platform.secrets.payload-encryption-key; the platform decodes it at startup and + # app.notification.platform.secrets.payload-encryption-key; the platform decodes it at startup and # refuses to boot if it is blank, shorter than 32 bytes, or equal to another purpose's key. type: string default: null @@ -4227,7 +4227,7 @@ env_keys: - name: APP_NOTIFICATION_PLATFORM_PROVIDER_REQUEST_LOOKUP_HMAC_KEY # source: NTF-INT-007 — Keyed hash of provider request ids, which are provider-side identifiers. # Full row owned by secrets-classification.yaml. Bound by - # ca-skeleton.notification.platform.secrets.provider-request-lookup-hmac-key; the platform decodes it at startup and + # app.notification.platform.secrets.provider-request-lookup-hmac-key; the platform decodes it at startup and # refuses to boot if it is blank, shorter than 32 bytes, or equal to another purpose's key. type: string default: null @@ -4243,7 +4243,7 @@ env_keys: - name: APP_NOTIFICATION_PLATFORM_CALLBACK_FINGERPRINT_HMAC_KEY # source: NTF-INT-007 — Keyed fingerprint of callback bodies, used to detect replays. # Full row owned by secrets-classification.yaml. Bound by - # ca-skeleton.notification.platform.secrets.callback-fingerprint-hmac-key; the platform decodes it at startup and + # app.notification.platform.secrets.callback-fingerprint-hmac-key; the platform decodes it at startup and # refuses to boot if it is blank, shorter than 32 bytes, or equal to another purpose's key. type: string default: null @@ -4260,7 +4260,7 @@ env_keys: # source: NTF-INT-007 — the id written into every envelope the CONTACT_ENCRYPTION key produces. # An identifier, not key material, so it is public-config; the material itself is the # APP_NOTIFICATION_PLATFORM_CONTACT_ENCRYPTION_KEY row above. Bound into - # ca-skeleton.notification.platform.secrets.active-key-ids.CONTACT_ENCRYPTION. + # app.notification.platform.secrets.active-key-ids.CONTACT_ENCRYPTION. type: string default: null allowed_values: null @@ -4276,7 +4276,7 @@ env_keys: # source: NTF-INT-007 — the id written into every envelope the CONTACT_LOOKUP_HMAC key produces. # An identifier, not key material, so it is public-config; the material itself is the # APP_NOTIFICATION_PLATFORM_CONTACT_LOOKUP_HMAC_KEY row above. Bound into - # ca-skeleton.notification.platform.secrets.active-key-ids.CONTACT_LOOKUP_HMAC. + # app.notification.platform.secrets.active-key-ids.CONTACT_LOOKUP_HMAC. type: string default: null allowed_values: null @@ -4292,7 +4292,7 @@ env_keys: # source: NTF-INT-007 — the id written into every envelope the CALLBACK_SIGNING key produces. # An identifier, not key material, so it is public-config; the material itself is the # APP_NOTIFICATION_PLATFORM_CALLBACK_SIGNING_KEY row above. Bound into - # ca-skeleton.notification.platform.secrets.active-key-ids.CALLBACK_SIGNING. + # app.notification.platform.secrets.active-key-ids.CALLBACK_SIGNING. type: string default: null allowed_values: null @@ -4308,7 +4308,7 @@ env_keys: # source: NTF-INT-007 — the id written into every envelope the PROVIDER_CREDENTIAL key produces. # An identifier, not key material, so it is public-config; the material itself is the # APP_NOTIFICATION_PLATFORM_PROVIDER_CREDENTIAL_KEY row above. Bound into - # ca-skeleton.notification.platform.secrets.active-key-ids.PROVIDER_CREDENTIAL. + # app.notification.platform.secrets.active-key-ids.PROVIDER_CREDENTIAL. type: string default: null allowed_values: null @@ -4324,7 +4324,7 @@ env_keys: # source: NTF-INT-007 — the id written into every envelope the PAYLOAD_ENCRYPTION key produces. # An identifier, not key material, so it is public-config; the material itself is the # APP_NOTIFICATION_PLATFORM_PAYLOAD_ENCRYPTION_KEY row above. Bound into - # ca-skeleton.notification.platform.secrets.active-key-ids.PAYLOAD_ENCRYPTION. + # app.notification.platform.secrets.active-key-ids.PAYLOAD_ENCRYPTION. type: string default: null allowed_values: null @@ -4340,7 +4340,7 @@ env_keys: # source: NTF-INT-007 — the id written into every envelope the PROVIDER_REQUEST_LOOKUP_HMAC key produces. # An identifier, not key material, so it is public-config; the material itself is the # APP_NOTIFICATION_PLATFORM_PROVIDER_REQUEST_LOOKUP_HMAC_KEY row above. Bound into - # ca-skeleton.notification.platform.secrets.active-key-ids.PROVIDER_REQUEST_LOOKUP_HMAC. + # app.notification.platform.secrets.active-key-ids.PROVIDER_REQUEST_LOOKUP_HMAC. type: string default: null allowed_values: null @@ -4356,7 +4356,7 @@ env_keys: # source: NTF-INT-007 — the id written into every envelope the CALLBACK_FINGERPRINT_HMAC key produces. # An identifier, not key material, so it is public-config; the material itself is the # APP_NOTIFICATION_PLATFORM_CALLBACK_FINGERPRINT_HMAC_KEY row above. Bound into - # ca-skeleton.notification.platform.secrets.active-key-ids.CALLBACK_FINGERPRINT_HMAC. + # app.notification.platform.secrets.active-key-ids.CALLBACK_FINGERPRINT_HMAC. type: string default: null allowed_values: null diff --git a/docs/registries/secrets-classification.yaml b/docs/registries/secrets-classification.yaml index 933bde7f..cf814d6c 100644 --- a/docs/registries/secrets-classification.yaml +++ b/docs/registries/secrets-classification.yaml @@ -24,6 +24,9 @@ secrets: # "DB credential은 dual-bind 60s" + "__LOCAL_DEV_FAKE_DB_PASSWORD" 예시 classification: secret source: secret-manager + # Contributed by persistence-jpa (JpaStartupAutoConfiguration#jpaProductionSecrets) while the + # module is on; the composition root's guard no longer reads the module switch (P22-new-1). + required_when: app.persistence-jpa.enabled=true rotation_policy: dual-bind-60s prod_default: null dev_sentinel_prefix: __LOCAL_DEV_ @@ -55,7 +58,7 @@ secrets: rotation_policy: restart-only prod_default: null # Required with app.redis.enabled=true and this role selected; checked by adapter-outbound-cache-redis RedisProductionSecrets. - required_when: ca-skeleton.capabilities.cache.bindings.default=redis + required_when: app.capabilities.cache.bindings.default=redis dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: feature-secrets-config-source-contract masking_rule: full @@ -81,7 +84,7 @@ secrets: rotation_policy: dual-read-restart-only prod_default: null # Required with app.redis.enabled=true and this role selected; checked by adapter-outbound-cache-redis RedisProductionSecrets. - required_when: ca-skeleton.capabilities.cache.bindings.default=redis + required_when: app.capabilities.cache.bindings.default=redis dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: codex-phase-a-ci-recovery masking_rule: full @@ -95,7 +98,7 @@ secrets: rotation_policy: restart-only prod_default: null # Required with app.redis.enabled=true and this role selected; checked by adapter-outbound-cache-redis RedisProductionSecrets. - required_when: ca-skeleton.capabilities.rate-limit.provider=redis + required_when: app.capabilities.rate-limit.provider=redis dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: redis-distributed-rate-limit masking_rule: full @@ -121,7 +124,7 @@ secrets: rotation_policy: dual-read-restart-only prod_default: null # Required with app.redis.enabled=true and this role selected; checked by adapter-outbound-cache-redis RedisProductionSecrets. - required_when: ca-skeleton.capabilities.rate-limit.provider=redis + required_when: app.capabilities.rate-limit.provider=redis dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: redis-distributed-rate-limit masking_rule: full @@ -135,7 +138,7 @@ secrets: rotation_policy: restart-only prod_default: null # Required with app.redis.enabled=true and this role selected; checked by adapter-outbound-cache-redis RedisProductionSecrets. - required_when: ca-skeleton.security.auth-mode=redis-session + required_when: app.security.auth-mode=redis-session dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: redis-production-capability masking_rule: full @@ -161,7 +164,7 @@ secrets: rotation_policy: dual-read-restart-only prod_default: null # Required with app.redis.enabled=true and this role selected; checked by adapter-outbound-cache-redis RedisProductionSecrets. - required_when: ca-skeleton.security.auth-mode=redis-session + required_when: app.security.auth-mode=redis-session dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: redis-production-capability masking_rule: full @@ -175,7 +178,7 @@ secrets: rotation_policy: cold-cutover-restart-only prod_default: null # Required with app.redis.enabled=true and this role selected; checked by adapter-outbound-cache-redis RedisProductionSecrets. - required_when: ca-skeleton.capabilities.idempotency.provider=redis + required_when: app.capabilities.idempotency.provider=redis dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: redis-production-capability-completion masking_rule: full @@ -189,7 +192,7 @@ secrets: rotation_policy: cold-cutover-restart-only prod_default: null # Required with app.redis.enabled=true and this role selected; checked by adapter-outbound-cache-redis RedisProductionSecrets. - required_when: ca-skeleton.capabilities.lease.provider=redis + required_when: app.capabilities.lease.provider=redis dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: redis-production-capability-completion masking_rule: full @@ -222,7 +225,7 @@ secrets: source: secret-manager rotation_policy: dual-read-restart-only prod_default: null - required_when: ca-skeleton.notification.platform.enabled=true + required_when: app.notification.platform.enabled=true dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: worktree-notification-platform masking_rule: full @@ -238,7 +241,7 @@ secrets: source: secret-manager rotation_policy: dual-read-restart-only prod_default: null - required_when: ca-skeleton.notification.platform.enabled=true + required_when: app.notification.platform.enabled=true dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: worktree-notification-platform masking_rule: full @@ -254,7 +257,7 @@ secrets: source: secret-manager rotation_policy: dual-read-restart-only prod_default: null - required_when: ca-skeleton.notification.platform.enabled=true + required_when: app.notification.platform.enabled=true dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: worktree-notification-platform masking_rule: full @@ -270,7 +273,7 @@ secrets: source: secret-manager rotation_policy: dual-read-restart-only prod_default: null - required_when: ca-skeleton.notification.platform.enabled=true + required_when: app.notification.platform.enabled=true dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: worktree-notification-platform masking_rule: full @@ -286,7 +289,7 @@ secrets: source: secret-manager rotation_policy: dual-read-restart-only prod_default: null - required_when: ca-skeleton.notification.platform.enabled=true + required_when: app.notification.platform.enabled=true dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: worktree-notification-platform masking_rule: full @@ -302,7 +305,7 @@ secrets: source: secret-manager rotation_policy: dual-read-restart-only prod_default: null - required_when: ca-skeleton.notification.platform.enabled=true + required_when: app.notification.platform.enabled=true dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: worktree-notification-platform masking_rule: full @@ -318,7 +321,7 @@ secrets: source: secret-manager rotation_policy: dual-read-restart-only prod_default: null - required_when: ca-skeleton.notification.platform.enabled=true + required_when: app.notification.platform.enabled=true dev_sentinel_prefix: __LOCAL_DEV_ owner_branch: worktree-notification-platform masking_rule: full diff --git a/docs/reviews/2026-09-25-review-followup-results/W3-P20.md b/docs/reviews/2026-09-25-review-followup-results/W3-P20.md new file mode 100644 index 00000000..04fadb3f --- /dev/null +++ b/docs/reviews/2026-09-25-review-followup-results/W3-P20.md @@ -0,0 +1,99 @@ +# W3-P20 — 설정 prefix `app.*` 통일(결정 16) + strict 바인딩 + +worktree: `.claude/worktrees/agent-a79f4feba1997eb73` (기준 HEAD `0ebb77b5`) + +## 설정 prefix 이전 → 이후 + +env 키(`APP_*`) 이름은 하나도 바뀌지 않았다. 바뀐 것은 env가 채우는 설정 트리뿐이다. + +| 이전 | 이후 | 소유(읽는 곳) | +|---|---|---| +| `ca-skeleton.async.executor` | `app.async.executor` | app-bootstrap `AsyncExecutorSettings` | +| `ca-skeleton.bootstrap` | `app.bootstrap` | app-bootstrap `BootstrapSettings` | +| `ca-skeleton.logging` | `app.logging` | app-bootstrap `LoggingSettings` | +| `ca-skeleton.runtime` | `app.runtime` | app-bootstrap `RuntimeSafetySettings`, persistence-jpa `migration-on-startup` | +| `ca-skeleton.secret-source` | `app.secret-source` | app-bootstrap `SecretSourceSettings` | +| `ca-skeleton.security` | `app.security` | app-bootstrap `AuthenticationModeSettings`, web `SecuritySettings` | +| `ca-skeleton.authz` | `app.authz` | web `RolePermissionPolicy` | +| `ca-skeleton.cors` | `app.cors` | web `CorsSettings` | +| `ca-skeleton.presentation` | `app.presentation` | web `PresentationSettings` | +| `backend.web.mvc` | `app.web.mvc` | web `WebMvcPlatformSettings` | +| `backend.web.advanced.mvc-virtual-threads` | `app.web.advanced.mvc-virtual-threads` | web-advanced `VirtualThreadSettings` | +| `backend.graphql` | `app.graphql` | graphql `GraphQlPlatformSettings` | +| `ca-skeleton.grpc.server` | `app.grpc.server` | grpc `GrpcServerSettings` | +| `ca-skeleton.grpc.platform` | `app.grpc.platform` | grpc starter `GrpcPlatformProperties` (부모 `app.grpc`에 바인딩하는 것은 없다 — P5 메모) | +| `ca-skeleton.grpc.advanced..enabled` | `app.grpc.advanced..enabled` | grpc-advanced `GrpcAdvancedCapability` | +| `ca-skeleton.capabilities.{cache,rate-limit,lease,idempotency}` | `app.capabilities.{…}` | cache-redis `RedisCapabilitySettings`, composition:idempotency `IdempotencySettings`, persistence-jpa idempotency | +| `ca-skeleton.notification.platform(.smtp,.secrets)` | `app.notification.platform(…)` | notification `NotificationPlatformSettings`·`NotificationSmtpSettings`·secrets | +| `ca-skeleton.persistence.vendor` | `app.persistence.vendor` | persistence-jpa `PersistenceVendorSettings` | +| `ca-skeleton.persistence-jpa.enabled` | `app.persistence-jpa.enabled` | persistence-jpa 스위치 | +| `ca-skeleton.lock` | `app.lock` | persistence-jpa `LockSettings` | +| `ca-skeleton.outbox` | `app.outbox` | composition:outbox-relay `OutboxSettings` | +| `ca-skeleton.realtime.replay` | `app.realtime.replay` | persistence-jpa `JpaLiveEventReplay` | +| `ca-skeleton.persistence-mongo(.platform)` | `app.persistence-mongo(…)` | persistence-mongo `MongoPersistenceSettings`·`MongoPlatformSettings` | +| `ca-skeleton.privacy` | `app.privacy` | composition:service-runtime `PrivacySettings` | +| `ca-skeleton.tracing` | `app.tracing` | composition:service-runtime `TracingSettings` | +| `ca-skeleton.rate-limit.{limit,window,algorithm}` (bootstrap·sample test yml) | 삭제 | 읽는 코드 없음. `ca-skeleton.rate-limit.{enabled,…}`(sample)는 `app.rate-limit.*`가 되어 web `EdgeRateLimitTransportSettings`가 읽는 키와 합쳐졌다(값 동일, enabled=false) | +| 그대로 | `app.redis`, `app.httpclient`, `app.fileserver-platform`, `app.object-storage`, `app.websocket`, `app.notification`(R0 gate), `app.rate-limit`, `app.jpa-platform`, `app.messaging`(vendored), `app.poster-image` | | +| 그대로(설정 키가 아님) | `ca-skeleton.messaging.{schema-set,contract-catalog,contract-descriptor,partition-key}.v1`(hash domain), `ca-skeleton.grpc.authenticated-caller`(gRPC Context key), `logs/ca-skeleton.json`, metric `backend.redis.*`, vendored messaging의 superseded `backend.messaging` 거부 | | + +## strict 바인딩 현황 (X2-P1-3c) + +| 설정 | prefix | 방식 | +|---|---|---| +| composition:fileserver-platform, httpclient, composition:outbox-relay, composition:idempotency | 기존 | `StrictSettingsBinder`(이번에 env 검사 일반화) | +| persistence-jpa `PersistenceVendorSettings`·`LockSettings`·`JpaSafetySettings` | `app.persistence`·`app.lock`·`app.jpa-platform` | `StrictSettingsBinder`(게이트된 설정의 `@Bean`) | +| cache-redis `RedisCapabilitySettings` | `app.capabilities` | `StrictSettingsBinder.bindExcept`(idempotency lifecycle 키 제외) | +| notification `NotificationRoutesSettings`·`NotificationPlatformSettings`·secrets·smtp | `app.notification`(platform·R0 gate 제외)·`app.notification.platform`(smtp·secrets·default-locale 제외)·`.secrets`·`.smtp` | `StrictSettingsBinder` | +| messaging bridge `MessagingSettings` | `app.messaging`(vendored 최상위 항목 제외) | `StrictSettingsBinder.bindExcept` | +| service-runtime `PrivacySettings`·`TracingSettings` | `app.privacy`·`app.tracing` | `StrictSettingsBinder` | +| objectstorage `ObjectStorageCapabilitySettings` | `app.object-storage`(scan-maintenance 제외) | `StrictSettingsBinder` + registry support edge 추가 | +| graphql `GraphQlPlatformSettings` | `app.graphql` | `ignoreUnknownFields = false`(inbound → outbound support edge 불가). 스위치 `enabled`를 component로 추가 | +| websocket `WebSocketSettings` | `app.websocket` | `ignoreUnknownFields = false`(같은 이유) | +| persistence-mongo `MongoPlatformSettings` | `app.persistence-mongo.platform` | `ignoreUnknownFields = false`(closure에 support 없음). 부모 `app.persistence-mongo`(스위치 하나)는 하위 트리 때문에 엄격하게 하지 않음 | +| grpc `GrpcServerSettings`·`GrpcPlatformProperties` | `app.grpc.server`·`app.grpc.platform` | 기존 `ignoreUnknownFields = false`, 부모 `app.grpc`에 바인딩 없음 | + +## 행 결과 +| ID | 결과 | 근거 | +|---|---|---| +| S6-#14 | 완료 | 결정 16: 설정 prefix를 `app.*` 하나로(위 표). `711a3968`·`fabb611e`. env 키 이름 변경 없음. `ConfigurationNamespaceContractTest`: 허용 root는 `app` 하나(`shippedConfigurationDeclaresOnlyRecordedRoots`), 모든 leaf의 `@ConfigurationProperties`·`String PREFIX` 상수가 `app.` 아래(`everyLeafPrefixSitsUnderTheApplicationRoot`, 새 테스트) — `src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ConfigurationNamespaceContractTest.java`. yml root 병합 4곳(cache-redis·notification module-defaults, sample `application.yml`·systemTest yml). "capability" 용어 정리는 이번 범위 밖(키 이름만) | +| S3-lead-4 | 완료 | `711a3968`: `src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/CapabilitySelectors.java`(ROOT·CACHE_DEFAULT_BINDING·IDEMPOTENCY_PROVIDER·RATE_LIMIT_PROVIDER·LEASE_PROVIDER). 사용: cache-redis `RedisCacheConfig`·`RedisCorrectnessRoleSelectors`·`RedisIdempotencyConfig`·`RedisLeaseConfig`·`RedisRateLimitConfig`·`RedisCapabilitySettings.bind`, persistence-jpa `PostgreSqlIdempotencyStoreConfig`·`IdempotencyReaper`·`IdempotencySchemaStream`, composition:idempotency `IdempotencyAutoConfiguration`. 현황표 방향(멱등성은 composition 모듈에)과 다르게 support에 둔 이유: persistence-jpa·cache-redis는 composition:idempotency에 의존할 수 없고(registry), 셋 다 support에 이미 의존한다. main의 `app.capabilities.*.provider` 문자열 리터럴 0건(`git grep '"app.capabilities' -- '*/src/main/*'`는 메시지·주석뿐) | +| P11-new-1 | 완료 | `711a3968`: 읽지 않던 `clients[N].timeout.streaming-idle` 키 삭제 — `TimeoutSettings`·`HttpClientPlatformSettings.Timeout`·`HttpClientProfileFactory`·testFixtures `ClientProfiles`에서 `streamingIdle` 제거, `docs/httpclient/env-fields.yaml`·`configuration-reference.md` 행 삭제. `HttpClientPlatformEnvManifestTest.theManifestAndTheSettingsTreeAgree` PASS(manifest와 record 트리 일치). 이제 `APP_HTTPCLIENT_CLIENTS_0_TIMEOUT_STREAMING_IDLE`을 설정하면 strict binder가 이름으로 거부 | +| P22-new-2 | 완료 | `b509991a`: `infra/redis-sdk/acl/application.acl`·`application-advanced.acl`·`all-accounts.acl`의 application 두 계정에서 `+@pubsub`·`&prod:*` 삭제(`resetchannels`만 남음). admin-readonly의 `+pubsub|channels` 등 introspection은 그대로(읽기 전용 관측). topology lane 결과는 아래 검증 절 | +| S3-lead-2 | 완료 | `68cda1d3`: env 오타 검사를 `StrictSettingsBinder`(support)로 일반화하고 httpclient `HttpClientEnvironmentKeys`(리플렉션 역산) 삭제. system env는 unbound 검사에서 빼고(Spring 열거형 `app.outbox.poll.interval`이 하이픈 필드를 오판 — 모든 트리가 `app.*`가 되면서 모든 capability의 문제가 됨), prefix의 env 형태로 시작하는 변수가 (a) 이번 바인딩이 바인딩한 속성, (b) 다른 source가 선언한 속성, (c) placeholder가 읽는 변수 중 하나의 env 형태가 아니면 이름으로 거부. `StrictSettingsBinderTest`: `aCorrectlySpelledHyphenatedEnvironmentVariableBinds`(FAIL: `BindException: Failed to bind properties under 'sample.shared'`)→PASS, `aMisspelledEnvironmentVariableIsRefusedByName`(FAIL: `Expecting actual throwable to be an instance of CapabilityStartupValidationException but was BindException`)→PASS, `aVariableASettingReadsThroughAPlaceholderIsNotATypo`(FAIL: BindException)→PASS, `aSubtreeAnotherModuleOwnsIsLeftToThatModule`(FAIL: BindException)→PASS, `aHyphenatedListFromTheEnvironmentBindsWhenForeignKeysAreExcluded`(P20-new-2 회귀). httpclient `HttpClientPlatformEnvManifestTest.aMisspelledEnvironmentVariableIsRefused` PASS(공용 binder로). manifest 도출(`fieldToEnvTemplate`)은 테스트로 옮김. `src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/StrictSettingsBinder.java` | +| X2-P1-3c | 완료 | 위 "strict 바인딩 현황" 표. 각 모듈 재현 테스트 FAIL(`Expecting: to have failed`)→PASS: `DistributedLockPersistenceConfigTest.aMisspelledLockKeyFailsStartup`, `JpaStartupAutoConfigurationTest.aMisspelledSafetyKeyFailsStartup`, `PersistenceVendorSelectionTest.aMisspelledPersistenceKeyFailsStartup`(`0f8e9053`), `RedisCapabilityCompositionTest.aMisspelledCapabilityKeyFailsStartup`(+`theIdempotencyLifecycleKeysAreLeftToTheirOwner`, `34fe03d1`), `NotificationPlatformCoreConfigurationTest.aMisspelledPlatformKeyFailsStartup`(`6ef946a0`), `MessagingPlatformBridgeAutoConfigurationTest.aMisspelledTopLevelMessagingKeyFailsStartup`(+`thePlatformsOwnSectionsAreLeftToThePlatform`, `2f19accc`), `ServiceRuntimeRegistrationTest.aMisspelledRuntimeKeyFailsStartup`(`976fcf0b`), `ObjectStorageCapabilityConfigTest.aMisspelledObjectStorageKeyFailsStartup`(`28fdbfb1`), `WebSocketSettingsTest.aMisspelledWebSocketKeyFailsStartup`·`GraphQlDeploymentModeContractTest.aMisspelledGraphQlKeyFailsStartup`·`MongoPersistenceConfigTest.aMisspelledPlatformKeyFailsStartup`(`8ff4371d`). graphql·websocket·mongo는 support edge가 없어(inbound→outbound 금지, mongo closure) Spring 고유 `ignoreUnknownFields=false` — yml/properties 오타는 거부, env 오타는 Spring이 system env를 검사에서 빼므로 거부하지 않음(차이를 README 대신 여기 기록). objectstorage는 registry에 support edge 추가(`28fdbfb1`, 커밋 메시지에 이유). `StrictSettingsBinder`는 `bindOrCreate`로(키가 없으면 기본값) | +| P22-new-1 | 완료 | `842e2402`: `JpaStartupAutoConfiguration#jpaProductionSecrets`가 `RequiredProductionSecrets`로 `APP_DATASOURCE_PASSWORD`를 기여(모듈이 켜져 있을 때만). `SecretSourceValidator`는 `app.persistence-jpa.enabled`를 더 읽지 않고 `REQUIRED_PROD_SECRETS = [APP_PRIVACY_PSEUDONYMIZATION_SALT]`. 레지스트리 `secrets-classification.yaml`의 `APP_DATASOURCE_PASSWORD`에 `required_when: app.persistence-jpa.enabled=true`(`SecretsClassificationRegistryTest` 1:1 유지). `JpaStartupAutoConfigurationTest.theModuleContributesTheDatabasePasswordAsAProductionSecret` FAIL(`Expecting … to have a single bean of type RequiredProductionSecrets`)→PASS, `aSwitchedOffModuleOwesNoDatabasePassword` PASS, bootstrap `SecretSourceValidatorTest.theGuardAloneDoesNotRequireADatabasePassword`(스위치 true + 빈 비밀번호 + 기여 없음 → 기동) PASS | + +## 제거된 코드 +| 대상 | 경로 | 마지막으로 존재한 커밋 | 이유 | +|---|---|---|---| +| `HttpClientEnvironmentKeys`(설정 record 트리를 리플렉션으로 순회해 env 이름 역산·거부) | `src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientEnvironmentKeys.java` | `0ebb77b5` | S3-lead-2: env 오타 거부를 `StrictSettingsBinder`가 모든 capability에 대해 한다. manifest 도출은 `HttpClientPlatformEnvManifestTest`로 | +| `StrictSettingsBinder.bind(env, prefix, type, Predicate)` overload | `src/adapter/outbound/support/.../StrictSettingsBinder.java` | `0ebb77b5` | httpclient 전용 우회였다. system env 제외가 기본 동작이 됨 | +| 설정 키 `app.httpclient.clients[N].timeout.streaming-idle`(`APP_HTTPCLIENT_CLIENTS_N_TIMEOUT_STREAMING_IDLE`)과 `TimeoutSettings.streamingIdle`·`HttpClientPlatformSettings.Timeout.streamingIdle` | `src/adapter/outbound/httpclient/.../profile/TimeoutSettings.java`, `docs/httpclient/env-fields.yaml` | `0ebb77b5` | P11-new-1: 바인딩만 되고 읽는 곳 없음(capability 규칙 3) | +| yml 키 `ca-skeleton.rate-limit.{limit,window,algorithm}` | `src/app-bootstrap/src/test/resources/application-test.yml`, `src/sample-portfolio/src/systemTest/resources/application-test.yml` | `0ebb77b5` | 읽는 코드 없음. `app.rate-limit` 아래로 옮기면 web `EdgeRateLimitTransportSettings` 트리에 섞인다 | +| `SecretSourceValidator`의 `RELATIONAL_PERSISTENCE_PROPERTY`·`isRelationalPersistenceOn()`(모듈 스위치 해석) | `src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidator.java` | `0ebb77b5` | P22-new-1: persistence-jpa가 기여 | +| 설정 키 `app.notification.platform.smtp.max-concurrency`(이름 변경 → `dispatch-concurrency`, env `APP_NOTIFICATION_PLATFORM_SMTP_DISPATCH_CONCURRENCY` 그대로) | `NotificationSmtpSettings.java`, `notification.yml` | `0ebb77b5` | P20-new-1 | +| Redis ACL `+@pubsub`·`&prod:*`(application 계정 2개) | `infra/redis-sdk/acl/*.acl` | `0ebb77b5` | P22-new-2 | + +## 새로 발견한 결함 +- **P20-new-1** (고침, `6ef946a0`): `app.*` 통일로 `app.notification.platform.smtp.max-concurrency`(dispatch pool)의 relaxed env 형태가 `APP_NOTIFICATION_PLATFORM_SMTP_MAX_CONCURRENCY` — SMTP provider profile(`providers.smtp.max-concurrency`)의 placeholder 변수 — 와 같아져 한 변수가 두 속성을 설정하게 될 뻔했다(env가 yml보다 우선이라 `…_DISPATCH_CONCURRENCY`가 조용히 무시됨). 속성을 env 이름에 맞춰 `dispatch-concurrency`로. 전체 shipped yml·registry를 대상으로 "placeholder로 한 속성을 채우는 env가 relaxed 바인딩으로 다른 속성도 채우는가"를 스크립트로 확인해 남은 충돌 0건(sample의 죽은 `app.cache.redis.*` 한 건 제외 — 아래). +- **P20-new-2** (고침, `68cda1d3`): `StrictSettingsBinder.bindExcept`가 system environment까지 filter된 view로 감쌌다. filter된 view는 Spring의 env 이름 매핑을 잃어, 하이픈이 든 list/map(`APP_…_ALLOWED_HOSTS_0`)이 env에서 오면 오류 없이 빈 값으로 바인딩됐다(composition:idempotency가 이 경로). system env는 filter하지 않게. `StrictSettingsBinderTest.aHyphenatedListFromTheEnvironmentBindsWhenForeignKeysAreExcluded`. +- **P20-new-3** (남음): sample `application.yml`의 `app.cache.redis.*`(22개)·`app.outbound.http.*`(15개)·`app.messaging.kafka.brokers`·`app.notification.{email,slack}.provider`는 sample 조립에서 아무것도 바인딩하지 않는 죽은 키다(sample은 cache-redis·httpclient·notification을 싣지 않는다). sample 패키지는 P30 범위라 손대지 않음. +- **P20-new-4** (남음): `src/README.md` "Outbound HTTP client" 절의 yaml 예시(`app.capabilities.http-client.expected-state`·`app.providers.http-client`)는 존재하지 않는 트리를 설명한다(prefix만 이번에 바뀜). Wave 5 문서 정리 대상. +- **P20-new-5** (남음): persistence-jpa는 `app.persistence-jpa`(스위치)·`app.persistence`(vendor)·`app.jpa-platform`·`app.lock`·`app.outbox`·`app.realtime.replay`·`app.runtime.migration-on-startup`에 걸쳐 있다 — capability 규칙 4("prefix 하나")를 여전히 어긴다. `app.realtime.replay.retention`은 `@Value`라 strict 바인딩 밖. 키 재배치는 env·운영 문서 전체를 건드리는 별도 결정. + +## 검증 +- `./gradlew check --continue --max-workers=3` — BUILD SUCCESSFUL(499 tasks) +- `architectureCheck :app-bootstrap:verifyEnvKeys configContractCheck verifyDependencyLocks verifyPublicPathSnapshot` — 첫 실행에서 architectureTest 2건 실패(D3: `DistributedLockPersistenceConfig.lockSettings`에 스위치 조건 없음, B7: bridge 설정 bean이 public) → `e3e02052`로 고친 뒤 BUILD SUCCESSFUL. verifyEnvKeys: OK — 346 env keys +- `mainCheck :app-bootstrap:integrationTest :app-bootstrap:systemTest :sample-portfolio:integrationTest :sample-portfolio:systemTest` — BUILD SUCCESSFUL +- Redis topology lane(standalone, compose project `p20-redis`, 포트 16379, 끝나고 `down -v`): redis-runtime `LiveRedisCompositionTest` 7, redis-sdk `LiveRedisGuardrailTest` 6·`RedisTopologyContractTest` 8, cache-redis `LiveRedisSemanticScriptAclProbeTest` 2·`LiveRedisDistributedLeaseContractTest` 7·`LiveRedisSemanticPortsTest` 10 — 40개 전부 PASS. 추가로 `ACL DRYRUN ca-skeleton-application publish prod:x` → "no permissions", `get prod:x` → OK +- `integrationCheck --continue` — BUILD SUCCESSFUL(12m 18s; 입력이 없는 lane은 설계대로 빠짐) +- `-p optional-platforms ci` — 첫 실행 spotless 1건(`GrpcAdvancedModuleGuardTest`, 키 이름이 짧아져 줄바꿈 변화) → `13e624bd` 후 BUILD SUCCESSFUL +- **로컬 기동**(`:app-bootstrap:qualificationBootJar`, `SPRING_PROFILES_ACTIVE=local`, `src/.env.example` 값): 모든 capability가 켜진 jar라 인프라 없이 차례로 막히는 곳을 하나씩 껐다 — mongo(active-profile 필요), JPA(PostgreSQL 없음), security issuer 필수, gRPC insecure-local(이제 `APP_GRPC_SERVER_ALLOW_INSECURE_LOCAL`이 relaxed 바인딩으로 `app.grpc.server.allow-insecure-local`에 닿는 것 확인), notification(JPA 필요), Redis 자격 증명, fileserver fingerprint key, httpclient client 없음, Kafka broker 주소, object-storage 바인딩 — 모두 설정 바인딩 오류가 아닌 기존의 이름 붙은 기동 검사. 이 과정에서 결함 하나 발견·수정(P20-new-6). `APP_HTTPCLIENT_CLIENTS_0_TIMEUOT_TOTAL_CALL`을 넣으면 `unrecognised environment variables under app.httpclient: [APP_HTTPCLIENT_CLIENTS_0_TIMEUOT_TOTAL_CALL]`로 거부, 올바른 이름이면 통과. 마지막 조합에서 `Started CaSkeletonApplication in 10.7 seconds`(60초 timeout으로 종료) +- 수정 뒤 `:adapter:inbound:graphql:check` PASS + +## 새로 발견한 결함 (추가) +- **P20-new-6** (고침, `12c61a99`): graphql을 `ignoreUnknownFields=false`로 바꾸자, 필수·무기본값인 `app.graphql.deployment-mode`가 shipped `graphql.yml`의 `${APP_GRAPHQL_DEPLOYMENT_MODE:}`로 빈 값이 되어 "left unbound" 바인딩 오류로 먼저 실패 — `GraphQlDeploymentMode`의 이름 붙은 거절("app.graphql.deployment-mode is required … set APP_GRAPHQL_DEPLOYMENT_MODE")을 가렸다(qualification jar 로컬 기동에서 발견). `GraphQlActivationEnvironmentPostProcessor`가 해석값이 빈 그 항목을 `graphql-defaults` source에서 뺀다. `GraphQlCapabilityActivationTest.anUnsetModeIsRefusedByNameRatherThanAsAnUnboundKey` FAIL(`Expecting actual … UnsatisfiedDependencyException … graphQlPlatformConfigurationCheck` 에 이름 붙은 문구 없음)→PASS. 같은 성질(빈 placeholder + 비-String 필드 + strict)의 다른 곳은 shipped yml 전수 확인에서 없음(나머지 빈 기본값은 모두 String/list). +- 마지막 커밋(`12c61a99`) 뒤 `check architectureCheck :app-bootstrap:verifyEnvKeys verifyDependencyLocks --continue` — BUILD SUCCESSFUL. `git status` 깨끗 + +통합 시 주의: 파일 전반(256개)이 키 이름을 바꾸므로 P30과 겹치는 파일(조건 annotation, sample yml 등)은 P30 쪽 새 코드에 `ca-skeleton.`/`backend.graphql`이 남지 않았는지 `git grep -nE '(^|[^/\w.-])ca-skeleton\.[a-z]|backend\.(graphql|web\.(mvc|advanced))' -- src`로 확인할 것(남아야 하는 것: 메시징 hash domain 4개, gRPC Context key 1개). `ConfigurationNamespaceContractTest.everyLeafPrefixSitsUnderTheApplicationRoot`가 설정 prefix 쪽은 잡는다. diff --git a/docs/reviews/2026-09-25-review-followup-status.md b/docs/reviews/2026-09-25-review-followup-status.md index bd3931bd..535ce1ff 100644 --- a/docs/reviews/2026-09-25-review-followup-status.md +++ b/docs/reviews/2026-09-25-review-followup-status.md @@ -71,6 +71,7 @@ Wave 3 라운드 1 결과로 받은 4건(2026-09-28, desktop): | 33 | 분리된 persistence leaf의 caller 트랜잭션 guard | `persistence-notification`·`persistence-fileserver` → `persistence-jpa` edge 추가, `CallerTransaction` 하나를 쓴다 | X1-#4, X1-지도-caller 트랜잭션 guard | | 34 | notification·fileserver id 포트를 domain `IdFactory`로 | 하지 않음 — 두 application leaf에 domain-core edge를 주지 않는다 → 보류 | P16-new-5 | | 35 | X2-P2-6b 나머지(principal tenant, GraphQL Spring Security resolver, 가명화 키) | 전부 하지 않음 — 소비자 없는 필드는 만들지 않고, adopter resolver bean 방식 유지, 키 분리는 의도(문서화) → 보류 | J-12 / X2-P2-6b | +| 36 | persistence-jpa 설정 prefix 여러 개 | 기능별 분리 인정 — JPA 플랫폼 자체(스위치·vendor·jpa-platform·migration-on-startup)는 `app.persistence-jpa.*` 하나로, 여러 저장소가 공유하는 outbox·lock·replay는 기능 트리(`app.outbox`·`app.lock`·`app.realtime.replay`)로 두고 규칙 4에 이 예외를 적는다. `APP_*` env 키 유지 | P20-new-5 | 기존 원칙에서 바로 따라 나와 에이전트가 정한 것(소유자가 뒤집을 수 있음): @@ -735,7 +736,7 @@ Wave 3 라운드 1 결과로 받은 4건(2026-09-28, desktop): | X2-P1-2b | Required | httpclient `profile/RuntimeEnvironment`가 정본과 이름이 같음(Nit) | 남음 | `adapter/outbound/httpclient/.../profile/RuntimeEnvironment.java` (httpclient 안 참조 파일 4개 + 정본 import 1개) | W5 | `HttpClientHardening` 등으로 개명, 참조 4파일 수정 | | X2-P1-3a | Required(문서) | capability settings 규칙(strict 바인딩 + compact constructor)을 root 문서에 | 완료 | `AGENTS.md:216` capability 완료 기준 4, 커밋 `6d27356e` | - | - | | X2-P1-3b | Required | gRPC adapter strict prefix `ca-skeleton.grpc`가 벤더 `ca-skeleton.grpc.platform`과 겹침 | 완료 | Wave 1–2 P5 (fcddab7e·Wave 2 커밋): `GrpcSafeActivationTest.theVendorPlatformNamespaceBesideTheAdapterDoesNotFailItsStrictBinding` FAIL(`UnboundConfigurationPropertiesException: The elements [ca-skeleton.grpc.platform.enabled] were left unbound`)→PASS. 어댑터 prefix `ca-skeleton.grpc` → `ca-skeleton.grpc.server` `src/adapter/inbound/grpc/src/main/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerSettings.java:17`, `GrpcServerConfig.java`. 어댑터 키는 env-keys registry에 행이 없었다(추가·수정 없음). 갱신: `src/adapter/inbound/grpc/{CLAUDE,README}.md`, `src/README.md:269`(env `CA_SKELETON_GRPC_SERVER_ALLOW_INSECURE_LOCAL`). **오케스트레이터 할 일:** `docs/capability-status.md:42`의 `ca-skeleton.grpc.enabled`·`ca-skeleton.grpc.allow-insecure-local`을 `.server.` 경로로. Wave 3-B(`app.*`)에서도 `app.grpc.server`처럼 벤더 prefix와 형제로 둬야 같은 충돌이 다시 안 생긴다. 커밋 `a498ad84` | - | adapter prefix를 `ca-skeleton.grpc.server` 등으로 분리(설정 키·env key·README 갱신) | -| X2-P1-3c | Required | 오타 키 거부가 일부 capability에만 적용 | 남음 | strict 바인딩 4곳(fileserver·httpclient `StrictSettingsBinder`, `GrpcServerSettings.java:17`, `GrpcPlatformProperties.java:19`) / main `@ConfigurationProperties` 54파일(`git grep -l "@ConfigurationProperties" -- 'src/**/src/main/java/**'`) | W3 | `AGENTS.md:216` 기준대로 capability 모듈(cache-redis, persistence-jpa, persistence-mongo, messaging, notification, objectstorage, graphql, websocket) settings를 `StrictSettingsBinder`로 바인딩 | +| X2-P1-3c | Required | 오타 키 거부가 일부 capability에만 적용 | 완료 | Wave 3 W3-P20 (Wave 3 커밋): 위 "strict 바인딩 현황" 표. 각 모듈 재현 테스트 FAIL(`Expecting: to have failed`)→PASS: `DistributedLockPersistenceConfigTest.aMisspelledLockKeyFailsStartup`, `JpaStartupAutoConfigurationTest.aMisspelledSafetyKeyFailsStartup`, `PersistenceVendorSelectionTest.aMisspelledPersistenceKeyFailsStartup`(`0f8e9053`), `RedisCapabilityCompositionTest.aMisspelledCapabilityKeyFailsStartup`(+`theIdempotencyLifecycleKeysAreLeftToTheirOwner`, `34fe03d1`), `NotificationPlatformCoreConfigurationTest.aMisspelledPlatformKeyFailsStartup`(`6ef946a0`), `MessagingPlatformBridgeAutoConfigurationTest.aMisspelledTopLevelMessagingKeyFailsStartup`(+`thePlatformsOwnSectionsAreLeftToThePlatform`, `2f19accc`), `ServiceRuntimeRegistrationTest.aMisspelledRuntimeKeyFailsStartup`(`976fcf0b`), `ObjectStorageCapabilityConfigTest.aMisspelledObjectStorageKeyFailsStartup`(`28fdbfb1`), `WebSocketSettingsTest.aMisspelledWebSocketKeyFailsStartup`·`GraphQlDeploymentModeContractTest.aMisspelledGraphQlKeyFailsStartup`·`MongoPersistenceConfigTest.aMisspelledPlatformKeyFailsStartup`(`8ff4371d`). graphql·websocket·mongo는 support edge가 없어(inbound→outbound 금지, mongo closure) Spring 고유 `ignoreUnknownFields=false` — yml/properties 오타는 거부, env 오타는 Spring이 system env를 검사에서 빼므로 거부하지 않음(차이를 README 대신 여기 기록). objectstorage는 registry에 support edge 추가(`28fdbfb1`, 커밋 메시지에 이유). `StrictSettingsBinder`는 `bindOrCreate`로(키가 없으면 기본값) | - | `AGENTS.md:216` 기준대로 capability 모듈(cache-redis, persistence-jpa, persistence-mongo, messaging, notification, objectstorage, graphql, websocket) settings를 `StrictSettingsBinder`로 바인딩 | | X2-P1-4a | Consider | web `cursor/CursorCodec`(dev key 하드코딩) 삭제 | 완료 | `docs/capability-status.md:94`, `HmacWebCursorCodec`도 삭제(`:97`), 커밋 `6d27356e` | - | - | | X2-P1-4b | Consider | 서명 계층 하나(inbound에서 서명, persistence는 typed keyset), 남으면 공용 서명 헬퍼 | 완료 | Wave 3 W3-P19 (Wave 3 라운드 3 커밋): 커밋 `35e1df8a`. `shared-contract/.../digest/HmacSha256.java`(sign/verify, 길이 먼저 확인 후 constant-time), `HmacSha256Test` 5건. 사용: graphql `HmacGraphQlCursorCodec`·`GraphQlIdentityFingerprinter`, persistence-jpa `SignedJsonCursorCodec`, notification HMAC 3곳, sample digester. 서명 codec은 유지(2026-09-25 결정). mongo `MongoKeysetCursorCodec`은 shared-contract edge 없어 유지, redis·identifier·fileserver는 동시 묶음/edge 없음으로 유지 | - | 결정(2026-09-25): Wave 3 라이브러리 유지 결정을 따름 — 서명 codec 유지, shared-contract에 sign/verify 헬퍼 하나로 중복 제거 | | X2-P1-5 | Consider | SHA-256 보일러플레이트 → shared-contract `Sha256` | 완료 | Wave 3 W3-P19 (Wave 3 라운드 3 커밋): 커밋 `bca2c682`. `shared-contract/.../digest/Sha256.java`(of/ofUtf8/newMessageDigest/hex), `Sha256Test` 5건. `MessageDigest.getInstance` main 36곳 → 10곳(mongo 3, application-objectstorage 2 — shared-contract edge 없음; vendored messaging 2·gRPC 2; cache-redis SHA-1 1) | - | shared-contract `Sha256.hex(String)`·`digest(byte[])` 추가, edge 있는 25파일 교체(objectstorage 12, sample 3, graphql 2, cache-redis 2, fileserver 2, notification 2, persistence-jpa 2); mongo 3·application-objectstorage 2(edge 없음)와 벤더 5는 유지 | @@ -860,9 +861,9 @@ Wave 3 라운드 1 결과로 받은 4건(2026-09-28, desktop): | S3-#13b | Nit | draining·retry 소진을 `HttpRateLimitRejectedException`으로 던짐(텔레메트리 카테고리 오기) | 완료 | Wave 1–2 P11 (fcddab7e·Wave 2 커밋): `DefaultGenericHttpGatewayTest.anExhaustedRetryBudgetIsReportedAsItsOwnFailureNotARateLimit`·`aRetryRefusedByADrainingRuntimeIsReportedAsItsOwnFailureNotARateLimit` FAIL(`expected HttpRetryBudgetExhaustedException/HttpRuntimeDrainingException but was HttpRateLimitRejectedException`)→PASS. `HC/restclient/DefaultGenericHttpGateway.java:183,281`, 새 타입 `HC/api/error/HttpRetryBudgetExhaustedException.java`·`HttpRuntimeDrainingException.java`, `docs/httpclient/operations.md` 예외 표 갱신. 두 경로는 재시도 판정과 다음 attempt 사이의 경합에서만 도달하므로 테스트는 `TestGateways.forProfile(profile, transport, eligibility)`로 판정기를 주입해 재현 | - | draining·retry 소진 전용 예외(또는 카테고리)로 분리 | | S3-#13c | Nit | Redis health indicator 둘이 DOWN 값만 다름 | 남음 | `redis-runtime/.../sdk/config/RedisSdkAutoConfiguration.java:257`(DEGRADED)·`:285`(DOWN) | W5 | 상태 값만 인자로 받는 indicator 하나로 | | S3-lead-1 | 권고 | `RedisSecretSource` + `System.getenv` 기본값 vs `SecretSourcePort` (= X2 P1-1) | 완료 | 문제 아님: redis-runtime은 의존 edge가 없어 자체 SPI(`RedisSdkAutoConfiguration.java:168-171,334`)를 두고, cache-redis가 `SecretSourcePort`로 bridge(`cache-redis/.../capability/RedisCapabilityConfig.java:66`). X2 P1-1이 이 구조를 모범 사례로 판정 | - | - | -| S3-lead-2 | 권고 | `HttpClientEnvironmentKeys`(리플렉션 env 이름 역산) vs `StrictSettingsBinder` (= X2 P1-3) | 남음 | `httpclient/.../autoconfigure/HttpClientEnvironmentKeys.java`(179줄, `RecordComponent` 순회), `HttpClientPlatformSettingsBinder.java:27`만 사용. 다른 capability는 env 오타 검사 없음 | W3 | env 이름 역산 검사를 support `StrictSettingsBinder` 옵션으로 옮겨 모든 capability가 같은 방식으로 오타 env를 거부 | +| S3-lead-2 | 권고 | `HttpClientEnvironmentKeys`(리플렉션 env 이름 역산) vs `StrictSettingsBinder` (= X2 P1-3) | 완료 | Wave 3 W3-P20 (Wave 3 커밋): `68cda1d3`: env 오타 검사를 `StrictSettingsBinder`(support)로 일반화하고 httpclient `HttpClientEnvironmentKeys`(리플렉션 역산) 삭제. system env는 unbound 검사에서 빼고(Spring 열거형 `app.outbox.poll.interval`이 하이픈 필드를 오판 — 모든 트리가 `app.*`가 되면서 모든 capability의 문제가 됨), prefix의 env 형태로 시작하는 변수가 (a) 이번 바인딩이 바인딩한 속성, (b) 다른 source가 선언한 속성, (c) placeholder가 읽는 변수 중 하나의 env 형태가 아니면 이름으로 거부. `StrictSettingsBinderTest`: `aCorrectlySpelledHyphenatedEnvironmentVariableBinds`(FAIL: `BindException: Failed to bind properties under 'sample.shared'`)→PASS, `aMisspelledEnvironmentVariableIsRefusedByName`(FAIL: `Expecting actual throwable to be an instance of CapabilityStartupValidationException but was BindException`)→PASS, `aVariableASettingReadsThroughAPlaceholderIsNotATypo`(FAIL: BindException)→PASS, `aSubtreeAnotherModuleOwnsIsLeftToThatModule`(FAIL: BindException)→PASS, `aHyphenatedListFromTheEnvironmentBindsWhenForeignKeysAreExcluded`(P20-new-2 회귀). httpclient `HttpClientPlatformEnvManifestTest.aMisspelledEnvironmentVariableIsRefused` PASS(공용 binder로). manifest 도출(`fieldToEnvTemplate`)은 테스트로 옮김. `src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/StrictSettingsBinder.java` | - | env 이름 역산 검사를 support `StrictSettingsBinder` 옵션으로 옮겨 모든 capability가 같은 방식으로 오타 env를 거부 | | S3-lead-3 | 권고 | TLS material 로딩이 Redis와 httpclient에 따로 | 완료 | 문제 아님: Redis는 Lettuce `SslOptions`에 PEM 위치만 넘김(`RedisTopologyClientFactory.java:327-362`), httpclient는 JSSE `KeyStore`·`TrustManagerFactory` 구성(`security/TlsMaterialProvider.java`). 클라이언트 API가 달라 공유할 코드가 없고 redis-runtime은 의존 edge 0 | - | - | -| S3-lead-4 | 권고 | `ca-skeleton.capabilities.*` selector 문자열이 여러 leaf에 흩어짐 | 남음 | main 13파일(sample, app-bootstrap 3, web 1, persistence-jpa 3, redis-runtime `RedisCorrectnessRoles.java`, cache-redis 4), `...idempotency.provider` 30회 | W3 | 역할별 selector 키를 한 곳(멱등성은 S1-lead-3의 composition 모듈, Redis는 `RedisCorrectnessRoles`)에 상수로 두고 나머지는 그 상수/조건 클래스를 사용 | +| S3-lead-4 | 권고 | `ca-skeleton.capabilities.*` selector 문자열이 여러 leaf에 흩어짐 | 완료 | Wave 3 W3-P20 (Wave 3 커밋): `711a3968`: `src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/CapabilitySelectors.java`(ROOT·CACHE_DEFAULT_BINDING·IDEMPOTENCY_PROVIDER·RATE_LIMIT_PROVIDER·LEASE_PROVIDER). 사용: cache-redis `RedisCacheConfig`·`RedisCorrectnessRoleSelectors`·`RedisIdempotencyConfig`·`RedisLeaseConfig`·`RedisRateLimitConfig`·`RedisCapabilitySettings.bind`, persistence-jpa `PostgreSqlIdempotencyStoreConfig`·`IdempotencyReaper`·`IdempotencySchemaStream`, composition:idempotency `IdempotencyAutoConfiguration`. 현황표 방향(멱등성은 composition 모듈에)과 다르게 support에 둔 이유: persistence-jpa·cache-redis는 composition:idempotency에 의존할 수 없고(registry), 셋 다 support에 이미 의존한다. main의 `app.capabilities.*.provider` 문자열 리터럴 0건(`git grep '"app.capabilities' -- '*/src/main/*'`는 메시지·주석뿐) | - | 역할별 selector 키를 한 곳(멱등성은 S1-lead-3의 composition 모듈, Redis는 `RedisCorrectnessRoles`)에 상수로 두고 나머지는 그 상수/조건 클래스를 사용 | | S3-lead-5 | 권고 | `secret:///` 파싱이 다른 leaf에도 | 완료 | Wave 3 W3-P26 (Wave 3 라운드 2 커밋): `application-core` `SecretReference`(record source/name, `parse`·`isReference`, `application-core/.../outbound/SecretReference.java:47`)를 `SecretSourcePort` 옆에 추가. httpclient(`HttpClientAuthenticationAutoConfiguration.java:60-64`)와 cache-redis(`RedisKeys.java:83`)가 사용 — 둘 다 기존 edge(application-core) 안, registry 변경 없음. mongo·redis-runtime은 지시대로 유지. 테스트 `SecretReferenceTest` 6개(새 타입이라 FAIL은 컴파일 실패). cache-redis는 이름이 빈 `secret://src/`를 빈 키로 port에 넘기던 것이 이제 거부됨(`referenceWhoseNameIsBlankIsRejected`) | - | application-core `SecretSourcePort` 옆에 `SecretReference.parse` 하나, httpclient·cache-redis가 사용(mongo·redis-runtime은 edge 없어 유지) | **조사 메모** @@ -992,7 +993,7 @@ Wave 3 라운드 1 결과로 받은 4건(2026-09-28, desktop): | S6-#11c | Consider | sample 테스트가 `TransactionPort` fake를 각자 작성 (= X1-#3 일부) | 완료 | application-core testFixtures `DirectTransactionPort`(`src/application-core/src/testFixtures/java/dev/caskeleton/application/transaction/testkit/DirectTransactionPort.java`), sample 테스트의 인라인 fake 0건, `6d27356e` | - | - | | S6-#12 | Consider | JPA 정책 클래스 겸용, 주입처 없는 bean, 테스트만 쓰는 플래그 | 완료 | `JpaPlatformAutoConfiguration` 삭제·`JpaStartupAutoConfiguration`으로 합침(`CS:238`), `app.jpa-platform.addons-enabled` 삭제(`CS:193`), `jpaDataSourceProfileValidator`가 `jpaResolvedDataSourceCheck`에 주입됨(`JS/JpaStartupAutoConfiguration.java:100,109-110`), `6d27356e` | - | - | | S6-#13 | Consider | 역할 없는 startup 예외 subclass 4개 | 완료 | Wave 3 W3-P25 (Wave 3 라운드 2 커밋): 4개 subclass 삭제, `StartupFailureException`을 final + package-private 생성자로(`support/.../startup/StartupFailureException.java:18,25`), 생성은 `StartupFailures`만. 테스트 23개 파일의 `isInstanceOf(XxxException.class)`를 `isInstanceOfSatisfying(StartupFailureException.class, e -> errorCode 단언)`으로. `StartupFailureExceptionTest`는 코드→exit 파라미터 테스트. support·persistence-jpa·cache-redis·app-bootstrap `test`/`architectureTest` PASS | - | `StartupFailureException` 하나 + 테스트는 `errorCode()` 단언; 생성은 `StartupFailures` factory만 | -| S6-#14 | Consider | 스위치 prefix 3종, "capability" 뜻 여러 개 | 남음 | prefix: `ca-skeleton.*`(persistence-jpa, persistence-mongo, notification, outbox, grpc), `app.*`(messaging, redis, fileserver-platform, httpclient, object-storage, websocket), `backend.graphql`(`CS:30-45`). "capability": `@UseCaseCapability`, `capabilities.*` selector, `JpaCapability`, `MessagingCapabilities`. `MasterSwitch`·endpoint 미보고 부분은 삭제로 해당 없음 | W3 | 결정(2026-09-25): 설정 prefix를 `app.*`로 통일(`ca-skeleton.*`, `backend.graphql` → `app.*`), `APP_*` env 키 유지 | +| S6-#14 | Consider | 스위치 prefix 3종, "capability" 뜻 여러 개 | 완료 | Wave 3 W3-P20 (Wave 3 커밋): 결정 16: 설정 prefix를 `app.*` 하나로(위 표). `711a3968`·`fabb611e`. env 키 이름 변경 없음. `ConfigurationNamespaceContractTest`: 허용 root는 `app` 하나(`shippedConfigurationDeclaresOnlyRecordedRoots`), 모든 leaf의 `@ConfigurationProperties`·`String PREFIX` 상수가 `app.` 아래(`everyLeafPrefixSitsUnderTheApplicationRoot`, 새 테스트) — `src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ConfigurationNamespaceContractTest.java`. yml root 병합 4곳(cache-redis·notification module-defaults, sample `application.yml`·systemTest yml). "capability" 용어 정리는 이번 범위 밖(키 이름만) | - | 결정(2026-09-25): 설정 prefix를 `app.*`로 통일(`ca-skeleton.*`, `backend.graphql` → `app.*`), `APP_*` env 키 유지 | | S6-#15 | Consider | bootstrap `:test`에 저장소 governance 테스트 | 남음 | `src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/` 하위 45파일 7,302줄(`208077fd` 50파일), 이 중 34개가 저장소 파일·리소스를 직접 읽음 | W4 | `architectureTest`처럼 별도 strict lane으로 옮기고 읽는 파일을 `inputs`로 선언 | | S6-#16a | Nit | 이력·리뷰 ID 주석 | 남음 | bootstrap main 이력/ID 줄 35개(105에서 감소, 주석 비율 19%), websocket 2개(해소 수준) | W5 | bootstrap 남은 35줄 삭제 | | S6-#16b | Nit | `CapabilityDependencyEnvironmentValidator` 30줄 Javadoc | 해당 없음(코드 삭제) | `CS:249` | - | - | @@ -1166,7 +1167,7 @@ Wave 1–2 구현 묶음(`P1`–`P13`)이 작업 중 찾은 결함과 통합 검 | P10-new-1 | 발견 | `src/.env.example:25`가 `APP_SERVER_FORWARD_HEADERS_STRATEGY=framework`를 권했다. `framework`는 Spring `ForwardedHeaderFilter`가 모든 peer의 `X-Forwarded-For`를 믿어 `getRemoteAddr()` 자체를 호출자가 고르게 하므로, rate-limit 모드와 상관없이 비인증 키를 우회할 수 있었다. `na… | 완료 | Wave 1–2 P10 (fcddab7e·Wave 2 커밋): 결과 파일 `docs/reviews/2026-09-25-review-followup-results/P10.md` | - | - | | P10-new-2 | 발견 | `WebMvcRequestIdFilter`의 traceparent 정규식은 all-zero trace id 등을 받아들였고 `RequestLoggingFilter`의 `TraceParent.parse`는 거부해서, 같은 요청에서 두 필터가 다른 trace id를 가질 수 있었다(I-4b의 한 원인). 이제 `TraceParent.parse` 하나만 쓴다. | 완료 | Wave 1–2 P10 (fcddab7e·Wave 2 커밋): 결과 파일 `docs/reviews/2026-09-25-review-followup-results/P10.md` | - | - | | P10-new-3 | 발견 | 옛 콜백 컨트롤러의 `@RequestBody byte[]`는 form POST(`application/x-www-form-urlencoded`, query string 없음)에서 Spring 7 `ServletServerHttpRequest.getBody()`가 요청 파라미터로 다시 만든 본문을 준다(`getBodyFromServletRequestParameters`, spring-web 7.0.9 bytec… | 완료 | Wave 1–2 P10 (fcddab7e·Wave 2 커밋): 결과 파일 `docs/reviews/2026-09-25-review-followup-results/P10.md` | - | - | -| P11-new-1 | 발견 | `app.httpclient.clients[N].timeout.streaming-idle`(`APP_HTTPCLIENT_CLIENTS_N_TIMEOUT_STREAMING_IDLE`)은 바인딩만 되고 main 코드 어디서도 읽지 않음(reactive 삭제 전에도 그랬음). `HC/profile/TimeoutSettings.java:25`, `docs/httpclient/configuration-reference… | 남음 | 결과 파일 `docs/reviews/2026-09-25-review-followup-results/P11.md` | W3 | 읽지 않는 `timeout.streaming-idle` 키·env 키 삭제 | +| P11-new-1 | 발견 | `app.httpclient.clients[N].timeout.streaming-idle`(`APP_HTTPCLIENT_CLIENTS_N_TIMEOUT_STREAMING_IDLE`)은 바인딩만 되고 main 코드 어디서도 읽지 않음(reactive 삭제 전에도 그랬음). `HC/profile/TimeoutSettings.java:25`, `docs/httpclient/configuration-reference… | 완료 | Wave 3 W3-P20 (Wave 3 커밋): `711a3968`: 읽지 않던 `clients[N].timeout.streaming-idle` 키 삭제 — `TimeoutSettings`·`HttpClientPlatformSettings.Timeout`·`HttpClientProfileFactory`·testFixtures `ClientProfiles`에서 `streamingIdle` 제거, `docs/httpclient/env-fields.yaml`·`configuration-reference.md` 행 삭제. `HttpClientPlatformEnvManifestTest.theManifestAndTheSettingsTreeAgree` PASS(manifest와 record 트리 일치). 이제 `APP_HTTPCLIENT_CLIENTS_0_TIMEOUT_STREAMING_IDLE`을 설정하면 strict binder가 이름으로 거부 | - | 읽지 않는 `timeout.streaming-idle` 키·env 키 삭제 | | P11-new-2 | 발견 | `scripts/verify-httpclient-docs.py:22`가 없는 경로 `src/app-bootstrap/.../autoconfigure/httpclient/HttpClientStartupValidator.java`를 읽어 `FileNotFoundError`로 실패함. 경로를 `.../httpclient/autoconfigure`로 바꿔 돌리면 `rotation-drain-timeout`이 `doc… | 남음 | 결과 파일 `docs/reviews/2026-09-25-review-followup-results/P11.md` | W5 | `scripts/verify-httpclient-docs.py` 경로 수정, `rotation-drain-timeout` 문서 추가 | | P11-new-3 | 발견 | `httpClientFailureInjectionTest`의 `FailureInjectionContractTest.disabledProxyFailsBeforeARequestCanBeSent`가 이 머신에서 실패(`expected: NOT_SENT but was: SENT_NO_RESPONSE`). Docker userland proxy(`docker-proxy` 동작 중)가 꺼진 Toxiproxy 리스너의 p… | 남음 | 결과 파일 `docs/reviews/2026-09-25-review-followup-results/P11.md` | W4 | Docker userland proxy에 의존하지 않는 방식으로 lane 수정(기준 커밋에서도 실패 — 기존 결함) | | P11-new-4 | 발견 | Dynamic Target cross-origin hop은 `SensitiveHeaderStripper` 표준 이름(`authorization`·`cookie`·`x-api-key`·`api-key` 등)만 제거하므로, 호출자가 `HeaderPolicy`로 넘긴 관례 밖 이름의 자격증명 헤더(예: `X-Client-Key`)는 다음 origin으로 따라감 `HC/dynamic/DefaultDynamicTarg… | 완료 | Wave 2.5 W2-P14 (Wave 3 라운드 1 커밋): 결정 23. `DefaultDynamicTargetGatewayTest.crossOriginHopKeepsOnlySafeCallerHeaders` FAIL(`[(true, true), (true, true)]`)→PASS. `HC/dynamic/DefaultDynamicTargetGateway.java:164,172-185` cross-origin hop에서 호출자 헤더를 allowlist(`Accept`·`Accept-Language`·`Content-Type`·`Content-Language`)로만 남김. 자격증명 binding 헤더는 hop마다 새 target 기준으로 다시 붙음(기존) | - | 결정 23: cross-origin hop에서 호출자 헤더 전부 제거, 안전한 헤더만 유지 | @@ -1215,8 +1216,8 @@ Wave 1–2 구현 묶음(`P1`–`P13`)이 작업 중 찾은 결함과 통합 검 | P21-new-1 | 발견 | handler가 `Retry`를 답하면 Kafka consumer가 시도 횟수를 세지 않아 partition이 영구히 멈췄다. | 완료 | Wave 3 P21: 예외와 같은 시도 예산·격리 사용 | - | - | | P21-new-2 | 발견 | 다시 읽은 delivery가 항상 `deliveryAttempt=1`을 보고했다. | 완료 | Wave 3 P21 | - | - | | P21-new-3 | 발견 | `src/messaging/CLAUDE.md`가 `MessagingPublicSurfaceContractTest`를 인용 — 테스트는 app-bootstrap에 있다(P21은 없다고 보고). 통합 때 이 테스트가 P21 변경(reactive facade 삭제, leaf 병합, starter-kafka 공개 consumer seam)을 반영하지 못해 실패 → 기대값 수정, starter-kafka에 `api kafka-clients` 선언. | 남음 | Wave 3 라운드 3 통합 | W5 | messaging CLAUDE.md의 테스트 위치 문구를 app-bootstrap 경로로 | -| P22-new-1 | 발견 | bootstrap `SecretSourceValidator`가 persistence-jpa의 모듈 스위치를 읽어 `APP_DATASOURCE_PASSWORD` 필요 여부를 판정(모듈 지식이 bootstrap에). | 남음 | Wave 3 P22 결과 파일 | W3 | Redis처럼 persistence-jpa가 secret 요구를 기여. P20 | -| P22-new-2 | 발견 | `infra/redis-sdk/acl/application.acl`·`all-accounts.acl`이 pub/sub 삭제 뒤에도 `+@pubsub`·`&prod:*`를 준다(최소 권한 위반, fixture). | 남음 | Wave 3 P22 결과 파일 | W3 | ACL fixture에서 제거 후 topology lane 재실행. P20 | +| P22-new-1 | 발견 | bootstrap `SecretSourceValidator`가 persistence-jpa의 모듈 스위치를 읽어 `APP_DATASOURCE_PASSWORD` 필요 여부를 판정(모듈 지식이 bootstrap에). | 완료 | Wave 3 W3-P20 (Wave 3 커밋): `842e2402`: `JpaStartupAutoConfiguration#jpaProductionSecrets`가 `RequiredProductionSecrets`로 `APP_DATASOURCE_PASSWORD`를 기여(모듈이 켜져 있을 때만). `SecretSourceValidator`는 `app.persistence-jpa.enabled`를 더 읽지 않고 `REQUIRED_PROD_SECRETS = [APP_PRIVACY_PSEUDONYMIZATION_SALT]`. 레지스트리 `secrets-classification.yaml`의 `APP_DATASOURCE_PASSWORD`에 `required_when: app.persistence-jpa.enabled=true`(`SecretsClassificationRegistryTest` 1:1 유지). `JpaStartupAutoConfigurationTest.theModuleContributesTheDatabasePasswordAsAProductionSecret` FAIL(`Expecting … to have a single bean of type RequiredProductionSecrets`)→PASS, `aSwitchedOffModuleOwesNoDatabasePassword` PASS, bootstrap `SecretSourceValidatorTest.theGuardAloneDoesNotRequireADatabasePassword`(스위치 true + 빈 비밀번호 + 기여 없음 → 기동) PASS | - | Redis처럼 persistence-jpa가 secret 요구를 기여. P20 | +| P22-new-2 | 발견 | `infra/redis-sdk/acl/application.acl`·`all-accounts.acl`이 pub/sub 삭제 뒤에도 `+@pubsub`·`&prod:*`를 준다(최소 권한 위반, fixture). | 완료 | Wave 3 W3-P20 (Wave 3 커밋): `b509991a`: `infra/redis-sdk/acl/application.acl`·`application-advanced.acl`·`all-accounts.acl`의 application 두 계정에서 `+@pubsub`·`&prod:*` 삭제(`resetchannels`만 남음). admin-readonly의 `+pubsub channels` 등 introspection은 그대로(읽기 전용 관측). topology lane 결과는 아래 검증 절 | - | ACL fixture에서 제거 후 topology lane 재실행. P20 | | P22-new-3 | 발견 | redis-sdk 공개 API가 runtime 타입을 노출하면서 runtime을 `implementation`으로만 의존. `ca.spring-library`에 `api` 구성이 없어 한 줄로 못 고침. | 완료 | Wave 3 W3-P29 (Wave 3 라운드 3 커밋): `3967c9ef`. redis-sdk만 `java-library` + `api project(':adapter:outbound:redis-runtime')` / 통합 검증 통과(redis-sdk java-library + api redis-runtime) | - | 컨벤션에 `java-library` 적용 또는 공개 표면에서 runtime 타입 제거. P29 | | ORCH-new-4 | 발견 | redis-sdk `RedisSdkModuleBoundaryTest`·`RedisSupportMatrixTest`가 옛 split package(`redis-runtime/.../redis/sdk`)를 훑음 — P22 worktree에서 통과, main 통합에서 `NoSuchFileException`(ORCH-new-2와 같은 유형: 저장소 파일을 읽지만 test inputs 미선언). | 남음 | 경로는 통합 때 수정(`redis-sdk` 하나) | W4 | 읽는 파일을 test `inputs`로 선언 | | P19-new-1 | 발견 | notification `platform.api.TenantId`가 비어 있지 않음·100자 이하만 검사 — web·GraphQL이 거부하는 tenant(공백·줄바꿈·경로 문자)를 받는다. 강화하면 이미 저장된 행을 못 읽을 수 있다. | 완료 | Wave 3 W3-P30 (Wave 3 라운드 4 커밋): 커밋 `1fc862a8`. `application-notification/.../platform/api/TenantId.java`는 그대로(저장된 행을 읽는 타입 — 이전 규칙으로 쓴 행도 읽힘, `NotificationSubmissionServiceTest.aTenantStoredUnderTheOldRuleIsStillReadable`). 새 쓰기만 `dispatch/WritableTenant.require`(package-private)로 application-core `TenantId` 문법(`[A-Za-z0-9][A-Za-z0-9_.-]{0,63}`)을 요구, 어긋나면 `NotificationValidationException`(`VALIDATION_FAILED`, 다른 제출 검증과 같은 코드): `NotificationSubmissionService.prepare`(submit·schedule 공통 첫 단계), `AcceptNotificationApplicationUseCase.handle`(첫 쓰기인 연락처 등록 전). 테스트: `NotificationSubmissionServiceTest.aSubmissionForATenantOutsideTheTransportGrammarIsRefused`(공백·줄바꿈·`../`·`/`·선행 `-` 5건) FAIL(`Expecting actual not to be null`) → PASS, `AcceptNotificationApplicationUseCaseTest.anAcceptanceForATenantOutsideTheTransportGrammarRegistersNothing` FAIL → PASS. 기본 단일 tenant `"default"`(`NotificationPlatformCodecConfig.java:57`)는 문법 안. 검증: application-notification 230, adapter:outbound:notification·web-notification·composition notification `check` PASS | - | 읽기는 관대하게, 새 쓰기만 공용 `TenantId` 문법으로. P30 | @@ -1227,3 +1228,9 @@ Wave 1–2 구현 묶음(`P1`–`P13`)이 작업 중 찾은 결함과 통합 검 | P30-new-1 | 발견 | fileserver `DefaultCleanupService.cleanStaging`이 `claimForCleanup`(JPA `@Modifying` update)을 트랜잭션 밖에서 불러 실제 store에서는 세션 있는 staging 정리가 매번 실패·재시도 후 포기됐다. | 완료 | Wave 3 P30 `4de7717d`: guard 추가 전 호출자를 트랜잭션 안으로 | - | - | | P30-new-2 | 발견 | notification dispatch Blocked 분기가 recipient 전이 트랜잭션을 닫은 뒤 request 상태 roll-up을 트랜잭션 밖에서 실행. | 완료 | Wave 3 P30 `4de7717d` | - | - | | P30-new-3 | 발견 | objectstorage local-dev provider의 create-only 게시가 이제 한 프로세스 안에서만 보장된다(JDK에 디렉터리 핸들 기준 create-only rename·link가 없어 검증된 부모에서 부재 확인+rename, JVM 단위 lock). 예전 hard-link 방식은 프로세스 간에도 보장했다. provider는 단일 프로세스·local-dev 전용으로 선언돼 있다. | 남음 | Wave 3 P30 결과 파일 | W5 | provider README에 단일 프로세스 보장 범위 명시 | +| P20-new-1 | 발견 | `app.*` 통일 뒤 `app.notification.platform.smtp.max-concurrency`의 env 형태가 SMTP provider profile 키와 겹쳐 변수 하나가 둘 다 설정. | 완료 | Wave 3 P20 `6ef946a0`: 속성을 `dispatch-concurrency`로(env 키 `APP_NOTIFICATION_PLATFORM_SMTP_DISPATCH_CONCURRENCY` 그대로) | - | - | +| P20-new-2 | 발견 | `StrictSettingsBinder.bindExcept`가 system env까지 filter해 하이픈 든 list/map이 env에서 빈 값으로 바인딩. | 완료 | Wave 3 P20 `68cda1d3` | - | - | +| P20-new-3 | 발견 | sample `application.yml`의 `app.cache.redis.*`(22)·`app.outbound.http.*`(15)·`app.messaging.kafka.brokers`·`app.notification.{email,slack}.provider`가 아무것도 바인딩하지 않는 죽은 키. | 남음 | Wave 3 P20 결과 파일 | W5 | 삭제(동작하지 않는 옵션은 키를 두지 않는다) | +| P20-new-4 | 발견 | `src/README.md` "Outbound HTTP client" yaml 예시가 존재하지 않는 트리를 설명. | 남음 | Wave 3 P20 결과 파일 | W5 | 현재 `app.httpclient.*` 트리로 | +| P20-new-5 | 발견 | persistence-jpa 설정이 `app.persistence-jpa`·`app.persistence`·`app.jpa-platform`·`app.lock`·`app.outbox`·`app.realtime.replay`·`app.runtime.migration-on-startup`에 흩어짐 — capability 규칙 4(prefix 하나) 위반. | 남음 | Wave 3 P20 결과 파일 | W4 | 결정 36: 플랫폼 키를 `app.persistence-jpa.*`로 모으고 AGENTS.md 규칙 4에 공유 기능 트리 예외. P33 | +| P20-new-6 | 발견 | graphql strict 바인딩 뒤 빈 `deployment-mode`가 이름 붙은 거절 대신 일반 바인딩 오류로 먼저 실패. | 완료 | Wave 3 P20 `12c61a99` | - | - | diff --git a/docs/reviews/2026-09-28-review-followup-resume-prompt.md b/docs/reviews/2026-09-28-review-followup-resume-prompt.md index c5d720d2..ea3099ac 100644 --- a/docs/reviews/2026-09-28-review-followup-resume-prompt.md +++ b/docs/reviews/2026-09-28-review-followup-resume-prompt.md @@ -77,3 +77,14 @@ cd src - 커밋 메시지 끝: `Co-Authored-By: Claude Opus 5.5 (1M context) ` - 보고는 짧게: 변경 / 확인(실행한 명령과 결과 수치) / 남은 문제. Wave마다 Slack `#clean-architecture-전체`(channel_id `C0BCN9H9ABH`)에 작업 브리핑(`:memo: *[작업] …*` 템플릿, 둘째 줄에 `repo`·`branch`·시각). - 사용자는 작은 증분마다 확인받는 것보다 검증까지 끝낸 큰 덩어리를 선호한다. 진짜로 사용자 몫인 결정만 묻는다(여러 개면 한 번에 모아서, 기본값 추천과 함께). 사용량 한도가 있으니 에이전트는 묶음을 크게 잡아 수를 줄인다(지난번 구현 에이전트는 묶음당 약 36만~72만 토큰). + +--- + +## 일시 정지 상태 (2026-09-29, 사용량 때문에 사용자 요청으로 멈춤) + +- 브랜치 HEAD `8bbf1bf0`까지 커밋됨(Wave 3 라운드 1–4의 P30까지). **main 작업 트리에 P20(설정 prefix `app.*`) 통합분이 미커밋으로 있다** — P30과의 충돌 11건과 남은 옛 키 3파일은 이미 풀었다. 재개하면 먼저 Wave 3 종료 검증을 다시 돌리고(로그 scratchpad `w3-*.log`, 멈출 때 실행 중이었음), 통과하면 `docs/capability-status.md`에 `W3-P20.md` 「제거된 코드」 행을 붙이고 커밋 `review-followup Wave 3`. +- 현황표: 완료 606 · 해당 없음 133 · 보류 5 · 남음 173(W4 63 · W5 110). 소유자 결정은 36번까지(현황표 「소유자 결정」 절). +- 계획서 「Wave 4」에 묶음 P31–P34가 있다. P31·P32·P34는 도중에 멈췄다 — worktree 브랜치에 커밋이 남아 있다(`worktree-agent-a3ab3a38ced388a02` P31 4커밋+미커밋 1, `worktree-agent-a37868fbf0dfdeb96` P32 3커밋, `worktree-agent-aa5edcaae241be106` P34 2커밋+미커밋 4, 기준 `8bbf1bf0`). 결과 파일은 scratchpad `W4-P3x.md`(있으면). 재개 시: 각 브랜치 커밋을 확인하고 새 에이전트에 "이 브랜치에서 이어서"로 넘기거나 커밋분만 cherry-pick 후 남은 행으로 새 묶음. P33은 아직 시작 전(P20-new-5 결정 36 포함). +- Wave 3 통합 때 반복된 문제: worktree에서 통과하고 main에서만 실패하는 테스트(저장소 파일을 읽으면서 test inputs 미선언) — P34가 전수 점검 중이었다. +- Wave 3 종료 검증 결과(멈춘 뒤 끝남): mainCheck·architecture/public path/env/config·integration·integrationCheck·build-logic·optional-platforms·releaseCheck/qualificationBootJar 통과, **check·ci 실패** — 재개하면 먼저 원인 확인(로그 scratchpad `w3-check.log`): + > Task :adapter:outbound:persistence-jpa:spotlessJavaCheck FAILED diff --git a/docs/runbooks/grpc-advanced-capabilities.md b/docs/runbooks/grpc-advanced-capabilities.md index a4b0b490..bc3a50d3 100644 --- a/docs/runbooks/grpc-advanced-capabilities.md +++ b/docs/runbooks/grpc-advanced-capabilities.md @@ -3,7 +3,7 @@ Scope: the `:grpc-advanced:*` family. Everything here is off by default and stays off until a deployment names it. Nothing in this family ships in a runtime composition today. -Flags are `ca-skeleton.grpc.advanced..enabled`. `GrpcAdvancedCapability` owns the list of +Flags are `app.grpc.advanced..enabled`. `GrpcAdvancedCapability` owns the list of capability names; `GrpcAdvancedSupportMatrix` owns their current grades. --- diff --git a/docs/runbooks/grpc-platform-operations.md b/docs/runbooks/grpc-platform-operations.md index 9ce05877..07d0639d 100644 --- a/docs/runbooks/grpc-platform-operations.md +++ b/docs/runbooks/grpc-platform-operations.md @@ -5,8 +5,8 @@ empty — so nothing here fires in production yet. It is written now because the the ones an on-call cannot work out from first principles at three in the morning, and shipping the behaviour before the runbook means the first person to meet one is doing that. -Configuration lives under `ca-skeleton.grpc.platform.*` and is bound by `GrpcPlatformProperties`. -The platform does not start unless `ca-skeleton.grpc.platform.enabled=true`. +Configuration lives under `app.grpc.platform.*` and is bound by `GrpcPlatformProperties`. +The platform does not start unless `app.grpc.platform.enabled=true`. --- @@ -94,7 +94,7 @@ capacity on nothing. means the bottleneck is admission, not the work. 2. Check which saturation counter is moving — executor, channel or flow control. They look identical in a latency graph and have different fixes. -3. Raising `ca-skeleton.grpc.platform.executor-queue-capacity` defers the problem; it does not remove +3. Raising `app.grpc.platform.executor-queue-capacity` defers the problem; it does not remove it. `GrpcExecutorProfile` refuses a queue above ten thousand for that reason. --- @@ -138,5 +138,5 @@ construction rather than redacted. - **Reflection in production.** `GrpcReflectionMode.defaultFor` returns `DISABLED` for `STAGE` and `PROD`. Reflection publishes the whole schema to anyone who can open a connection. - **Every advanced capability.** See `docs/runbooks/grpc-advanced-capabilities.md`. -- **The platform itself.** `ca-skeleton.grpc.platform.enabled` defaults to false, and every `:grpc:*` +- **The platform itself.** `app.grpc.platform.enabled` defaults to false, and every `:grpc:*` leaf is build-only in the registry. diff --git a/docs/runbooks/outbox-publish-failed.md b/docs/runbooks/outbox-publish-failed.md index 8975e2f7..e2ea1957 100644 --- a/docs/runbooks/outbox-publish-failed.md +++ b/docs/runbooks/outbox-publish-failed.md @@ -42,7 +42,7 @@ status: stub ### Step 2 — 임시 격리 - 일시 실패는 자동 backoff 재시도(30s × 2^(attempt-1) + jitter, max attempts 3)가 동작 — 즉시 수동 개입 불필요 - broker 장기 다운이면 DEAD 전이 누적 전에 broker 회복을 우선 (max attempts 소진 시 `runbook://outbox/dead-letter`로 이관) -- relay 자체를 멈춰야 하면 `ca-skeleton.outbox.relay-enabled=false`로 스케줄러 비활성 (이벤트는 outbox 테이블에 안전하게 보존됨 — 유실 없음) +- relay 자체를 멈춰야 하면 `app.outbox.relay-enabled=false`로 스케줄러 비활성 (이벤트는 outbox 테이블에 안전하게 보존됨 — 유실 없음) ## 3. Diagnosis @@ -62,7 +62,7 @@ status: stub - 단기: broker 회복 후 backoff 만료 시 자동 재발행 — `outcome=PUBLISHED` 회복 확인 - IN_FLIGHT orphan(claim 후 crash)은 in-flight-timeout(기본 PT5M) 경과 후 자동 재claim — at-least-once이므로 중복 발행 가능, consumer dedupe(idempotencyKey)가 흡수 -- 장기: `ca-skeleton.outbox.poll-interval`/`batch-size` 조정, broker 가용성 SLA 점검, 빈발 event_type의 payload 계약 검토 +- 장기: `app.outbox.poll-interval`/`batch-size` 조정, broker 가용성 SLA 점검, 빈발 event_type의 payload 계약 검토 ## 5. Escalation diff --git a/docs/security/public-paths-snapshot.txt b/docs/security/public-paths-snapshot.txt index ec4f2db5..f2f1818c 100644 --- a/docs/security/public-paths-snapshot.txt +++ b/docs/security/public-paths-snapshot.txt @@ -1,5 +1,5 @@ # feature-security-operational-baseline D5 — deny-by-default public path snapshot. -# SSOT: ca-skeleton.security.public-paths default in app-bootstrap/src/main/resources/config/security.yml +# SSOT: app.security.public-paths default in app-bootstrap/src/main/resources/config/security.yml # -> SecurityConfig permitAll(); anyRequest authenticated. An operator's own SECURITY_PUBLIC_PATHS # overrides it at run time and is outside this snapshot. # Update only after review with: ./gradlew verifyPublicPathSnapshot -PapprovePublicPathChange diff --git a/docs/superpowers/plans/2026-09-25-review-followup.md b/docs/superpowers/plans/2026-09-25-review-followup.md index 5ead249c..c508cbd5 100644 --- a/docs/superpowers/plans/2026-09-25-review-followup.md +++ b/docs/superpowers/plans/2026-09-25-review-followup.md @@ -236,7 +236,7 @@ W1·W2 잔여 21행(Wave 2.5)은 P14로 1라운드에서 함께 처리한다. W1 - [x] 라운드 1: P14 · P15 · P16 · P17 → 통합·검증·커밋 (2026-09-28, `9fdb0af4`·`c4a066df`·라운드 1 마무리 커밋) - [x] 라운드 2: P18 · P24 · P25 · P26 → 통합·검증·커밋 (2026-09-28~29, `4fb7943b`·`64a83918`·`25de288a`·`423a29c4`) - [x] 라운드 3: P19 · P21 · P22 · P23 · P27 · P28 → 통합·검증·커밋 (P23은 P18과 겹치지 않아 라운드 2 자리에서 먼저 시작) -- [ ] 라운드 4: P20 · P30 (P29는 라운드 3에서 끝남) → 통합 → Wave 종료 검증 → 현황표·「제거된 코드」 갱신 → 커밋 `review-followup Wave 3` +- [x] 라운드 4: P20 · P30 (P29는 라운드 3에서 끝남) → 통합 → Wave 종료 검증 → 현황표·「제거된 코드」 갱신 → 커밋 `review-followup Wave 3` ## Wave 4 — 테스트 규칙 (상세 Task: 2026-09-29) @@ -248,7 +248,7 @@ Wave 3 통합에서 세 번 같은 유형이 드러났다(ORCH-new-2·4·5): 저 |---|---|---| | P31 | 포트 계약 kit 1 — core·messaging·Redis·멱등성·lock·lease(결정 8): 포트 소유 leaf testFixtures에 추상 `XxxContract`, fake와 실제 어댑터가 함께 | `TEST-F-1` `TEST-F-5` `TEST-FAKE-패턴` `TEST-이행-3` `TEST-FAKE-RedisCommandGateway` `TEST-FAKE-MessagePublisher` `TEST-FAKE-IdempotencyStorePort` `X1-#3a` `X1-#3d` `X1-#6d` `X1-지도-테스트 fake / contract kit` `S6-lead-2` `S7-lead-4` `S2-lead-2` `X1-#6b` `S1-#3b` `P9-new-3` `G-2b` | | P32 | 포트 계약 kit 2 — object storage·fileserver·notification·sample(Mockito 포트 대역 제거) | `TEST-FAKE-ObjectControlStore` `TEST-FAKE-UploadApplicationService` `TEST-FAKE-DeliveryProjectionStorePort` `X1-#3b` `X1-#3c` `TEST-이행-2b` `P14-new-5` `D-4` `C-10 / S2-#11` `P4-new-1` | -| P33 | 약한 단언·테스트 형식·빠진 테스트, AGENTS.md 규칙 2(DisplayName 한국어), 계층별 모범 모듈 | `TEST-F-2a` `TEST-F-2d` `TEST-F-2e` `TEST-F-2f` `TEST-F-2g` `TEST-F-3` `TEST-F-6` `TEST-F-7` `TEST-F-8` `TEST-이행-4` `TEST-이행-5` `TEST-DisplayName` `J-4c` `J-9b` `H-3d` `I-2c` `I-3c` `E-3c` `E-4c` `E-6a` `F-1d` `F-5d` `K-5b` `L-4a` `L-7b` `S6-#15` `O-3d` | +| P33 | 약한 단언·테스트 형식·빠진 테스트, AGENTS.md 규칙 2(DisplayName 한국어), 계층별 모범 모듈 | `TEST-F-2a` `TEST-F-2d` `TEST-F-2e` `TEST-F-2f` `TEST-F-2g` `TEST-F-3` `TEST-F-6` `TEST-F-7` `TEST-F-8` `TEST-이행-4` `TEST-이행-5` `TEST-DisplayName` `J-4c` `J-9b` `H-3d` `I-2c` `I-3c` `E-3c` `E-4c` `E-6a` `F-1d` `F-5d` `K-5b` `L-4a` `L-7b` `S6-#15` `O-3d` `P20-new-5`(결정 36) | | P34 | 불안정 테스트·test inputs 누락 전수·compose lane 실제 실행 | `ORCH-new-1` `P25-new-1` `ORCH-new-2` `ORCH-new-4` `NEW-1b` `P11-new-3` `P13-new-2` | - [ ] P31 · P32 · P33 · P34 병렬(4개) → 통합·Wave 종료 검증 → 커밋 `review-followup Wave 4` @@ -272,3 +272,4 @@ W5 행 전부, `docs/study/*.ko.md`·`docs/*-superpowers-package/`를 현재 코 현황표: 859행(812 + 후속 발견 47) 중 완료 370 · 해당 없음 112 · 보류 2 · 남음 375(W1 4 · W2 17 · W3 196 · W4 57 · W5 101). 묶음별 결과 파일은 `docs/reviews/2026-09-25-review-followup-results/P*.md`, 에이전트 지시·스크립트는 `docs/superpowers/plans/2026-09-25-review-followup-tools/`. 작업 환경 이동(2026-09-28): 노트북 부하로 이후 작업은 desktop(`ssh desktop`, `/home/donghyeon/workspace/chat-gpt-container/codebase/clean-architecture-backend-template`)에서 이어 한다. 재개 프롬프트: `docs/reviews/2026-09-28-review-followup-resume-prompt.md`. +| 3 | 완료 (2026-09-29) | `check`(leaf 전체) · `ci verifyDependencyLocks --warning-mode=fail`(714 task) · `mainCheck` · architecture/public path/env keys/config contract · bootstrap·sample integration/system · `integrationCheck`(로컬 통과 — NEW-16 해결) · build-logic test · optional-platforms `ci` · `releaseCheck` · `qualificationBootJar` 통과. 라운드마다 통합 게이트 + 벤더 lane(PG·Kafka·Redis topology·MinIO·Mongo) | 라운드 커밋 `9fdb0af4`…`8bbf1bf0` + `review-followup Wave 3` | 소유자 결정 28–36 추가. 통합 때 드러난 문제: worktree에서 통과·main에서 실패하는 테스트(test inputs 미선언, ORCH-new-2·4·5), 합친 뒤 의미 충돌(P18 × P25, P20 × P30) | diff --git a/docs/web/advanced-capabilities.md b/docs/web/advanced-capabilities.md index 0491db98..96da4536 100644 --- a/docs/web/advanced-capabilities.md +++ b/docs/web/advanced-capabilities.md @@ -12,9 +12,9 @@ nothing happens until service code calls it. | Capability | How it is turned on | What it adds | Tests | | --- | --- | --- | --- | -| MVC virtual threads | `backend.web.advanced.mvc-virtual-threads.enabled=true` (+ admission limit and budgets) | A different scheduling model for **every** request | `MvcAdvancedConfigurationTest`, `VirtualThreadAdmissionTest` | -| NDJSON streaming | `backend.web.advanced.ndjson.enabled=true` | Long-lived connections | `MvcStreamingWiringTest`, `WebStreamCoreTest`, `WebStreamDrainTest`, `WebStreamingSoakIT` | -| JSON text sequences (RFC 7464) | `backend.web.advanced.json-sequence.enabled=true` | Long-lived connections | as NDJSON | +| MVC virtual threads | `app.web.advanced.mvc-virtual-threads.enabled=true` (+ admission limit and budgets) | A different scheduling model for **every** request | `MvcAdvancedConfigurationTest`, `VirtualThreadAdmissionTest` | +| NDJSON streaming | `app.web.advanced.ndjson.enabled=true` | Long-lived connections | `MvcStreamingWiringTest`, `WebStreamCoreTest`, `WebStreamDrainTest`, `WebStreamingSoakIT` | +| JSON text sequences (RFC 7464) | `app.web.advanced.json-sequence.enabled=true` | Long-lived connections | as NDJSON | | JSON Merge Patch (RFC 7396) | library — `JsonMergePatchApplier` | Partial documents | `JsonMergePatchApplierTest` | | JSON Patch (RFC 6902) | library — `JsonPatchApplier` | Arbitrary pointers | `JsonPatchApplierTest` | | CBOR / XML codecs | library — `WebCborMapperFactory`, `WebXmlMapperFactory`; the backend jar is the service's choice | A second decoder | `WebCodecMapperTest`, `WebCodecSecurityTest` | diff --git a/docs/web/repository-adaptation.md b/docs/web/repository-adaptation.md index e6876a06..d4be93dc 100644 --- a/docs/web/repository-adaptation.md +++ b/docs/web/repository-adaptation.md @@ -80,7 +80,7 @@ equivalents in `application-core/idempotency` — `IdempotencyStorePort`, `Idemp `IdempotencyScopeDigest` and `RequestFingerprint` — with two provider stores behind the port: PostgreSQL (`PostgreSqlIdempotencyStore` in `persistence-jpa`) and Redis (`RedisIdempotencyStoreAdapter` in `cache-redis`), selected by -`ca-skeleton.capabilities.idempotency.provider`. That is what the design's Tasks 39 and 40 ask for, +`app.capabilities.idempotency.provider`. That is what the design's Tasks 39 and 40 ask for, built in the direction the registry permits. Implementing the design's SPI literally would have required @@ -141,7 +141,7 @@ answers in the `Envelope` contract, and a caller's operation that is not theirs (`OPERATION_NOT_FOUND`) as one that does not exist. The controller and the three use cases are assembled by `app-bootstrap` `autoconfigure/operation/DurableOperationConfig`, which turns on only when the operation store and the outbox append port exist (the JPA module with -`ca-skeleton.outbox.enabled=true`). Submit and cancel need `operation:submit` / `operation:cancel` +`app.outbox.enabled=true`). Submit and cancel need `operation:submit` / `operation:cancel` (`security.yml` grants both to the `operation-submit` role). The state machine is enforced three times on purpose: in `DurableOperation`'s constructor, in the diff --git a/docs/web/runbook.md b/docs/web/runbook.md index d269dc52..ee77c76f 100644 --- a/docs/web/runbook.md +++ b/docs/web/runbook.md @@ -65,7 +65,7 @@ is one series per resource. ## Cross-origin requests fail only in the browser The API answers correctly and the browser refuses the response. CORS is `CorsSettings` -(`ca-skeleton.cors.*`) applied by `SecurityConfig`. Startup refuses two settings: +(`app.cors.*`) applied by `SecurityConfig`. Startup refuses two settings: - `APP_SECURITY_CORS_ENABLED=true` with no origin. - `*` in `APP_SECURITY_CORS_ORIGINS` with `APP_SECURITY_CORS_ALLOW_CREDENTIALS=true` — no browser diff --git a/docs/web/streaming-contract.md b/docs/web/streaming-contract.md index 330dacae..5bd6ab7a 100644 --- a/docs/web/streaming-contract.md +++ b/docs/web/streaming-contract.md @@ -5,7 +5,7 @@ framing exists, but since the WebFlux twin was removed (2026-09-25) nothing on t writes it. The writers ship in `adapter:inbound:web-advanced` (opt-in, switched by -`backend.web.advanced.ndjson.enabled` / `backend.web.advanced.json-sequence.enabled`); no default +`app.web.advanced.ndjson.enabled` / `app.web.advanced.json-sequence.enabled`); no default composition carries them. ## Three outcomes, not two diff --git a/docs/web/virtual-thread-profile.md b/docs/web/virtual-thread-profile.md index 4c37861e..ed3b9b5c 100644 --- a/docs/web/virtual-thread-profile.md +++ b/docs/web/virtual-thread-profile.md @@ -20,7 +20,7 @@ The profile ships in `adapter:inbound:web-advanced`, which no default compositio that leaf to the service, then two settings — the profile refuses to be constructed with only one: ```yaml -backend: +app: web: advanced: mvc-virtual-threads: diff --git a/infra/redis-sdk/acl/all-accounts.acl b/infra/redis-sdk/acl/all-accounts.acl index 51214b6d..c44a893e 100644 --- a/infra/redis-sdk/acl/all-accounts.acl +++ b/infra/redis-sdk/acl/all-accounts.acl @@ -1,6 +1,6 @@ user default off -user ca-skeleton-application on >fixture-application sanitize-payload ~prod:* resetchannels &prod:* -@all +@connection +@pubsub +@transaction +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream -keys -flushdb -flushall -shutdown -debug -sort -sort_ro -smembers -randomkey -migrate -swapdb -select +cluster|slots +cluster|shards +cluster|nodes +cluster|info +cluster|myid -user ca-skeleton-application-advanced on >fixture-advanced sanitize-payload ~prod:* resetchannels &prod:* -@all +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream +@pubsub +@transaction +time +evalsha +evalsha_ro +script|load +script|exists +fcall +fcall_ro -keys -flushdb -flushall -shutdown -debug -eval -eval_ro -smembers -sort -sort_ro -randomkey -migrate -swapdb -select +cluster|slots +cluster|shards +cluster|nodes +cluster|info +cluster|myid +user ca-skeleton-application on >fixture-application sanitize-payload ~prod:* resetchannels -@all +@connection +@transaction +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream -keys -flushdb -flushall -shutdown -debug -sort -sort_ro -smembers -randomkey -migrate -swapdb -select +cluster|slots +cluster|shards +cluster|nodes +cluster|info +cluster|myid +user ca-skeleton-application-advanced on >fixture-advanced sanitize-payload ~prod:* resetchannels -@all +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream +@transaction +time +evalsha +evalsha_ro +script|load +script|exists +fcall +fcall_ro -keys -flushdb -flushall -shutdown -debug -eval -eval_ro -smembers -sort -sort_ro -randomkey -migrate -swapdb -select +cluster|slots +cluster|shards +cluster|nodes +cluster|info +cluster|myid user ca-skeleton-raw-gateway on >fixture-raw sanitize-payload ~prod:* resetchannels -@all +smembers +sort +sort_ro user ca-skeleton-admin-readonly on >fixture-admin ~* resetchannels -@all +info +dbsize +time +lastsave +memory|usage +memory|stats +slowlog|get +slowlog|len +latency|latest +latency|history +client|list +client|info +command|info +command|docs +command|count +command|getkeysandflags +config|get +acl|dryrun +acl|whoami +cluster|info +cluster|slots +cluster|shards +cluster|nodes +object|encoding +object|freq +object|idletime +pubsub|channels +pubsub|numsub +pubsub|shardchannels +xinfo|stream +xinfo|groups +xinfo|consumers +function|list +function|stats +cluster|keyslot +cluster|myid user ca-skeleton-replication on >fixture-replication ~* resetchannels -@all +psync +replconf +ping diff --git a/infra/redis-sdk/acl/application-advanced.acl b/infra/redis-sdk/acl/application-advanced.acl index 61db02ec..fa2094af 100644 --- a/infra/redis-sdk/acl/application-advanced.acl +++ b/infra/redis-sdk/acl/application-advanced.acl @@ -1 +1 @@ -user ca-skeleton-application-advanced on >fixture-advanced sanitize-payload ~prod:* resetchannels &prod:* -@all +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream +@pubsub +@transaction +time +evalsha +evalsha_ro +script|load +script|exists +fcall +fcall_ro -keys -flushdb -flushall -shutdown -debug -eval -eval_ro -smembers -sort -sort_ro -randomkey -migrate -swapdb -select +user ca-skeleton-application-advanced on >fixture-advanced sanitize-payload ~prod:* resetchannels -@all +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream +@transaction +time +evalsha +evalsha_ro +script|load +script|exists +fcall +fcall_ro -keys -flushdb -flushall -shutdown -debug -eval -eval_ro -smembers -sort -sort_ro -randomkey -migrate -swapdb -select diff --git a/infra/redis-sdk/acl/application.acl b/infra/redis-sdk/acl/application.acl index 47fd4065..a9f48c0a 100644 --- a/infra/redis-sdk/acl/application.acl +++ b/infra/redis-sdk/acl/application.acl @@ -1 +1 @@ -user ca-skeleton-application on >fixture-application sanitize-payload ~prod:* resetchannels &prod:* -@all +@connection +@pubsub +@transaction +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream -keys -flushdb -flushall -shutdown -debug -sort -sort_ro -smembers -randomkey -migrate -swapdb -select +user ca-skeleton-application on >fixture-application sanitize-payload ~prod:* resetchannels -@all +@connection +@transaction +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream -keys -flushdb -flushall -shutdown -debug -sort -sort_ro -smembers -randomkey -migrate -swapdb -select diff --git a/scripts/verify-httpclient-docs.py b/scripts/verify-httpclient-docs.py index f8d00444..2170e467 100755 --- a/scripts/verify-httpclient-docs.py +++ b/scripts/verify-httpclient-docs.py @@ -72,8 +72,8 @@ def configuration_properties() -> list[str]: """Every leaf property under `app.httpclient`, nested and dynamic blocks included. Read from the environment-field manifest rather than from the record source. The manifest is - derived from `HttpClientPlatformSettings` by `HttpClientEnvironmentKeys` and held to it in both - directions by `HttpClientPlatformEnvManifestTest`, so it cannot drift from the code; parsing the + derived from `HttpClientPlatformSettings` and held to it in both directions by + `HttpClientPlatformEnvManifestTest`, so it cannot drift from the code; parsing the record here a second time, with a regex, could only agree with it by luck. The previous version of this function did exactly that and saw eighteen top-level names, which is why a nested pool, timeout or TLS setting could be added and documented nowhere. diff --git a/src/README.md b/src/README.md index 2f7dbfc9..c0e0a6d2 100644 --- a/src/README.md +++ b/src/README.md @@ -270,7 +270,7 @@ Kafka 없이 기동합니다. 나머지 기능은 `app-bootstrap/build.gradle` | 외부 HTTP 호출 | `runtimeOnly project(':adapter:outbound:httpclient')` | client 하나 이상: `APP_HTTPCLIENT_CLIENTS_0_*` (`docs/httpclient/env-fields.yaml`) | `APP_HTTPCLIENT_ENABLED` | | 객체 저장소 (S3/로컬) | `runtimeOnly project(':adapter:outbound:objectstorage')` | 전용 env 없음. `app.object-storage.*`의 provider·destination을 `application-*.yml`에 적음 | `app.object-storage.enabled` | | WebSocket (STOMP push) | `runtimeOnly project(':adapter:inbound:websocket')` | 없음(기본값으로 동작). origin은 `APP_WEBSOCKET_ALLOWED_ORIGINS` | `APP_WEBSOCKET_ENABLED` | -| gRPC 서버 | `runtimeOnly project(':adapter:inbound:grpc')` | `CA_SKELETON_GRPC_SERVER_ALLOW_INSECURE_LOCAL=true` (지금 받는 listener가 loopback plaintext뿐) | `ca-skeleton.grpc.server.enabled` | +| gRPC 서버 | `runtimeOnly project(':adapter:inbound:grpc')` | `APP_GRPC_SERVER_ALLOW_INSECURE_LOCAL=true` (지금 받는 listener가 loopback plaintext뿐) | `app.grpc.server.enabled` | | 파일 서버 (JPA를 함께 가져옴) | `runtimeOnly project(':composition:fileserver-platform')` | `APP_FILESERVER_PLATFORM_STORAGE_ROOT`, `APP_FILESERVER_PLATFORM_OBSERVABILITY_FINGERPRINT_KEY`, 그리고 `FileAccessPolicyPort` bean 또는 `APP_FILESERVER_PLATFORM_SECURITY_ACCESS_POLICY=role-based` | `APP_FILESERVER_PLATFORM_ENABLED` | | 알림 (SMTP/SES, JPA 줄도 필요) | `runtimeOnly project(':composition:notification-platform')` | 키 8종과 각 `_ID`(`APP_NOTIFICATION_PLATFORM_*_KEY`, `*_KEY_ID`), 쓰는 provider 설정(`APP_NOTIFICATION_PLATFORM_SMTP_*` 또는 `_SES_*`) | `APP_NOTIFICATION_PLATFORM_ENABLED` | @@ -338,7 +338,7 @@ Kafka·Redis는 위 "기능 추가 = 한 줄 + env" 표의 한 줄로 고릅니 현재 canonical activation은 다음 두 설정 트리만 사용합니다. ```yaml -ca-skeleton: +app: capabilities: http-client: expected-state: DISABLED @@ -539,7 +539,7 @@ docker compose -f docker-compose.yml -f docker-compose.local.yml up -d --wait db 컨테이너로 띄우는 `scripts/bootstrap-local.sh` 경로는 이 호스트 포트를 쓰지 않습니다. compose 가 app 컨테이너의 `APP_DATASOURCE_URL` 을 내부 네트워크 주소 `jdbc:postgresql://db:5432/...` 로 덮어씁니다. -`ca-skeleton.persistence.vendor`(`postgresql` | `h2`)가 어느 vendor 구성을 조립할지 고르는 단일 +`app.persistence.vendor`(`postgresql` | `h2`)가 어느 vendor 구성을 조립할지 고르는 단일 스위치입니다. 값이 둘 중 하나가 아니면 기동이 실패하고, prod 에서 `h2` 이거나 datasource URL 이 `jdbc:h2:` 이면 `PersistenceVendorProdSafetyValidator` 가 기동을 거부합니다(env 로 덮어써도 동일). diff --git a/src/adapter/inbound/graphql/CLAUDE.md b/src/adapter/inbound/graphql/CLAUDE.md index 357b563f..fd33c85b 100644 --- a/src/adapter/inbound/graphql/CLAUDE.md +++ b/src/adapter/inbound/graphql/CLAUDE.md @@ -57,7 +57,7 @@ required-class 검사가 이 테스트가 조용히 사라지는 것을 막는 - feature-agnostic: `classpath:graphql/**` 스키마와 모든 `@Controller` `@QueryMapping`/ `@MutationMapping` 을 generic 하게 합성한다. **WorkLog 등 구체 기능을 이름으로 알지 않는다.** - 있으면 켜진다: 서비스가 `app-bootstrap/build.gradle`에 `runtimeOnly project(':adapter:inbound:graphql')` - 한 줄로 고른다(기본 조립에는 없다). `APP_GRAPHQL_ENABLED=false`(`backend.graphql.enabled`)만 끄며, + 한 줄로 고른다(기본 조립에는 없다). `APP_GRAPHQL_ENABLED=false`(`app.graphql.enabled`)만 끄며, 그때 `GraphQlActivationEnvironmentPostProcessor`가 Spring GraphQL 자동 설정도 exclude 한다. 실제 활성화 시 composition root 는 인증/인가·CORS 정책과 GraphiQL/introspection 운영 설정을 함께 명시해야 한다. diff --git a/src/adapter/inbound/graphql/README.md b/src/adapter/inbound/graphql/README.md index 313b0f50..b2e7b637 100644 --- a/src/adapter/inbound/graphql/README.md +++ b/src/adapter/inbound/graphql/README.md @@ -102,18 +102,18 @@ gRPC 와 달리 spring-graphql / graphql-java 는 Spring Boot BOM 이 관리한 버전 명시도, 모듈 스코프 platform import 도 필요 없다 — `build.gradle` 은 BOM-managed 좌표만 선언하고, per-module `gradle.lockfile` 이 strict locking 으로 정확한 버전을 고정한다. -## 설정 — 프레임워크 `spring.graphql.*` + 플랫폼 `backend.graphql.*` +## 설정 — 프레임워크 `spring.graphql.*` + 플랫폼 `app.graphql.*` 전송 계층 설정(path, graphiql, introspection, schema location)은 프레임워크 `spring.graphql.*` 가 소유한다. composition-root `application.yml` 에서 설정하며 모듈별 `yml` 은 없다. 플랫폼 정책은 `spring.graphql.*` 로 표현할 수 없다 — cost/page 한계, preparsed 캐시 경계, 관측 label 로 허용할 operation 이름은 전부 이 leaf 의 결정이다. 그래서 -`GraphQlPlatformProperties` 가 **`backend.graphql`** prefix 로 `@ConfigurationProperties` 를 +`GraphQlPlatformProperties` 가 **`app.graphql`** prefix 로 `@ConfigurationProperties` 를 바인딩한다(`spring.graphql.platform.*` 이 아니다 — 그 prefix 는 존재한 적이 없다). ```yaml -backend: +app: graphql: deployment-mode: PRODUCTION_INTERNAL validation-policy-version: v1 # preparsed 캐시 키의 일부 diff --git a/src/adapter/inbound/graphql/build.gradle b/src/adapter/inbound/graphql/build.gradle index d71b7210..080ead2c 100644 --- a/src/adapter/inbound/graphql/build.gradle +++ b/src/adapter/inbound/graphql/build.gradle @@ -67,8 +67,8 @@ dependencies { // GraphQlPlatformProperties is a @ConfigurationProperties binding, so this leaf owes the // repository-wide processor parity gate (`verifyConfigurationPropertiesProcessor`) a metadata - // declaration — an adopter configuring backend.graphql.* gets IDE completion and validation - // from the generated metadata rather than from prose. (The prefix is `backend.graphql`; this + // declaration — an adopter configuring app.graphql.* gets IDE completion and validation + // from the generated metadata rather than from prose. (The prefix is `app.graphql`; this // comment used to say `spring.graphql.platform.*`, which never existed.) // A raw request body can only be capped before something decodes it, and on a servlet stack the diff --git a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlActivationEnvironmentPostProcessor.java b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlActivationEnvironmentPostProcessor.java index a33876c8..eed66f8f 100644 --- a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlActivationEnvironmentPostProcessor.java +++ b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlActivationEnvironmentPostProcessor.java @@ -16,11 +16,13 @@ import org.springframework.boot.context.properties.bind.Binder; import org.springframework.boot.env.YamlPropertySourceLoader; import org.springframework.core.Ordered; import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.EnumerablePropertySource; import org.springframework.core.env.MapPropertySource; +import org.springframework.core.env.PropertySource; import org.springframework.core.io.ClassPathResource; /** - * Everything about {@code backend.graphql} that has to be settled before a bean exists. + * Everything about {@code app.graphql} that has to be settled before a bean exists. * *

An environment post-processor rather than a bean: these are the failures that have to arrive * first, naming what an operator set, instead of surfacing as a bean somewhere downstream that @@ -28,8 +30,8 @@ import org.springframework.core.io.ClassPathResource; * *

    *
  1. Contribute the module's settings. {@code config/graphql.yml} maps the {@code - * APP_GRAPHQL_*} variables onto {@code backend.graphql.*}, which an environment variable - * cannot reach directly. Added last, so a deployment's own value always wins, and loaded only + * APP_GRAPHQL_*} variables onto {@code app.graphql.*}, which an environment variable cannot + * reach directly. Added last, so a deployment's own value always wins, and loaded only * because the module is on the classpath — removing the module removes its settings. *
  2. Refuse a retired safety key. See {@link GraphQlRetiredSafetyAxis}. *
  3. Give the framework's console flags the platform's defaults. Spring Boot answers @@ -37,7 +39,7 @@ import org.springframework.core.io.ClassPathResource; * the lowest precedence, so an operator who sets either key still wins and still gets * validated. *
  4. Make an explicit off complete. The module is on when present. {@code - * backend.graphql.enabled=false} turns off {@link GraphQlRootAutoConfiguration}, but Spring + * app.graphql.enabled=false} turns off {@link GraphQlRootAutoConfiguration}, but Spring * GraphQL's own auto-configurations would still publish {@code /graphql} from the schema on * the classpath. So an explicit off appends them — read from Boot's own registration file, * not listed here — to {@code spring.autoconfigure.exclude}, after whatever the deployment @@ -52,7 +54,9 @@ public class GraphQlActivationEnvironmentPostProcessor static final String RESOURCE = "config/graphql.yml"; - private static final String SWITCH = "backend.graphql.enabled"; + private static final String SWITCH = "app.graphql.enabled"; + + private static final String DEPLOYMENT_MODE = "app.graphql.deployment-mode"; private static final String EXCLUDE = "spring.autoconfigure.exclude"; @@ -63,8 +67,8 @@ public class GraphQlActivationEnvironmentPostProcessor private static final Map FRAMEWORK_DEFAULTS = Map.of( "spring.graphql.schema.introspection.enabled", - "backend.graphql.console.introspection-enabled", - "spring.graphql.graphiql.enabled", "backend.graphql.console.graphiql-enabled"); + "app.graphql.console.introspection-enabled", + "spring.graphql.graphiql.enabled", "app.graphql.console.graphiql-enabled"); private static final String SOURCE_NAME = "graphQlPlatformConsoleDefaults"; @@ -76,6 +80,7 @@ public class GraphQlActivationEnvironmentPostProcessor new YamlPropertySourceLoader() .load("graphql-defaults (" + RESOURCE + ")", new ClassPathResource(RESOURCE, classLoader)) .forEach(environment.getPropertySources()::addLast); + withoutAnUnsetDeploymentMode(environment); } catch (IOException failure) { throw new UncheckedIOException("failed to read " + RESOURCE, failure); } @@ -100,6 +105,37 @@ public class GraphQlActivationEnvironmentPostProcessor } } + /** + * Drops the shipped {@code deployment-mode} entry when it resolves to nothing. + * + *

    The mode has no default on purpose, and {@link GraphQlDeploymentMode} refuses a missing one + * by name. The shipped file maps it as {@code ${APP_GRAPHQL_DEPLOYMENT_MODE:}}, though, and under + * strict binding ({@code ignoreUnknownFields = false}) a present-but-empty key is reported as + * "left unbound" before the named refusal can run. An unset mode is therefore made absent, not + * empty; a mode set anywhere — environment, {@code .env}, system property, file — still binds. + */ + private static void withoutAnUnsetDeploymentMode(ConfigurableEnvironment environment) { + String mode = environment.getProperty(DEPLOYMENT_MODE); + if (mode != null && !mode.isBlank()) { + return; + } + for (PropertySource source : environment.getPropertySources().stream().toList()) { + if (source.getName().startsWith("graphql-defaults") + && source instanceof EnumerablePropertySource enumerable + && enumerable.containsProperty(DEPLOYMENT_MODE)) { + Map kept = new LinkedHashMap<>(); + for (String name : enumerable.getPropertyNames()) { + if (!DEPLOYMENT_MODE.equals(name)) { + kept.put(name, enumerable.getProperty(name)); + } + } + environment + .getPropertySources() + .replace(source.getName(), new MapPropertySource(source.getName(), kept)); + } + } + } + private static void excludeTheFrameworkAutoConfigurations( ConfigurableEnvironment environment, ClassLoader classLoader) { List excluded = diff --git a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlDeploymentMode.java b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlDeploymentMode.java index 30c9ea03..e89b8d0f 100644 --- a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlDeploymentMode.java +++ b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlDeploymentMode.java @@ -43,7 +43,7 @@ public enum GraphQlDeploymentMode { /** What an operator has to set, and where, when the mode is missing. */ public static final String REQUIRED_MESSAGE = - "backend.graphql.deployment-mode is required while backend.graphql.enabled=true; set " + "app.graphql.deployment-mode is required while app.graphql.enabled=true; set " + "APP_GRAPHQL_DEPLOYMENT_MODE to one of LOCAL, DEV, PRODUCTION_INTERNAL, " + "PRODUCTION_PUBLIC"; diff --git a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlExecutionChainConfiguration.java b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlExecutionChainConfiguration.java index 47f83b4a..e1df4958 100644 --- a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlExecutionChainConfiguration.java +++ b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlExecutionChainConfiguration.java @@ -36,8 +36,8 @@ class GraphQlExecutionChainConfiguration { * application knowledge: a deny-by-default skeleton policy would answer nothing and adopters * would replace it with an allow-all one, while an allow-by-default policy shipped into * production would be an unauthorized endpoint. So a development mode gets the permissive default - * that lets the schema be explored, and a production {@code backend.graphql.deployment-mode} - * refuses to start without an explicit policy. + * that lets the schema be explored, and a production {@code app.graphql.deployment-mode} refuses + * to start without an explicit policy. */ @Bean @ConditionalOnMissingBean @@ -49,7 +49,7 @@ class GraphQlExecutionChainConfiguration { if (properties.production()) { throw new GraphQlPlatformConfigurationException( List.of( - "backend.graphql.deployment-mode=" + "app.graphql.deployment-mode=" + properties.deploymentMode() + " requires an explicit GraphQlAuthorizationPolicy bean; the platform has no " + "application coordinates to authorize on its own")); diff --git a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformSettings.java b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformSettings.java index 4427e44d..d9f70b5e 100644 --- a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformSettings.java +++ b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformSettings.java @@ -23,14 +23,20 @@ import org.springframework.boot.context.properties.bind.DefaultValue; * @param deploymentMode the single safety posture; required, see {@link GraphQlDeploymentMode} * @param console query console and introspection exposure * @param limits page and cost ceilings + * @param validationPolicyVersion part of the preparsed cache key + * @param observedOperationNames operation names allowed as an observation label + * @param enabled the capability switch. Conditions read the property; it is a component so that the + * tree binds with unknown keys refused ({@code ignoreUnknownFields = false}) — a misspelt + * {@code app.graphql.*} key fails startup instead of leaving a default limit in force */ -@ConfigurationProperties("backend.graphql") +@ConfigurationProperties(prefix = "app.graphql", ignoreUnknownFields = false) public record GraphQlPlatformSettings( GraphQlDeploymentMode deploymentMode, @DefaultValue Console console, @DefaultValue Limits limits, @DefaultValue("v1") String validationPolicyVersion, - @DefaultValue Set observedOperationNames) { + @DefaultValue Set observedOperationNames, + @DefaultValue("true") boolean enabled) { public GraphQlPlatformSettings { // Belt and braces for programmatic construction: the binder honours @DefaultValue, but this @@ -109,34 +115,45 @@ public record GraphQlPlatformSettings( Console.disabled(), Limits.defaults(), "v1", - Set.of()); + Set.of(), + true); } /** Returns a copy running under a different deployment mode. */ public GraphQlPlatformSettings withDeploymentMode(GraphQlDeploymentMode mode) { return new GraphQlPlatformSettings( - mode, console, limits, validationPolicyVersion, observedOperationNames); + mode, console, limits, validationPolicyVersion, observedOperationNames, enabled); } /** Returns a copy with GraphiQL enabled or disabled. */ - public GraphQlPlatformSettings withGraphiqlEnabled(boolean enabled) { - return withConsole(new Console(enabled, console.introspectionEnabled())); + public GraphQlPlatformSettings withGraphiqlEnabled(boolean graphiql) { + return withConsole(new Console(graphiql, console.introspectionEnabled())); } /** Returns a copy with introspection enabled or disabled. */ - public GraphQlPlatformSettings withIntrospectionEnabled(boolean enabled) { - return withConsole(new Console(console.graphiqlEnabled(), enabled)); + public GraphQlPlatformSettings withIntrospectionEnabled(boolean introspection) { + return withConsole(new Console(console.graphiqlEnabled(), introspection)); } /** Returns a copy with a different console policy. */ public GraphQlPlatformSettings withConsole(Console replacement) { return new GraphQlPlatformSettings( - deploymentMode, replacement, limits, validationPolicyVersion, observedOperationNames); + deploymentMode, + replacement, + limits, + validationPolicyVersion, + observedOperationNames, + enabled); } /** Returns a copy with different limits. */ public GraphQlPlatformSettings withLimits(Limits replacement) { return new GraphQlPlatformSettings( - deploymentMode, console, replacement, validationPolicyVersion, observedOperationNames); + deploymentMode, + console, + replacement, + validationPolicyVersion, + observedOperationNames, + enabled); } } diff --git a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformStartupValidator.java b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformStartupValidator.java index 54a90877..984adb71 100644 --- a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformStartupValidator.java +++ b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformStartupValidator.java @@ -74,7 +74,7 @@ public final class GraphQlPlatformStartupValidator { } throw new GraphQlPlatformConfigurationException( List.of( - "backend.graphql.deployment-mode=" + "app.graphql.deployment-mode=" + mode + " is not permitted in the " + runtime.profileName() @@ -121,7 +121,7 @@ public final class GraphQlPlatformStartupValidator { problems.add( "client policy maxPageSize (" + runtime.clientPolicy().maxPageSize() - + ") exceeds backend.graphql.limits.maximum-page-size (" + + ") exceeds app.graphql.limits.maximum-page-size (" + runtime.properties().limits().maximumPageSize() + ")"); } @@ -130,14 +130,14 @@ public final class GraphQlPlatformStartupValidator { problems.add( "client policy maxComplexity (" + runtime.clientPolicy().maxComplexity() - + ") exceeds backend.graphql.limits.maximum-complexity (" + + ") exceeds app.graphql.limits.maximum-complexity (" + runtime.properties().limits().maximumComplexity() + ")"); } if (runtime.clientPolicy().introspectionAllowed() && !runtime.properties().console().introspectionEnabled()) { problems.add( - "client policy allows introspection while backend.graphql.console.introspection-enabled " + "client policy allows introspection while app.graphql.console.introspection-enabled " + "is false; one of the two is not what the operator configured"); } @@ -148,7 +148,7 @@ public final class GraphQlPlatformStartupValidator { && runtime.frameworkIntrospectionEnabled() != runtime.properties().console().introspectionEnabled()) { problems.add( - "backend.graphql.console.introspection-enabled (" + "app.graphql.console.introspection-enabled (" + runtime.properties().console().introspectionEnabled() + ") contradicts spring.graphql.schema.introspection.enabled (" + runtime.frameworkIntrospectionEnabled() @@ -157,7 +157,7 @@ public final class GraphQlPlatformStartupValidator { if (runtime.frameworkGraphiqlEnabled() != null && runtime.frameworkGraphiqlEnabled() != runtime.properties().console().graphiqlEnabled()) { problems.add( - "backend.graphql.console.graphiql-enabled (" + "app.graphql.console.graphiql-enabled (" + runtime.properties().console().graphiqlEnabled() + ") contradicts spring.graphql.graphiql.enabled (" + runtime.frameworkGraphiqlEnabled() diff --git a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRequestContextConfiguration.java b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRequestContextConfiguration.java index 18be3a21..784ef3b2 100644 --- a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRequestContextConfiguration.java +++ b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRequestContextConfiguration.java @@ -41,7 +41,7 @@ class GraphQlRequestContextConfiguration { /** * The limits applied to a request when the adopter has not registered a client policy. * - *

    Page size, complexity and introspection follow {@code backend.graphql.*}; the rest are the + *

    Page size, complexity and introspection follow {@code app.graphql.*}; the rest are the * calibration starting points from the design. An adopter replaces this bean rather than editing * a table of constants. */ @@ -76,7 +76,7 @@ class GraphQlRequestContextConfiguration { if (properties.production()) { throw new GraphQlPlatformConfigurationException( List.of( - "backend.graphql.deployment-mode=" + "app.graphql.deployment-mode=" + properties.deploymentMode() + " requires an explicit GraphQlPrincipalResolver bean; production refuses " + "anonymous callers, so the anonymous default would reject every request")); diff --git a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRetiredSafetyAxis.java b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRetiredSafetyAxis.java index ee420079..61f2f91e 100644 --- a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRetiredSafetyAxis.java +++ b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRetiredSafetyAxis.java @@ -8,11 +8,11 @@ import org.springframework.core.env.Environment; /** * The two retired safety keys, refused rather than ignored (GQL-INT-002). * - *

    {@code backend.graphql.production} and {@code backend.graphql.environment} are no longer - * record components, and Spring's binder ignores unknown keys by default. Left alone, an operator - * who sets the key they have always set gets a clean startup and a silently different safety - * posture — which is a worse outcome than the split-brain being fixed, because the old - * configuration at least did something. + *

    {@code app.graphql.production} and {@code app.graphql.environment} are no longer record + * components, and Spring's binder ignores unknown keys by default. Left alone, an operator who sets + * the key they have always set gets a clean startup and a silently different safety posture — which + * is a worse outcome than the split-brain being fixed, because the old configuration at least did + * something. * *

    Checked whether or not the replacement is also set. A deployment carrying both is exactly the * state that produced the defect: two keys that can disagree about one question, with the winner @@ -26,10 +26,10 @@ public final class GraphQlRetiredSafetyAxis { private static final Map RETIRED_KEYS = Map.of( - "backend.graphql.production", + "app.graphql.production", "it drove anonymous principal handling and allow-by-default authorization while the " + "environment enum drove introspection, so the two could disagree", - "backend.graphql.environment", + "app.graphql.environment", "it drove introspection and GraphiQL while the production boolean drove authorization, " + "so the two could disagree"); @@ -42,7 +42,7 @@ public final class GraphQlRetiredSafetyAxis { * @return the problems; empty when the capability switch is off or no retired key is present */ public static List problems(Environment environment) { - if (!"true".equalsIgnoreCase(environment.getProperty("backend.graphql.enabled", "true"))) { + if (!"true".equalsIgnoreCase(environment.getProperty("app.graphql.enabled", "true"))) { return List.of(); } List problems = new ArrayList<>(); @@ -53,7 +53,7 @@ public final class GraphQlRetiredSafetyAxis { + " is retired (" + RETIRED_KEYS.get(key) + "). Remove it and set APP_GRAPHQL_DEPLOYMENT_MODE " - + "(backend.graphql.deployment-mode) to one of LOCAL, DEV, PRODUCTION_INTERNAL, " + + "(app.graphql.deployment-mode) to one of LOCAL, DEV, PRODUCTION_INTERNAL, " + "PRODUCTION_PUBLIC."); } } diff --git a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRootAutoConfiguration.java b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRootAutoConfiguration.java index da79ef66..b6c5b319 100644 --- a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRootAutoConfiguration.java +++ b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlRootAutoConfiguration.java @@ -9,17 +9,17 @@ import org.springframework.context.annotation.Import; * The one place that decides whether this application exposes a GraphQL endpoint. * *

    On when present: an application that selected this module wants GraphQL, so a missing {@code - * backend.graphql.enabled} means on. Absent from the build is the ordinary off state. + * app.graphql.enabled} means on. Absent from the build is the ordinary off state. * *

    An inbound adapter's off contract is not only about beans. Spring GraphQL publishes {@code * /graphql} from its own auto-configuration, with no project bean involved, so an explicit {@code - * backend.graphql.enabled=false} also excludes those auto-configurations — see {@link + * app.graphql.enabled=false} also excludes those auto-configurations — see {@link * GraphQlActivationEnvironmentPostProcessor}. A bean-inventory assertion cannot see a route the * framework published. */ @AutoConfiguration @ConditionalOnProperty( - prefix = "backend.graphql", + prefix = "app.graphql", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/inbound/graphql/src/main/resources/config/graphql.yml b/src/adapter/inbound/graphql/src/main/resources/config/graphql.yml index f40b5a94..527797e4 100644 --- a/src/adapter/inbound/graphql/src/main/resources/config/graphql.yml +++ b/src/adapter/inbound/graphql/src/main/resources/config/graphql.yml @@ -2,8 +2,8 @@ # # 이 모듈이 직접 읽는다(GraphQlActivationEnvironmentPostProcessor). 우선순위는 가장 낮아서 # application*.yml, 환경 변수, 시스템 속성이 항상 이긴다. 환경 변수는 APP_GRAPHQL_* 이고 설정 트리는 -# backend.graphql.* 라서, 이 파일이 둘을 잇는다. 이 모듈을 빌드에서 빼면 이 파일도 함께 빠진다. -backend: +# app.graphql.* 라서, 이 파일이 둘을 잇는다. 이 모듈을 빌드에서 빼면 이 파일도 함께 빠진다. +app: graphql: # true | false — 모듈이 있으면 켜진다. false 로 끄면 Spring GraphQL 자신의 자동 설정도 빠져서 # /graphql 이 열리지 않는다. @@ -29,4 +29,4 @@ backend: info: capabilities: graphql: - enabled: ${backend.graphql.enabled:true} + enabled: ${app.graphql.enabled:true} diff --git a/src/adapter/inbound/graphql/src/systemTest/java/dev/caskeleton/adapter/inbound/graphql/GraphqlHttpBoundaryQualificationTest.java b/src/adapter/inbound/graphql/src/systemTest/java/dev/caskeleton/adapter/inbound/graphql/GraphqlHttpBoundaryQualificationTest.java index 490ab33e..56a20f66 100644 --- a/src/adapter/inbound/graphql/src/systemTest/java/dev/caskeleton/adapter/inbound/graphql/GraphqlHttpBoundaryQualificationTest.java +++ b/src/adapter/inbound/graphql/src/systemTest/java/dev/caskeleton/adapter/inbound/graphql/GraphqlHttpBoundaryQualificationTest.java @@ -51,10 +51,10 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource; // The transport is off unless a deployment asks for it, so a boundary qualification has to // ask too. Before the master switch existed this test passed by accident: the endpoint was // published from the classpath. - "backend.graphql.enabled=true", + "app.graphql.enabled=true", // Required alongside the switch: the safety posture has no default, because the defaults it // used to have were a production enum and a non-production boolean that disagreed. - "backend.graphql.deployment-mode=LOCAL", + "app.graphql.deployment-mode=LOCAL", "spring.graphql.graphiql.enabled=false", "spring.graphql.schema.introspection.enabled=false", "spring.graphql.schema.locations=classpath:graphql-qualification-no-discovery/", diff --git a/src/adapter/inbound/graphql/src/systemTest/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlPlatformExecutionPathTest.java b/src/adapter/inbound/graphql/src/systemTest/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlPlatformExecutionPathTest.java index 58af364d..6eb92d88 100644 --- a/src/adapter/inbound/graphql/src/systemTest/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlPlatformExecutionPathTest.java +++ b/src/adapter/inbound/graphql/src/systemTest/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlPlatformExecutionPathTest.java @@ -62,7 +62,7 @@ import org.springframework.stereotype.Controller; webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = { // The transport is off unless a deployment asks for it, so an execution-path test has to ask. - "backend.graphql.enabled=true", + "app.graphql.enabled=true", "spring.graphql.graphiql.enabled=false", // The schema permits introspection at the deployment level, and the two flags agree so the // contradiction check stays quiet. What refuses the query is the anonymous profile's client @@ -73,12 +73,12 @@ import org.springframework.stereotype.Controller; "spring.graphql.schema.additional-files=" + "classpath:graphql/skeleton.graphqls," + "classpath:graphql-platform/platform.graphqls", - "backend.graphql.deployment-mode=LOCAL", - "backend.graphql.console.introspection-enabled=true", - "backend.graphql.limits.maximum-page-size=100", + "app.graphql.deployment-mode=LOCAL", + "app.graphql.console.introspection-enabled=true", + "app.graphql.limits.maximum-page-size=100", // Small enough that one nested selection exceeds it, large enough that the allowed queries do // not. The unregistered-coordinate default weight is what both sides are measured against. - "backend.graphql.limits.maximum-complexity=100" + "app.graphql.limits.maximum-complexity=100" }) @AutoConfigureTestRestTemplate class GraphQlPlatformExecutionPathTest { diff --git a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlBatchLoaderWiringTest.java b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlBatchLoaderWiringTest.java index 9a96cc94..8cd51728 100644 --- a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlBatchLoaderWiringTest.java +++ b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlBatchLoaderWiringTest.java @@ -27,8 +27,7 @@ class GraphQlBatchLoaderWiringTest { private final ApplicationContextRunner runner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(GraphQlRootAutoConfiguration.class)) - .withPropertyValues( - "backend.graphql.enabled=true", "backend.graphql.deployment-mode=LOCAL"); + .withPropertyValues("app.graphql.enabled=true", "app.graphql.deployment-mode=LOCAL"); @Test @DisplayName("the platform supplies the whole batch chain when GraphQL is on") diff --git a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlCapabilityActivationTest.java b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlCapabilityActivationTest.java index 4126caf2..fa2d5b4c 100644 --- a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlCapabilityActivationTest.java +++ b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlCapabilityActivationTest.java @@ -1,8 +1,10 @@ package dev.caskeleton.adapter.inbound.graphql.autoconfigure; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; import java.util.Arrays; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -49,6 +51,18 @@ class GraphQlCapabilityActivationTest { } } + @Test + @DisplayName("mode를 정하지 않으면 strict 바인딩 오류가 아니라 이름 붙은 거절로 기동이 실패한다") + void anUnsetModeIsRefusedByNameRatherThanAsAnUnboundKey() { + // when + Throwable thrown = catchThrowable(() -> start().close()); + + // then + assertThat(thrown) + .hasStackTraceContaining("app.graphql.deployment-mode is required") + .hasStackTraceContaining("APP_GRAPHQL_DEPLOYMENT_MODE"); + } + private static ConfigurableApplicationContext start(String... arguments) { return new SpringApplicationBuilder(Application.class) .web(WebApplicationType.NONE) diff --git a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlDeploymentModeContractTest.java b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlDeploymentModeContractTest.java index a6236eb0..bbe59f70 100644 --- a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlDeploymentModeContractTest.java +++ b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlDeploymentModeContractTest.java @@ -26,9 +26,9 @@ import org.springframework.core.env.StandardEnvironment; /** * One deployment mode decides every production-safety behaviour (GQL-INT-002). * - *

    There used to be two axes. {@code backend.graphql.production} defaulted to {@code false} and - * {@code backend.graphql.environment} defaulted to {@code PRODUCTION_PUBLIC}, in the same record, - * so the shipped default was a deployment that called itself internet-facing production while every + *

    There used to be two axes. {@code app.graphql.production} defaulted to {@code false} and + * {@code app.graphql.environment} defaulted to {@code PRODUCTION_PUBLIC}, in the same record, so + * the shipped default was a deployment that called itself internet-facing production while every * protection that read the boolean behaved as if it were not. That is not a display inconsistency: * anonymous principal handling, allow-by-default authorization, and part of request protection read * only the boolean, so the enum could say production while the endpoint answered as development. @@ -42,7 +42,7 @@ class GraphQlDeploymentModeContractTest { private final ApplicationContextRunner runner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(GraphQlRootAutoConfiguration.class)) - .withPropertyValues("backend.graphql.enabled=true"); + .withPropertyValues("app.graphql.enabled=true"); @ParameterizedTest @EnumSource(GraphQlDeploymentMode.class) @@ -81,15 +81,32 @@ class GraphQlDeploymentModeContractTest { assertThat(failure) .isInstanceOf(GraphQlPlatformConfigurationException.class) - .hasMessageContaining("backend.graphql.deployment-mode=LOCAL") + .hasMessageContaining("app.graphql.deployment-mode=LOCAL") .hasMessageContaining("[PRODUCTION_INTERNAL, PRODUCTION_PUBLIC]"); } + @Test + @DisplayName("app.graphql 아래 오타 키는 기동을 실패시킨다") + void aMisspelledGraphQlKeyFailsStartup() { + // when + runner + .withPropertyValues( + "app.graphql.deployment-mode=LOCAL", + "spring.profiles.active=local", + "app.graphql.limits.maximum-page-sise=5") + .run( + context -> { + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()).hasStackTraceContaining("maximum-page-sise"); + }); + } + @Test @DisplayName("the context refuses a mode that does not match its runtime profile") void theContextRefusesAModeForAnotherRuntime() { runner - .withPropertyValues("backend.graphql.deployment-mode=DEV", "spring.profiles.active=local") + .withPropertyValues("app.graphql.deployment-mode=DEV", "spring.profiles.active=local") .run( context -> assertThat(context) @@ -107,7 +124,7 @@ class GraphQlDeploymentModeContractTest { assertThat(new GraphQlPlatformStartupValidator().problems(settings)) .as("a message that does not name the property sends an operator reading") - .anySatisfy(problem -> assertThat(problem).contains("backend.graphql.deployment-mode")); + .anySatisfy(problem -> assertThat(problem).contains("app.graphql.deployment-mode")); } @Test @@ -144,7 +161,7 @@ class GraphQlDeploymentModeContractTest { } @ParameterizedTest - @ValueSource(strings = {"backend.graphql.production", "backend.graphql.environment"}) + @ValueSource(strings = {"app.graphql.production", "app.graphql.environment"}) @DisplayName("a retired safety key is a migration error naming the replacement") void aRetiredKeyIsAMigrationError(String retired) { List problems = @@ -163,8 +180,8 @@ class GraphQlDeploymentModeContractTest { GraphQlRetiredSafetyAxis.problems( environmentWith( Map.of( - "backend.graphql.deployment-mode", "LOCAL", - "backend.graphql.environment", "PRODUCTION_PUBLIC"))); + "app.graphql.deployment-mode", "LOCAL", + "app.graphql.environment", "PRODUCTION_PUBLIC"))); assertThat(problems) .as( @@ -175,8 +192,7 @@ class GraphQlDeploymentModeContractTest { @Test @DisplayName("with the master off the retired keys are not read at all") void withTheMasterOffTheNamespaceIsNotValidated() { - ConfigurableEnvironment environment = - environmentWith(Map.of("backend.graphql.production", "true")); + ConfigurableEnvironment environment = environmentWith(Map.of("app.graphql.production", "true")); environment.getPropertySources().addFirst(off()); assertThat(GraphQlRetiredSafetyAxis.problems(environment)) @@ -193,14 +209,14 @@ class GraphQlDeploymentModeContractTest { .hasFailed() .getFailure() .rootCause() - .hasMessageContaining("backend.graphql.deployment-mode")); + .hasMessageContaining("app.graphql.deployment-mode")); } @Test @DisplayName("a development mode gets the permissive authorization default") void aDevelopmentModeGetsThePermissiveDefault() { runner - .withPropertyValues("backend.graphql.deployment-mode=LOCAL") + .withPropertyValues("app.graphql.deployment-mode=LOCAL") .run( context -> { assertThat(context).hasNotFailed(); @@ -216,7 +232,7 @@ class GraphQlDeploymentModeContractTest { @DisplayName("a production mode refuses the permissive default, naming the mode") void aProductionModeRefusesThePermissiveDefault(String mode) { runner - .withPropertyValues("backend.graphql.deployment-mode=" + mode) + .withPropertyValues("app.graphql.deployment-mode=" + mode) .run( context -> assertThat(context) @@ -231,7 +247,7 @@ class GraphQlDeploymentModeContractTest { @DisplayName("production 은 익명 principal resolver 로 떠서 모든 요청을 거부하는 대신 기동을 거부한다") void aProductionModeRefusesTheAnonymousPrincipalResolver(String mode) { runner - .withPropertyValues("backend.graphql.deployment-mode=" + mode) + .withPropertyValues("app.graphql.deployment-mode=" + mode) .withBean( GraphQlAuthorizationPolicy.class, () -> GraphQlAuthorizationPolicy.builder().build()) .run( @@ -247,7 +263,7 @@ class GraphQlDeploymentModeContractTest { @DisplayName("production 은 인가 정책과 principal resolver 를 둘 다 주면 기동한다") void aProductionModeWithAnExplicitPolicyAndResolverStarts() { runner - .withPropertyValues("backend.graphql.deployment-mode=PRODUCTION_INTERNAL") + .withPropertyValues("app.graphql.deployment-mode=PRODUCTION_INTERNAL") .withBean( GraphQlAuthorizationPolicy.class, () -> GraphQlAuthorizationPolicy.builder().build()) .withBean(GraphQlPrincipalResolver.class, () -> request -> Optional.empty()) @@ -258,7 +274,7 @@ class GraphQlDeploymentModeContractTest { @DisplayName("the mode reaches the interceptor that decides what an anonymous caller may do") void theModeReachesTheRequestPath() { runner - .withPropertyValues("backend.graphql.deployment-mode=LOCAL") + .withPropertyValues("app.graphql.deployment-mode=LOCAL") .run( context -> { GraphQlPlatformSettings settings = context.getBean(GraphQlPlatformSettings.class); @@ -304,7 +320,7 @@ class GraphQlDeploymentModeContractTest { @DisplayName("the platform's console setting is what the framework is given") void thePlatformConsoleSettingReachesTheFramework() { ConfigurableEnvironment environment = - environmentWith(Map.of("backend.graphql.console.introspection-enabled", "true")); + environmentWith(Map.of("app.graphql.console.introspection-enabled", "true")); new GraphQlActivationEnvironmentPostProcessor().postProcessEnvironment(environment, null); @@ -331,12 +347,12 @@ class GraphQlDeploymentModeContractTest { environment.getPropertySources().addFirst(source("contract", properties)); environment .getPropertySources() - .addLast(source("master", Map.of("backend.graphql.enabled", "true"))); + .addLast(source("master", Map.of("app.graphql.enabled", "true"))); return environment; } private static MapPropertySource off() { - return source("off", Map.of("backend.graphql.enabled", "false")); + return source("off", Map.of("app.graphql.enabled", "false")); } private static MapPropertySource source(String name, Map properties) { diff --git a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlObservationWiringTest.java b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlObservationWiringTest.java index d0f5181e..54c3bf74 100644 --- a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlObservationWiringTest.java +++ b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlObservationWiringTest.java @@ -27,8 +27,7 @@ class GraphQlObservationWiringTest { AutoConfigurations.of( GraphQlRootAutoConfiguration.class, GraphQlObservationAutoConfiguration.class)) .withBean(ObservationRegistry.class, ObservationRegistry::create) - .withPropertyValues( - "backend.graphql.enabled=true", "backend.graphql.deployment-mode=LOCAL"); + .withPropertyValues("app.graphql.enabled=true", "app.graphql.deployment-mode=LOCAL"); @Test void theFrameworkInstrumentationResolvesThePlatformConvention() { diff --git a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformAutoConfigurationTest.java b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformAutoConfigurationTest.java index 8e7c38d6..f0d6c0d5 100644 --- a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformAutoConfigurationTest.java +++ b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPlatformAutoConfigurationTest.java @@ -41,8 +41,7 @@ class GraphQlPlatformAutoConfigurationTest { // it is testing the missing-mode refusal rather than whatever it meant to test. That // refusal has its own cases in GraphQlDeploymentModeContractTest. Later property values // override earlier ones, so a case that needs a different mode simply names it. - .withPropertyValues( - "backend.graphql.enabled=true", "backend.graphql.deployment-mode=LOCAL"); + .withPropertyValues("app.graphql.enabled=true", "app.graphql.deployment-mode=LOCAL"); @Test void aContextWithOnlyTheDeploymentModeSetBootsWithSafeDefaults() { @@ -81,7 +80,7 @@ class GraphQlPlatformAutoConfigurationTest { @Test void productionRefusesToStartWithoutAnExplicitAuthorizationPolicy() { runner - .withPropertyValues("backend.graphql.deployment-mode=PRODUCTION_INTERNAL") + .withPropertyValues("app.graphql.deployment-mode=PRODUCTION_INTERNAL") .run( context -> assertThat(context) @@ -116,7 +115,7 @@ class GraphQlPlatformAutoConfigurationTest { @Test void aClientPolicyLooserThanTheConfiguredCeilingIsRejectedAtStartup() { runner - .withPropertyValues("backend.graphql.limits.maximum-page-size=25") + .withPropertyValues("app.graphql.limits.maximum-page-size=25") .withBean(GraphQlClientPolicy.class, () -> GraphQlClientPolicy.defaults(500, 10_000, false)) .run( context -> @@ -124,7 +123,7 @@ class GraphQlPlatformAutoConfigurationTest { .hasFailed() .getFailure() .rootCause() - .hasMessageContaining("exceeds backend.graphql.limits.maximum-page-size")); + .hasMessageContaining("exceeds app.graphql.limits.maximum-page-size")); } @Test @@ -137,8 +136,7 @@ class GraphQlPlatformAutoConfigurationTest { runner .withPropertyValues( - "backend.graphql.deployment-mode=LOCAL", - "backend.graphql.console.introspection-enabled=true") + "app.graphql.deployment-mode=LOCAL", "app.graphql.console.introspection-enabled=true") .withBean(GraphQlProperties.class, () -> framework) .run( context -> @@ -156,7 +154,7 @@ class GraphQlPlatformAutoConfigurationTest { framework.getGraphiql().setEnabled(true); runner - .withPropertyValues("backend.graphql.deployment-mode=LOCAL") + .withPropertyValues("app.graphql.deployment-mode=LOCAL") .withBean(GraphQlProperties.class, () -> framework) .run( context -> @@ -174,8 +172,7 @@ class GraphQlPlatformAutoConfigurationTest { runner .withPropertyValues( - "backend.graphql.deployment-mode=LOCAL", - "backend.graphql.console.introspection-enabled=true") + "app.graphql.deployment-mode=LOCAL", "app.graphql.console.introspection-enabled=true") .withBean(GraphQlProperties.class, () -> framework) .run(context -> assertThat(context).hasNotFailed()); } @@ -200,19 +197,19 @@ class GraphQlPlatformAutoConfigurationTest { String metadata = readClasspathResource("META-INF/spring-configuration-metadata.json"); assertThat(metadata) - .contains("backend.graphql.deployment-mode") - .doesNotContain("backend.graphql.production") - .doesNotContain("backend.graphql.environment") - .contains("backend.graphql.console.graphiql-enabled") - .contains("backend.graphql.console.introspection-enabled") - .contains("backend.graphql.limits.maximum-page-size") - .contains("backend.graphql.limits.maximum-complexity") + .contains("app.graphql.deployment-mode") + .doesNotContain("app.graphql.production") + .doesNotContain("app.graphql.environment") + .contains("app.graphql.console.graphiql-enabled") + .contains("app.graphql.console.introspection-enabled") + .contains("app.graphql.limits.maximum-page-size") + .contains("app.graphql.limits.maximum-complexity") // Keys that only failed the boot or were echoed back unused were removed (2026-09-25). - .doesNotContain("backend.graphql.cursor.key-ids") - .doesNotContain("backend.graphql.unsupported.multipart-upload") + .doesNotContain("app.graphql.cursor.key-ids") + .doesNotContain("app.graphql.unsupported.multipart-upload") // Servlet-only template (D4): no reactive profile to choose, no event loop to bridge off. - .doesNotContain("backend.graphql.execution-profile") - .doesNotContain("backend.graphql.unbridged-blocking-resolvers"); + .doesNotContain("app.graphql.execution-profile") + .doesNotContain("app.graphql.unbridged-blocking-resolvers"); } private static GraphQlProperties frameworkDefaults() { diff --git a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPolicyRequestPathTest.java b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPolicyRequestPathTest.java index e9406d0d..1348e67a 100644 --- a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPolicyRequestPathTest.java +++ b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/autoconfigure/GraphQlPolicyRequestPathTest.java @@ -35,8 +35,7 @@ class GraphQlPolicyRequestPathTest { private final ApplicationContextRunner runner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(GraphQlRootAutoConfiguration.class)) - .withPropertyValues( - "backend.graphql.enabled=true", "backend.graphql.deployment-mode=LOCAL"); + .withPropertyValues("app.graphql.enabled=true", "app.graphql.deployment-mode=LOCAL"); @Test @DisplayName("the policies that are wired reach the request path through the instrumentation") diff --git a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlPlatformWebInterceptorRequestBoundsTest.java b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlPlatformWebInterceptorRequestBoundsTest.java index 44e0b689..d85ab481 100644 --- a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlPlatformWebInterceptorRequestBoundsTest.java +++ b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlPlatformWebInterceptorRequestBoundsTest.java @@ -39,8 +39,7 @@ class GraphQlPlatformWebInterceptorRequestBoundsTest { private final ApplicationContextRunner runner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(GraphQlRootAutoConfiguration.class)) - .withPropertyValues( - "backend.graphql.enabled=true", "backend.graphql.deployment-mode=LOCAL") + .withPropertyValues("app.graphql.enabled=true", "app.graphql.deployment-mode=LOCAL") .withBean( GraphQlClientPolicy.class, () -> diff --git a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlRequestStageErrorMappingTest.java b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlRequestStageErrorMappingTest.java index 9e84e133..2e6cc305 100644 --- a/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlRequestStageErrorMappingTest.java +++ b/src/adapter/inbound/graphql/src/test/java/dev/caskeleton/adapter/inbound/graphql/runtime/GraphQlRequestStageErrorMappingTest.java @@ -44,8 +44,7 @@ class GraphQlRequestStageErrorMappingTest { private final ApplicationContextRunner runner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(GraphQlRootAutoConfiguration.class)) - .withPropertyValues( - "backend.graphql.enabled=true", "backend.graphql.deployment-mode=LOCAL"); + .withPropertyValues("app.graphql.enabled=true", "app.graphql.deployment-mode=LOCAL"); @Test @DisplayName("principal resolver 가 던진 ApiErrorCarrier 는 요청 단계에서도 자기 code 로 나간다") diff --git a/src/adapter/inbound/grpc/CLAUDE.md b/src/adapter/inbound/grpc/CLAUDE.md index aed959c9..4e27f052 100644 --- a/src/adapter/inbound/grpc/CLAUDE.md +++ b/src/adapter/inbound/grpc/CLAUDE.md @@ -38,11 +38,11 @@ Package root: `dev.caskeleton.adapter.inbound.grpc`. - 프로덕션 feature RPC 를 스켈레톤에 두는 것 — health/reflection 표면만 (web 의 `HealthcheckController` 와 동일 원칙). -## Config knobs (`ca-skeleton.grpc.server.*`) +## Config knobs (`app.grpc.server.*`) 타입드 `@ConfigurationProperties` 만 두고, 값은 composition-root `application.yml` 에 산다 -(모듈별 `yml` 없음). prefix가 `ca-skeleton.grpc`가 아니라 `.server`까지인 이유: 바인딩이 -`ignoreUnknownFields = false`라서, 부모 prefix를 쓰면 벤더 starter의 `ca-skeleton.grpc.platform.*` +(모듈별 `yml` 없음). prefix가 `app.grpc`가 아니라 `.server`까지인 이유: 바인딩이 +`ignoreUnknownFields = false`라서, 부모 prefix를 쓰면 벤더 starter의 `app.grpc.platform.*` 키가 들어오는 순간 기동이 실패한다(`GrpcSafeActivationTest`). | key | default | 의미 | diff --git a/src/adapter/inbound/grpc/README.md b/src/adapter/inbound/grpc/README.md index b31f630a..fe5e311e 100644 --- a/src/adapter/inbound/grpc/README.md +++ b/src/adapter/inbound/grpc/README.md @@ -22,10 +22,10 @@ ``` 이 줄을 지우면 서버, 포트, 설정 바인딩이 모두 함께 빠진다. -- 켜기와 끄기: 모듈이 있으면 켜진다. `ca-skeleton.grpc.server.enabled=false`로만 끈다. +- 켜기와 끄기: 모듈이 있으면 켜진다. `app.grpc.server.enabled=false`로만 끈다. - 필요한 설정: 전용 `APP_*` env 키는 registry에 없다. 켜진 상태에서 지금 구현이 받는 listener는 - loopback plaintext뿐이라 `ca-skeleton.grpc.server.allow-insecure-local=true`(env - `CA_SKELETON_GRPC_SERVER_ALLOW_INSECURE_LOCAL=true`)를 명시해야 기동한다. 선택: `ca-skeleton.grpc.server.port` + loopback plaintext뿐이라 `app.grpc.server.allow-insecure-local=true`(env + `APP_GRPC_SERVER_ALLOW_INSECURE_LOCAL=true`)를 명시해야 기동한다. 선택: `app.grpc.server.port` (기본 9090), `.bind-address`(기본 127.0.0.1), `.reflection-enabled`, `.shutdown-grace-seconds`. ## 왜 self-managed Netty 인가 diff --git a/src/adapter/inbound/grpc/src/main/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerConfig.java b/src/adapter/inbound/grpc/src/main/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerConfig.java index a8fe2663..4058afbe 100644 --- a/src/adapter/inbound/grpc/src/main/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerConfig.java +++ b/src/adapter/inbound/grpc/src/main/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerConfig.java @@ -11,8 +11,8 @@ import org.springframework.context.annotation.Bean; /** * Wires the gRPC transport machinery. Registered through this module's own {@code * AutoConfiguration.imports}: on when the module is present, off with {@code - * ca-skeleton.grpc.server.enabled=false}. The plaintext listener still refuses to start unless - * {@code ca-skeleton.grpc.server.allow-insecure-local=true} is explicit. + * app.grpc.server.enabled=false}. The plaintext listener still refuses to start unless {@code + * app.grpc.server.allow-insecure-local=true} is explicit. * *

    All collaborators are plain objects composed here, mirroring the clean DI style used across * the skeleton. A feature service is exposed only when its {@link BindableService} bean carries @@ -20,7 +20,7 @@ import org.springframework.context.annotation.Bean; */ @AutoConfiguration @ConditionalOnProperty( - prefix = "ca-skeleton.grpc.server", + prefix = "app.grpc.server", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/inbound/grpc/src/main/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerSettings.java b/src/adapter/inbound/grpc/src/main/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerSettings.java index 5d3f1ef2..ecd3875a 100644 --- a/src/adapter/inbound/grpc/src/main/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerSettings.java +++ b/src/adapter/inbound/grpc/src/main/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerSettings.java @@ -10,11 +10,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; /** - * gRPC server settings bound from {@code ca-skeleton.grpc.server.*}. Typed configuration only (no + * gRPC server settings bound from {@code app.grpc.server.*}. Typed configuration only (no * per-module {@code yml}); values live in the composition-root {@code application.yml}, matching * the ca-skeleton config convention. See README for the self-managed-Netty rationale. */ -@ConfigurationProperties(prefix = "ca-skeleton.grpc.server", ignoreUnknownFields = false) +@ConfigurationProperties(prefix = "app.grpc.server", ignoreUnknownFields = false) @Validated public class GrpcServerSettings { diff --git a/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcP1BoundaryWireTest.java b/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcP1BoundaryWireTest.java index ebf99ee1..37d074f2 100644 --- a/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcP1BoundaryWireTest.java +++ b/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcP1BoundaryWireTest.java @@ -70,11 +70,11 @@ class GrpcP1BoundaryWireTest { new ApplicationContextRunner() .withUserConfiguration(GrpcServerConfig.class, FeatureConfiguration.class) .withPropertyValues( - "ca-skeleton.grpc.server.enabled=true", - "ca-skeleton.grpc.server.port=0", - "ca-skeleton.grpc.server.bind-address=127.0.0.1", - "ca-skeleton.grpc.server.allow-insecure-local=true", - "ca-skeleton.grpc.server.reflection-enabled=false"); + "app.grpc.server.enabled=true", + "app.grpc.server.port=0", + "app.grpc.server.bind-address=127.0.0.1", + "app.grpc.server.allow-insecure-local=true", + "app.grpc.server.reflection-enabled=false"); @Test void missingAuthenticationMetadataIsRejectedWithAStableContract() { diff --git a/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcSafeActivationTest.java b/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcSafeActivationTest.java index 00133ef0..8e1ac2f1 100644 --- a/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcSafeActivationTest.java +++ b/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcSafeActivationTest.java @@ -42,15 +42,14 @@ class GrpcSafeActivationTest { @Test void presentWithoutTheSwitchIsOnAndStillRefusesAnImplicitPlaintextListener() { contextRunner - .withPropertyValues("ca-skeleton.grpc.server.port=0") + .withPropertyValues("app.grpc.server.port=0") .run(context -> assertRootCauseContains(context.getStartupFailure(), "insecure")); } @Test void switchedOffCreatesNoGrpcRuntimeBeansOrListener() { contextRunner - .withPropertyValues( - "ca-skeleton.grpc.server.enabled=false", "ca-skeleton.grpc.server.port=0") + .withPropertyValues("app.grpc.server.enabled=false", "app.grpc.server.port=0") .run( context -> { assertThat(context).doesNotHaveBean(GrpcServerSettings.class); @@ -63,8 +62,7 @@ class GrpcSafeActivationTest { @Test void enabledTransportRequiresAnExplicitLocalInsecureOverride() { contextRunner - .withPropertyValues( - "ca-skeleton.grpc.server.enabled=true", "ca-skeleton.grpc.server.port=0") + .withPropertyValues("app.grpc.server.enabled=true", "app.grpc.server.port=0") .run(context -> assertRootCauseContains(context.getStartupFailure(), "insecure")); } @@ -72,10 +70,10 @@ class GrpcSafeActivationTest { void insecureTransportRejectsANonLoopbackBindAddress() { contextRunner .withPropertyValues( - "ca-skeleton.grpc.server.enabled=true", - "ca-skeleton.grpc.server.port=0", - "ca-skeleton.grpc.server.bind-address=0.0.0.0", - "ca-skeleton.grpc.server.allow-insecure-local=true") + "app.grpc.server.enabled=true", + "app.grpc.server.port=0", + "app.grpc.server.bind-address=0.0.0.0", + "app.grpc.server.allow-insecure-local=true") .run(context -> assertRootCauseContains(context.getStartupFailure(), "loopback")); } @@ -83,10 +81,10 @@ class GrpcSafeActivationTest { void enabledTransportRejectsAPortOutsideTheTcpRange() { contextRunner .withPropertyValues( - "ca-skeleton.grpc.server.enabled=true", - "ca-skeleton.grpc.server.port=65536", - "ca-skeleton.grpc.server.bind-address=127.0.0.1", - "ca-skeleton.grpc.server.allow-insecure-local=true") + "app.grpc.server.enabled=true", + "app.grpc.server.port=65536", + "app.grpc.server.bind-address=127.0.0.1", + "app.grpc.server.allow-insecure-local=true") .run(context -> assertRootCauseContains(context.getStartupFailure(), "port")); } @@ -94,11 +92,11 @@ class GrpcSafeActivationTest { void enabledTransportRejectsANegativeShutdownGrace() { contextRunner .withPropertyValues( - "ca-skeleton.grpc.server.enabled=true", - "ca-skeleton.grpc.server.port=0", - "ca-skeleton.grpc.server.bind-address=127.0.0.1", - "ca-skeleton.grpc.server.allow-insecure-local=true", - "ca-skeleton.grpc.server.shutdown-grace-seconds=-1") + "app.grpc.server.enabled=true", + "app.grpc.server.port=0", + "app.grpc.server.bind-address=127.0.0.1", + "app.grpc.server.allow-insecure-local=true", + "app.grpc.server.shutdown-grace-seconds=-1") .run( context -> assertRootCauseContains(context.getStartupFailure(), "shutdownGraceSeconds")); @@ -109,10 +107,10 @@ class GrpcSafeActivationTest { contextRunner .withUserConfiguration(FeatureServiceConfiguration.class) .withPropertyValues( - "ca-skeleton.grpc.server.enabled=true", - "ca-skeleton.grpc.server.port=0", - "ca-skeleton.grpc.server.bind-address=127.0.0.1", - "ca-skeleton.grpc.server.allow-insecure-local=true") + "app.grpc.server.enabled=true", + "app.grpc.server.port=0", + "app.grpc.server.bind-address=127.0.0.1", + "app.grpc.server.allow-insecure-local=true") .run(context -> assertRootCauseContains(context.getStartupFailure(), "authentication")); } @@ -120,9 +118,9 @@ class GrpcSafeActivationTest { void theVendorPlatformNamespaceBesideTheAdapterDoesNotFailItsStrictBinding() { contextRunner .withPropertyValues( - "ca-skeleton.grpc.server.port=0", - "ca-skeleton.grpc.server.allow-insecure-local=true", - "ca-skeleton.grpc.platform.enabled=true") + "app.grpc.server.port=0", + "app.grpc.server.allow-insecure-local=true", + "app.grpc.platform.enabled=true") .run(context -> assertThat(context).hasNotFailed()); } diff --git a/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerRunnerBootTest.java b/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerRunnerBootTest.java index 2286033a..bc58686a 100644 --- a/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerRunnerBootTest.java +++ b/src/adapter/inbound/grpc/src/test/java/dev/caskeleton/adapter/inbound/grpc/GrpcServerRunnerBootTest.java @@ -27,10 +27,10 @@ import org.springframework.context.annotation.Configuration; /** * Boots the skeleton gRPC machinery in a real Spring context on an ephemeral port ({@code - * ca-skeleton.grpc.server.port=0}) with ZERO feature services and proves it stands up a working - * surface: the {@link GrpcServerRunner} SmartLifecycle starts, the standard {@code grpc.health.v1} - * health service reports SERVING, and v1 server reflection lists the built-in services. A real - * Netty channel exercises the wire, so this is a genuine transport smoke test, not a wiring mock. + * app.grpc.server.port=0}) with ZERO feature services and proves it stands up a working surface: + * the {@link GrpcServerRunner} SmartLifecycle starts, the standard {@code grpc.health.v1} health + * service reports SERVING, and v1 server reflection lists the built-in services. A real Netty + * channel exercises the wire, so this is a genuine transport smoke test, not a wiring mock. */ class GrpcServerRunnerBootTest { @@ -38,11 +38,11 @@ class GrpcServerRunnerBootTest { new ApplicationContextRunner() .withUserConfiguration(GrpcServerConfig.class) .withPropertyValues( - "ca-skeleton.grpc.server.enabled=true", - "ca-skeleton.grpc.server.port=0", - "ca-skeleton.grpc.server.bind-address=127.0.0.1", - "ca-skeleton.grpc.server.allow-insecure-local=true", - "ca-skeleton.grpc.server.reflection-enabled=true"); + "app.grpc.server.enabled=true", + "app.grpc.server.port=0", + "app.grpc.server.bind-address=127.0.0.1", + "app.grpc.server.allow-insecure-local=true", + "app.grpc.server.reflection-enabled=true"); @Test void skeletonServerStartsAndServesHealthAndReflectionWithNoFeatures() { diff --git a/src/adapter/inbound/web-advanced/README.md b/src/adapter/inbound/web-advanced/README.md index 483dcd00..caffe7f5 100644 --- a/src/adapter/inbound/web-advanced/README.md +++ b/src/adapter/inbound/web-advanced/README.md @@ -24,9 +24,9 @@ registry(`src/config/architecture/modules.json`)의 그 leaf `allowed_dependenci | 기능 | 켜는 설정 | 만드는 bean | | --- | --- | --- | -| MVC virtual thread 실행기 + admission 제한 | `backend.web.advanced.mvc-virtual-threads.enabled=true`, `admission-limit`, `database-pool-size`, `outbound-bulkhead`, `admission-wait` | `applicationTaskExecutor`, `VirtualThreadAdmissionGuard`, `VirtualThreadProfile` | -| NDJSON 스트리밍 | `backend.web.advanced.ndjson.enabled=true` | `mvcNdjsonWriter` + 공유 `WebStreamPolicy`·`WebStreamRegistry`·`StreamRecordEncoder` | -| JSON text sequence (RFC 7464) | `backend.web.advanced.json-sequence.enabled=true` | `mvcJsonSequenceWriter` + 같은 공유 bean | +| MVC virtual thread 실행기 + admission 제한 | `app.web.advanced.mvc-virtual-threads.enabled=true`, `admission-limit`, `database-pool-size`, `outbound-bulkhead`, `admission-wait` | `applicationTaskExecutor`, `VirtualThreadAdmissionGuard`, `VirtualThreadProfile` | +| NDJSON 스트리밍 | `app.web.advanced.ndjson.enabled=true` | `mvcNdjsonWriter` + 공유 `WebStreamPolicy`·`WebStreamRegistry`·`StreamRecordEncoder` | +| JSON text sequence (RFC 7464) | `app.web.advanced.json-sequence.enabled=true` | `mvcJsonSequenceWriter` + 같은 공유 bean | virtual thread 실행기는 `TaskDecorator` bean 을 요구한다(요청 상관관계 전파). 조립 순서는 `TaskExecutionAutoConfiguration` 앞이다. 스트리밍 두 기능은 Boot 의 `JsonMapper` bean 으로 레코드를 diff --git a/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcJsonSequenceConfiguration.java b/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcJsonSequenceConfiguration.java index 48abd79d..aa0afbbe 100644 --- a/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcJsonSequenceConfiguration.java +++ b/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcJsonSequenceConfiguration.java @@ -15,7 +15,7 @@ import org.springframework.context.annotation.Import; @AutoConfiguration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnProperty( - prefix = "backend.web.advanced.json-sequence", + prefix = "app.web.advanced.json-sequence", name = "enabled", havingValue = "true") @Import(MvcStreamingSupportConfiguration.class) diff --git a/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcStreamingExecutorConfiguration.java b/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcStreamingExecutorConfiguration.java index f173fc4b..232457b3 100644 --- a/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcStreamingExecutorConfiguration.java +++ b/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcStreamingExecutorConfiguration.java @@ -14,10 +14,7 @@ import org.springframework.context.annotation.Import; /** Wires servlet-side NDJSON streaming only. */ @AutoConfiguration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) -@ConditionalOnProperty( - prefix = "backend.web.advanced.ndjson", - name = "enabled", - havingValue = "true") +@ConditionalOnProperty(prefix = "app.web.advanced.ndjson", name = "enabled", havingValue = "true") @Import(MvcStreamingSupportConfiguration.class) public class MvcStreamingExecutorConfiguration { diff --git a/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/VirtualThreadMvcConfiguration.java b/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/VirtualThreadMvcConfiguration.java index 52a54df4..2273845c 100644 --- a/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/VirtualThreadMvcConfiguration.java +++ b/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/VirtualThreadMvcConfiguration.java @@ -33,7 +33,7 @@ import org.springframework.core.task.support.TaskExecutorAdapter; @EnableConfigurationProperties(VirtualThreadSettings.class) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnProperty( - prefix = "backend.web.advanced.mvc-virtual-threads", + prefix = "app.web.advanced.mvc-virtual-threads", name = "enabled", havingValue = "true") public class VirtualThreadMvcConfiguration { diff --git a/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/VirtualThreadSettings.java b/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/VirtualThreadSettings.java index e53c1995..4f7d9a9f 100644 --- a/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/VirtualThreadSettings.java +++ b/src/adapter/inbound/web-advanced/src/main/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/VirtualThreadSettings.java @@ -7,14 +7,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; /** - * Settings bound from {@code backend.web.advanced.mvc-virtual-threads.*}. + * Settings bound from {@code app.web.advanced.mvc-virtual-threads.*}. * *

    The downstream budgets are settings rather than something read from the pool at runtime, * deliberately. Reading them would make the check pass automatically — whatever the pool is, the * admission limit would be compared against it and the operator would never be asked to think about * the relationship. Writing them down here is what makes a mismatch visible in a diff. */ -@ConfigurationProperties(prefix = "backend.web.advanced.mvc-virtual-threads") +@ConfigurationProperties(prefix = "app.web.advanced.mvc-virtual-threads") @Validated public class VirtualThreadSettings { diff --git a/src/adapter/inbound/web-advanced/src/test/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcAdvancedConfigurationTest.java b/src/adapter/inbound/web-advanced/src/test/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcAdvancedConfigurationTest.java index d0019692..ee30ac31 100644 --- a/src/adapter/inbound/web-advanced/src/test/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcAdvancedConfigurationTest.java +++ b/src/adapter/inbound/web-advanced/src/test/java/dev/caskeleton/adapter/inbound/web/advanced/mvc/MvcAdvancedConfigurationTest.java @@ -46,10 +46,10 @@ class MvcAdvancedConfigurationTest { // thread has no relationship to the submitter. new WebApplicationContextRunner() .withPropertyValues( - "backend.web.advanced.mvc-virtual-threads.enabled=true", - "backend.web.advanced.mvc-virtual-threads.admission-limit=8", - "backend.web.advanced.mvc-virtual-threads.database-pool-size=4", - "backend.web.advanced.mvc-virtual-threads.outbound-bulkhead=4") + "app.web.advanced.mvc-virtual-threads.enabled=true", + "app.web.advanced.mvc-virtual-threads.admission-limit=8", + "app.web.advanced.mvc-virtual-threads.database-pool-size=4", + "app.web.advanced.mvc-virtual-threads.outbound-bulkhead=4") .withUserConfiguration(VirtualThreadMvcConfiguration.class) .run(context -> assertThat(context).hasFailed()); } @@ -77,7 +77,7 @@ class MvcAdvancedConfigurationTest { // Four beans with a dependency chain between them. A cycle or a missing dependency here is not // visible from any unit test of the classes involved. runner - .withPropertyValues("backend.web.advanced.ndjson.enabled=true") + .withPropertyValues("app.web.advanced.ndjson.enabled=true") .withUserConfiguration(MvcStreamingExecutorConfiguration.class) .run( context -> @@ -94,7 +94,7 @@ class MvcAdvancedConfigurationTest { @DisplayName("JSON sequence has its own activation property") void jsonSequenceStartsIndependentlyOfNdjson() { runner - .withPropertyValues("backend.web.advanced.json-sequence.enabled=true") + .withPropertyValues("app.web.advanced.json-sequence.enabled=true") .withUserConfiguration(MvcJsonSequenceConfiguration.class) .run( context -> @@ -114,10 +114,10 @@ class MvcAdvancedConfigurationTest { // concurrency bound and replaced it with nothing. runner .withPropertyValues( - "backend.web.advanced.mvc-virtual-threads.enabled=true", - "backend.web.advanced.mvc-virtual-threads.admission-limit=100", - "backend.web.advanced.mvc-virtual-threads.database-pool-size=20", - "backend.web.advanced.mvc-virtual-threads.outbound-bulkhead=20") + "app.web.advanced.mvc-virtual-threads.enabled=true", + "app.web.advanced.mvc-virtual-threads.admission-limit=100", + "app.web.advanced.mvc-virtual-threads.database-pool-size=20", + "app.web.advanced.mvc-virtual-threads.outbound-bulkhead=20") .withUserConfiguration(VirtualThreadMvcConfiguration.class) .run( context -> { @@ -139,10 +139,10 @@ class MvcAdvancedConfigurationTest { // place — the capability switched on and nothing changed. runner .withPropertyValues( - "backend.web.advanced.mvc-virtual-threads.enabled=true", - "backend.web.advanced.mvc-virtual-threads.admission-limit=8", - "backend.web.advanced.mvc-virtual-threads.database-pool-size=4", - "backend.web.advanced.mvc-virtual-threads.outbound-bulkhead=4") + "app.web.advanced.mvc-virtual-threads.enabled=true", + "app.web.advanced.mvc-virtual-threads.admission-limit=8", + "app.web.advanced.mvc-virtual-threads.database-pool-size=4", + "app.web.advanced.mvc-virtual-threads.outbound-bulkhead=4") .withUserConfiguration(VirtualThreadMvcConfiguration.class) .run( context -> @@ -158,7 +158,7 @@ class MvcAdvancedConfigurationTest { // will not refresh, which is the intended outcome: a node that accepts every arrival and // queues it on budgets that did not grow is worse than a node that does not start. runner - .withPropertyValues("backend.web.advanced.mvc-virtual-threads.enabled=true") + .withPropertyValues("app.web.advanced.mvc-virtual-threads.enabled=true") .withUserConfiguration(VirtualThreadMvcConfiguration.class) .run( context -> diff --git a/src/adapter/inbound/web-advanced/src/test/java/dev/caskeleton/adapter/inbound/web/advanced/release/WebAdvancedRollbackIT.java b/src/adapter/inbound/web-advanced/src/test/java/dev/caskeleton/adapter/inbound/web/advanced/release/WebAdvancedRollbackIT.java index 1624cf72..8ca678d7 100644 --- a/src/adapter/inbound/web-advanced/src/test/java/dev/caskeleton/adapter/inbound/web/advanced/release/WebAdvancedRollbackIT.java +++ b/src/adapter/inbound/web-advanced/src/test/java/dev/caskeleton/adapter/inbound/web/advanced/release/WebAdvancedRollbackIT.java @@ -64,8 +64,8 @@ class WebAdvancedRollbackIT { // matchIfMissing = true would pass the test above and fail this one. runner .withPropertyValues( - "backend.web.advanced.ndjson.enabled=false", - "backend.web.advanced.mvc-virtual-threads.enabled=false") + "app.web.advanced.ndjson.enabled=false", + "app.web.advanced.mvc-virtual-threads.enabled=false") .withUserConfiguration( MvcStreamingExecutorConfiguration.class, MvcJsonSequenceConfiguration.class, diff --git a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/NotificationWebAutoConfiguration.java b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/NotificationWebAutoConfiguration.java index a017b1fe..d149a43a 100644 --- a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/NotificationWebAutoConfiguration.java +++ b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/NotificationWebAutoConfiguration.java @@ -21,7 +21,7 @@ import org.springframework.context.annotation.Import; @AutoConfiguration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackMvcSecurityConfiguration.java b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackMvcSecurityConfiguration.java index 74a10d7c..5d9903b1 100644 --- a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackMvcSecurityConfiguration.java +++ b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackMvcSecurityConfiguration.java @@ -19,7 +19,7 @@ import org.springframework.security.web.SecurityFilterChain; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform.callbacks", + prefix = "app.notification.platform.callbacks", name = "enabled", havingValue = "true") public class CallbackMvcSecurityConfiguration { diff --git a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackRequestConfiguration.java b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackRequestConfiguration.java index 9127eba1..28184839 100644 --- a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackRequestConfiguration.java +++ b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackRequestConfiguration.java @@ -21,7 +21,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform.callbacks", + prefix = "app.notification.platform.callbacks", name = "enabled", havingValue = "true") public class CallbackRequestConfiguration { diff --git a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/NotificationCallbackMvcController.java b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/NotificationCallbackMvcController.java index e205aef2..1b23d6ec 100644 --- a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/NotificationCallbackMvcController.java +++ b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/NotificationCallbackMvcController.java @@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform.callbacks", + prefix = "app.notification.platform.callbacks", name = "enabled", havingValue = "true") @RequestMapping("/internal/notification/callbacks") @@ -55,8 +55,7 @@ public final class NotificationCallbackMvcController { public NotificationCallbackMvcController( ProviderCallbackIngress ingestion, CallbackRequestFactory requestFactory, - @Value("${ca-skeleton.notification.platform.callbacks.max-body-bytes:65508}") - int maxBodyBytes) { + @Value("${app.notification.platform.callbacks.max-body-bytes:65508}") int maxBodyBytes) { this.ingestion = Objects.requireNonNull(ingestion, "ingestion"); this.requestFactory = Objects.requireNonNull(requestFactory, "requestFactory"); if (maxBodyBytes < 1 || maxBodyBytes > MAX_STORABLE_BODY_BYTES) { diff --git a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/submission/NotificationSubmissionController.java b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/submission/NotificationSubmissionController.java index b69acf65..9a5c89e3 100644 --- a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/submission/NotificationSubmissionController.java +++ b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/submission/NotificationSubmissionController.java @@ -38,7 +38,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/submission/NotificationTemplateController.java b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/submission/NotificationTemplateController.java index 2f740842..13bfd13a 100644 --- a/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/submission/NotificationTemplateController.java +++ b/src/adapter/inbound/web-notification/src/main/java/dev/caskeleton/adapter/inbound/web/notification/platform/submission/NotificationTemplateController.java @@ -41,7 +41,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/inbound/web-notification/src/test/java/dev/caskeleton/adapter/inbound/web/notification/NotificationWebAutoConfigurationTest.java b/src/adapter/inbound/web-notification/src/test/java/dev/caskeleton/adapter/inbound/web/notification/NotificationWebAutoConfigurationTest.java index 620e4268..3a2acea8 100644 --- a/src/adapter/inbound/web-notification/src/test/java/dev/caskeleton/adapter/inbound/web/notification/NotificationWebAutoConfigurationTest.java +++ b/src/adapter/inbound/web-notification/src/test/java/dev/caskeleton/adapter/inbound/web/notification/NotificationWebAutoConfigurationTest.java @@ -25,7 +25,7 @@ class NotificationWebAutoConfigurationTest { @Test void nothingIsRegisteredWhileThePlatformIsOff() { servlet - .withPropertyValues("ca-skeleton.notification.platform.enabled=false") + .withPropertyValues("app.notification.platform.enabled=false") .run( context -> assertThat(context) @@ -38,7 +38,7 @@ class NotificationWebAutoConfigurationTest { @Test void theSubmissionSurfaceRegistersWithThePlatformAndTheCallbackEndpointStaysOnItsOwnSwitch() { servlet - .withPropertyValues("ca-skeleton.notification.platform.enabled=true") + .withPropertyValues("app.notification.platform.enabled=true") .run( context -> assertThat(context) @@ -54,8 +54,8 @@ class NotificationWebAutoConfigurationTest { .withConfiguration(AutoConfigurations.of(NotificationWebAutoConfiguration.class)) .withUserConfiguration(UseCases.class) .withPropertyValues( - "ca-skeleton.notification.platform.enabled=true", - "ca-skeleton.notification.platform.callbacks.enabled=true") + "app.notification.platform.enabled=true", + "app.notification.platform.callbacks.enabled=true") .run( context -> assertThat(context) diff --git a/src/adapter/inbound/web-notification/src/test/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackRequestConfigurationTest.java b/src/adapter/inbound/web-notification/src/test/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackRequestConfigurationTest.java index 7f2afa14..b73d45e8 100644 --- a/src/adapter/inbound/web-notification/src/test/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackRequestConfigurationTest.java +++ b/src/adapter/inbound/web-notification/src/test/java/dev/caskeleton/adapter/inbound/web/notification/platform/callback/CallbackRequestConfigurationTest.java @@ -30,7 +30,7 @@ class CallbackRequestConfigurationTest { @DisplayName("callbacks on supplies both beans the endpoints take") void callbacksOnSuppliesTheBeans() { runner - .withPropertyValues("ca-skeleton.notification.platform.callbacks.enabled=true") + .withPropertyValues("app.notification.platform.callbacks.enabled=true") .run( context -> assertThat(context) diff --git a/src/adapter/inbound/web/README.md b/src/adapter/inbound/web/README.md index e4b82a6f..f80ec34d 100644 --- a/src/adapter/inbound/web/README.md +++ b/src/adapter/inbound/web/README.md @@ -62,7 +62,7 @@ production configuration and compare the result with the committed snapshot. ### JWT / Redis session 상호배타 모드 -`ca-skeleton.security.auth-mode=jwt|redis-session`은 하나만 선택한다. JWT mode는 stateless이고 +`app.security.auth-mode=jwt|redis-session`은 하나만 선택한다. JWT mode는 stateless이고 CSRF/session repository를 만들지 않는다. Redis session mode는 `Secure`, `HttpOnly`, host-only session cookie, `SameSite=Lax`, cookie/header CSRF와 `migrateSession` fixation 방어를 함께 켠다. @@ -293,7 +293,7 @@ commit-aware response wrapper 계약을 구현한다. 또한 이 모듈은 HTML - inbound web은 `shared-contract`의 `EdgeRateLimitPort`만 호출한다. Redis key, Lua, local counter와 provider 설정을 알지 못한다. - outbound provider activation SSOT는 - `ca-skeleton.capabilities.rate-limit.provider=disabled|redis`이고, HTTP enforcement의 별도 축은 + `app.capabilities.rate-limit.provider=disabled|redis`이고, HTTP enforcement의 별도 축은 `app.rate-limit.enabled`다. transport가 enabled인데 exact provider가 없거나 중복이면 startup을 실패시킨다. - fixed window, sliding counter, token bucket 선택과 policy revision은 Redis provider가 소유한다. diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/JwtDecoderConfig.java b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/JwtDecoderConfig.java index 04020840..5496b284 100644 --- a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/JwtDecoderConfig.java +++ b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/JwtDecoderConfig.java @@ -29,10 +29,7 @@ import org.springframework.web.client.RestClientException; * README for the design rationale. */ @Configuration -@ConditionalOnProperty( - name = "ca-skeleton.security.auth-mode", - havingValue = "jwt", - matchIfMissing = true) +@ConditionalOnProperty(name = "app.security.auth-mode", havingValue = "jwt", matchIfMissing = true) public class JwtDecoderConfig { static final String ERROR_TIMESTAMP_INVALID = "jwt_timestamp_invalid"; diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/RedisSessionWebConfig.java b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/RedisSessionWebConfig.java index 890e5c6a..5622f31a 100644 --- a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/RedisSessionWebConfig.java +++ b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/RedisSessionWebConfig.java @@ -12,7 +12,7 @@ import org.springframework.session.web.http.DefaultCookieSerializer; @Configuration(proxyBeanMethods = false) @EnableSpringHttpSession @ConditionalOnProperty( - name = "ca-skeleton.security.auth-mode", + name = "app.security.auth-mode", havingValue = "redis-session", matchIfMissing = false) public class RedisSessionWebConfig { diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/SecurityConfig.java b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/SecurityConfig.java index c5ec53e6..81eced3c 100644 --- a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/SecurityConfig.java +++ b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/auth/SecurityConfig.java @@ -56,7 +56,7 @@ public class SecurityConfig { @Bean @ConditionalOnProperty( - name = "ca-skeleton.security.auth-mode", + name = "app.security.auth-mode", havingValue = "redis-session", matchIfMissing = false) PrimitiveSessionSecurityContextRepository primitiveSessionSecurityContextRepository() { diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/authz/RolePermissionPolicy.java b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/authz/RolePermissionPolicy.java index 09be195e..bc998b16 100644 --- a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/authz/RolePermissionPolicy.java +++ b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/authz/RolePermissionPolicy.java @@ -8,11 +8,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; /** * App-side role→permission mapping source. * - *

    Bound from {@code ca-skeleton.authz.role-permissions. = [resource:action, ...]}. Keys - * are raw IdP role names (no {@code ROLE_} prefix), e.g.: + *

    Bound from {@code app.authz.role-permissions. = [resource:action, ...]}. Keys are + * raw IdP role names (no {@code ROLE_} prefix), e.g.: * *

    - * ca-skeleton:
    + * app:
      *   authz:
      *     role-permissions:
      *       user:  [worklog:read, worklog:write]
    @@ -21,7 +21,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
      *
      * 

    See README for the design rationale. */ -@ConfigurationProperties(prefix = "ca-skeleton.authz") +@ConfigurationProperties(prefix = "app.authz") public record RolePermissionPolicy(Map> rolePermissions) { public RolePermissionPolicy { diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformAutoConfiguration.java b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformAutoConfiguration.java index 8863613c..f287df42 100644 --- a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformAutoConfiguration.java +++ b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformAutoConfiguration.java @@ -31,7 +31,7 @@ import tools.jackson.core.StreamReadFeature; @AutoConfiguration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnProperty( - prefix = "backend.web.mvc", + prefix = "app.web.mvc", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformSettings.java b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformSettings.java index a42c61b2..d8c43415 100644 --- a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformSettings.java +++ b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformSettings.java @@ -19,7 +19,7 @@ import org.springframework.util.unit.DataSize; * @param trustInboundRequestId whether a caller may choose its own request id * @param maxJsonBodySize the largest JSON request body accepted; 1MB when omitted */ -@ConfigurationProperties(prefix = "backend.web.mvc") +@ConfigurationProperties(prefix = "app.web.mvc") public record WebMvcPlatformSettings( Boolean enabled, Boolean trustInboundRequestId, DataSize maxJsonBodySize) { @@ -30,7 +30,7 @@ public record WebMvcPlatformSettings( trustInboundRequestId = trustInboundRequestId != null && trustInboundRequestId; maxJsonBodySize = maxJsonBodySize == null ? DataSize.ofMegabytes(1) : maxJsonBodySize; if (maxJsonBodySize.toBytes() < 1) { - throw new IllegalArgumentException("backend.web.mvc.max-json-body-size must be positive"); + throw new IllegalArgumentException("app.web.mvc.max-json-body-size must be positive"); } } diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/ratelimit/EdgeRateLimitTransportSettings.java b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/ratelimit/EdgeRateLimitTransportSettings.java index 7b82329a..7a3e8507 100644 --- a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/ratelimit/EdgeRateLimitTransportSettings.java +++ b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/ratelimit/EdgeRateLimitTransportSettings.java @@ -8,7 +8,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * HTTP bridge settings bound to the transport-only {@code app.rate-limit} axis. * *

    The outbound provider is selected independently by {@code - * ca-skeleton.capabilities.rate-limit.provider}; enabling this bridge never selects a provider or a + * app.capabilities.rate-limit.provider}; enabling this bridge never selects a provider or a * fallback. */ @ConfigurationProperties(prefix = "app.rate-limit") diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/CorsSettings.java b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/CorsSettings.java index b404baef..6c729c9d 100644 --- a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/CorsSettings.java +++ b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/CorsSettings.java @@ -7,20 +7,16 @@ import java.util.List; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; -/** - * CORS settings bound from {@code ca-skeleton.cors.*}. See README for the validation-policy - * rationale. - */ +/** CORS settings bound from {@code app.cors.*}. See README for the validation-policy rationale. */ @Validated -@ConfigurationProperties(prefix = "ca-skeleton.cors") +@ConfigurationProperties(prefix = "app.cors") public record CorsSettings( boolean enabled, List allowedOrigins, List allowedMethods, List allowedHeaders, boolean allowCredentials, - @PositiveOrZero( - message = "APP_SECURITY_CORS_MAX_AGE (ca-skeleton.cors.max-age-seconds) must be >= 0") + @PositiveOrZero(message = "APP_SECURITY_CORS_MAX_AGE (app.cors.max-age-seconds) must be >= 0") long maxAgeSeconds) { public CorsSettings { @@ -28,13 +24,13 @@ public record CorsSettings( if (enabled && (allowedOrigins == null || allowedOrigins.isEmpty())) { throw new IllegalArgumentException( "APP_SECURITY_CORS_ENABLED=true requires a non-empty APP_SECURITY_CORS_ORIGINS " - + "(ca-skeleton.cors.allowed-origins)"); + + "(app.cors.allowed-origins)"); } // A wildcard origin must not be combined with credentials. if (allowCredentials && allowedOrigins != null && allowedOrigins.contains("*")) { throw new IllegalArgumentException( "APP_SECURITY_CORS_ALLOW_CREDENTIALS=true must not be combined with a wildcard " - + "\"*\" in APP_SECURITY_CORS_ORIGINS (ca-skeleton.cors.allowed-origins); " + + "\"*\" in APP_SECURITY_CORS_ORIGINS (app.cors.allowed-origins); " + "list explicit origins instead"); } if (allowedOrigins == null) { @@ -85,7 +81,7 @@ public record CorsSettings( private static IllegalArgumentException notAnOrigin(String origin) { return new IllegalArgumentException( - "APP_SECURITY_CORS_ORIGINS (ca-skeleton.cors.allowed-origins) entry \"" + "APP_SECURITY_CORS_ORIGINS (app.cors.allowed-origins) entry \"" + origin + "\" must be exactly scheme://host[:port] with http or https: no path, trailing" + " slash, query, fragment, user info, wildcard host or \"null\""); diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/PresentationSettings.java b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/PresentationSettings.java index b4becc39..5ba0630c 100644 --- a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/PresentationSettings.java +++ b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/PresentationSettings.java @@ -4,10 +4,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.context.properties.ConfigurationProperties; -/** - * Bound from {@code ca-skeleton.presentation.*}. See README for the validation-policy rationale. - */ -@ConfigurationProperties(prefix = "ca-skeleton.presentation") +/** Bound from {@code app.presentation.*}. See README for the validation-policy rationale. */ +@ConfigurationProperties(prefix = "app.presentation") public record PresentationSettings(String apiBasePath) { private static final Logger log = LoggerFactory.getLogger(PresentationSettings.class); diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/SecuritySettings.java b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/SecuritySettings.java index 6e3a6362..1082930a 100644 --- a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/SecuritySettings.java +++ b/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/settings/SecuritySettings.java @@ -7,10 +7,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.bind.ConstructorBinding; /** - * Exclusive JWT or Redis-backed browser-session security policy bound from {@code - * ca-skeleton.security.*}. + * Exclusive JWT or Redis-backed browser-session security policy bound from {@code app.security.*}. */ -@ConfigurationProperties(prefix = "ca-skeleton.security") +@ConfigurationProperties(prefix = "app.security") public record SecuritySettings( AuthenticationMode authMode, String issuerUri, @@ -30,7 +29,7 @@ public record SecuritySettings( this.authMode = authMode == null ? AuthenticationMode.JWT : authMode; if (this.authMode == AuthenticationMode.JWT && (issuerUri == null || issuerUri.isBlank())) { throw new IllegalArgumentException( - "APP_SECURITY_JWT_ISSUER (ca-skeleton.security.issuer-uri) is required"); + "APP_SECURITY_JWT_ISSUER (app.security.issuer-uri) is required"); } this.issuerUri = issuerUri == null ? "" : issuerUri.trim(); if (audience == null) { diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/CorsSecurityFilterIntegrationTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/CorsSecurityFilterIntegrationTest.java index 86bfeab4..4e2c1acc 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/CorsSecurityFilterIntegrationTest.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/CorsSecurityFilterIntegrationTest.java @@ -167,18 +167,18 @@ class CorsSecurityFilterIntegrationTest { boolean enabled, String origin, boolean credentials, ThrowingConsumer assertion) { runner .withPropertyValues( - "ca-skeleton.security.auth-mode=jwt", - "ca-skeleton.security.issuer-uri=https://issuer.example.test", - "ca-skeleton.security.audience=ca-skeleton-api", - "ca-skeleton.security.public-paths=/public", - "ca-skeleton.cors.enabled=" + enabled, - "ca-skeleton.cors.allowed-origins[0]=" + origin, - "ca-skeleton.cors.allowed-methods[0]=GET", - "ca-skeleton.cors.allowed-methods[1]=POST", - "ca-skeleton.cors.allowed-headers[0]=X-Request-ID", - "ca-skeleton.cors.allowed-headers[1]=Content-Type", - "ca-skeleton.cors.allow-credentials=" + credentials, - "ca-skeleton.cors.max-age-seconds=600") + "app.security.auth-mode=jwt", + "app.security.issuer-uri=https://issuer.example.test", + "app.security.audience=ca-skeleton-api", + "app.security.public-paths=/public", + "app.cors.enabled=" + enabled, + "app.cors.allowed-origins[0]=" + origin, + "app.cors.allowed-methods[0]=GET", + "app.cors.allowed-methods[1]=POST", + "app.cors.allowed-headers[0]=X-Request-ID", + "app.cors.allowed-headers[1]=Content-Type", + "app.cors.allow-credentials=" + credentials, + "app.cors.max-age-seconds=600") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/JwtJwksSecurityFilterIntegrationTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/JwtJwksSecurityFilterIntegrationTest.java index fa69e8b9..22879c19 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/JwtJwksSecurityFilterIntegrationTest.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/JwtJwksSecurityFilterIntegrationTest.java @@ -259,11 +259,11 @@ class JwtJwksSecurityFilterIntegrationTest { private void withContext(OidcServer issuer, ThrowingConsumer assertion) { runner .withPropertyValues( - "ca-skeleton.security.auth-mode=jwt", - "ca-skeleton.security.issuer-uri=" + issuer.issuer(), - "ca-skeleton.security.audience=" + AUDIENCE, - "ca-skeleton.security.public-paths=/public", - "ca-skeleton.cors.enabled=false") + "app.security.auth-mode=jwt", + "app.security.issuer-uri=" + issuer.issuer(), + "app.security.audience=" + AUDIENCE, + "app.security.public-paths=/public", + "app.cors.enabled=false") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/RedisSessionWebConfigTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/RedisSessionWebConfigTest.java index b35c4e6c..63749b77 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/RedisSessionWebConfigTest.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/RedisSessionWebConfigTest.java @@ -23,8 +23,7 @@ class RedisSessionWebConfigTest { void jwtModeCreatesNoSessionFilterOrCookieSerializer() { runner .withPropertyValues( - "ca-skeleton.security.auth-mode=jwt", - "ca-skeleton.security.issuer-uri=https://issuer.example") + "app.security.auth-mode=jwt", "app.security.issuer-uri=https://issuer.example") .run( context -> { assertThat(context).hasNotFailed(); @@ -39,12 +38,12 @@ class RedisSessionWebConfigTest { .withBean( MapSessionRepository.class, () -> new MapSessionRepository(new ConcurrentHashMap<>())) .withPropertyValues( - "ca-skeleton.security.auth-mode=redis-session", - "ca-skeleton.security.session.cookie-name=APP_SESSION", - "ca-skeleton.security.session.secure=true", - "ca-skeleton.security.session.http-only=true", - "ca-skeleton.security.session.same-site=Strict", - "ca-skeleton.security.session.path=/") + "app.security.auth-mode=redis-session", + "app.security.session.cookie-name=APP_SESSION", + "app.security.session.secure=true", + "app.security.session.http-only=true", + "app.security.session.same-site=Strict", + "app.security.session.path=/") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/SecurityModeWebContractTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/SecurityModeWebContractTest.java index 22f8a75e..ef920653 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/SecurityModeWebContractTest.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/auth/SecurityModeWebContractTest.java @@ -53,9 +53,9 @@ class SecurityModeWebContractTest { void redisSessionModeEnablesCsrfAndRotatesAnAuthenticatedSessionIdentifier() { runner .withPropertyValues( - "ca-skeleton.security.auth-mode=redis-session", - "ca-skeleton.security.public-paths=/probe,/csrf", - "ca-skeleton.cors.enabled=false") + "app.security.auth-mode=redis-session", + "app.security.public-paths=/probe,/csrf", + "app.cors.enabled=false") .run( context -> { MockMvc mvc = mvc(context.getBean("springSecurityFilterChain", Filter.class)); @@ -96,9 +96,9 @@ class SecurityModeWebContractTest { void redisSessionModeDoesNotCacheUnauthorizedApiRequestsInAFrameworkSessionObject() { runner .withPropertyValues( - "ca-skeleton.security.auth-mode=redis-session", - "ca-skeleton.security.public-paths=/csrf", - "ca-skeleton.cors.enabled=false") + "app.security.auth-mode=redis-session", + "app.security.public-paths=/csrf", + "app.cors.enabled=false") .run( context -> { MockMvc mvc = mvc(context.getBean("springSecurityFilterChain", Filter.class)); @@ -117,9 +117,9 @@ class SecurityModeWebContractTest { void redisSessionSecurityFilterPersistsAndRestoresOnlyThePrimitiveAuthenticationSnapshot() { runner .withPropertyValues( - "ca-skeleton.security.auth-mode=redis-session", - "ca-skeleton.security.public-paths=/login-test,/csrf", - "ca-skeleton.cors.enabled=false") + "app.security.auth-mode=redis-session", + "app.security.public-paths=/login-test,/csrf", + "app.cors.enabled=false") .run( context -> { MockMvc mvc = mvc(context.getBean("springSecurityFilterChain", Filter.class)); @@ -155,10 +155,10 @@ class SecurityModeWebContractTest { void jwtModeRemainsCsrfDisabledAndStateless() { runner .withPropertyValues( - "ca-skeleton.security.auth-mode=jwt", - "ca-skeleton.security.issuer-uri=https://issuer.example", - "ca-skeleton.security.public-paths=/probe", - "ca-skeleton.cors.enabled=false") + "app.security.auth-mode=jwt", + "app.security.issuer-uri=https://issuer.example", + "app.security.public-paths=/probe", + "app.cors.enabled=false") .run( context -> { MockMvc mvc = mvc(context.getBean("springSecurityFilterChain", Filter.class)); @@ -175,9 +175,9 @@ class SecurityModeWebContractTest { void anUnauthenticatedRejectionCarriesTheAssignedRequestIdInItsMeta() { runner .withPropertyValues( - "ca-skeleton.security.auth-mode=jwt", - "ca-skeleton.security.issuer-uri=https://issuer.example", - "ca-skeleton.cors.enabled=false") + "app.security.auth-mode=jwt", + "app.security.issuer-uri=https://issuer.example", + "app.cors.enabled=false") .run( context -> { // given: the request-id filter sits in front of Spring Security, as registered diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/authz/RolePermissionPolicyTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/authz/RolePermissionPolicyTest.java index 94e24a09..2a7c8cba 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/authz/RolePermissionPolicyTest.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/authz/RolePermissionPolicyTest.java @@ -14,8 +14,8 @@ import org.springframework.context.annotation.Configuration; /** * Binding test for {@link RolePermissionPolicy} (AGENTS.md §설정과 런타임: every new * {@code @ConfigurationProperties} class gets a binding test). Verifies the {@code - * ca-skeleton.authz.role-permissions.=} YAML/env shape binds to the {@code - * Map>} the registry consumes, and that an absent block is null-safe. + * app.authz.role-permissions.=} YAML/env shape binds to the {@code Map>} the registry consumes, and that an absent block is null-safe. */ class RolePermissionPolicyTest { @@ -26,8 +26,8 @@ class RolePermissionPolicyTest { void bindsRoleToPermissionLists() { runner .withPropertyValues( - "ca-skeleton.authz.role-permissions.user=worklog:read,worklog:write", - "ca-skeleton.authz.role-permissions.admin=worklog:read,worklog:write,worklog:close") + "app.authz.role-permissions.user=worklog:read,worklog:write", + "app.authz.role-permissions.admin=worklog:read,worklog:write,worklog:close") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/RequestBodyBoundaryTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/RequestBodyBoundaryTest.java index 61d02da0..0ddf3ed6 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/RequestBodyBoundaryTest.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/RequestBodyBoundaryTest.java @@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController; excludeAutoConfiguration = SecurityAutoConfiguration.class) @ImportAutoConfiguration(WebMvcPlatformAutoConfiguration.class) @Import(RequestBodyBoundaryTest.Probe.class) -@TestPropertySource(properties = "backend.web.mvc.max-json-body-size=64B") +@TestPropertySource(properties = "app.web.mvc.max-json-body-size=64B") class RequestBodyBoundaryTest { @Autowired MockMvc mvc; diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformAutoConfigurationTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformAutoConfigurationTest.java index 8b08659d..c3d971f2 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformAutoConfigurationTest.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebMvcPlatformAutoConfigurationTest.java @@ -57,7 +57,7 @@ class WebMvcPlatformAutoConfigurationTest { @DisplayName("enabled=false turns everything off") void enabledFalseTurnsEverythingOff() { servlet - .withPropertyValues("backend.web.mvc.enabled=false") + .withPropertyValues("app.web.mvc.enabled=false") .run( context -> assertThat(context) diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/CorsSettingsTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/CorsSettingsTest.java index 3e47dafe..9a271547 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/CorsSettingsTest.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/CorsSettingsTest.java @@ -31,10 +31,10 @@ class CorsSettingsTest { void allowedMethodsAndHeadersMissingDefaultToApiFriendlyValues() { runner .withPropertyValues( - "ca-skeleton.cors.enabled=true", - "ca-skeleton.cors.allowed-origins=http://localhost:3000", - "ca-skeleton.cors.allow-credentials=true", - "ca-skeleton.cors.max-age-seconds=3600") + "app.cors.enabled=true", + "app.cors.allowed-origins=http://localhost:3000", + "app.cors.allow-credentials=true", + "app.cors.max-age-seconds=3600") .run( context -> { assertThat(context).hasNotFailed(); @@ -49,9 +49,9 @@ class CorsSettingsTest { void enabledWithoutOriginsFailsStartup() { runner .withPropertyValues( - "ca-skeleton.cors.enabled=true", - "ca-skeleton.cors.allow-credentials=true", - "ca-skeleton.cors.max-age-seconds=3600") + "app.cors.enabled=true", + "app.cors.allow-credentials=true", + "app.cors.max-age-seconds=3600") .run( context -> { assertThat(context).hasFailed(); @@ -64,10 +64,10 @@ class CorsSettingsTest { void negativeMaxAgeFailsStartup() { runner .withPropertyValues( - "ca-skeleton.cors.enabled=true", - "ca-skeleton.cors.allowed-origins=http://localhost:3000", - "ca-skeleton.cors.allow-credentials=true", - "ca-skeleton.cors.max-age-seconds=-1") + "app.cors.enabled=true", + "app.cors.allowed-origins=http://localhost:3000", + "app.cors.allow-credentials=true", + "app.cors.max-age-seconds=-1") .run( context -> { assertThat(context).hasFailed(); @@ -81,10 +81,10 @@ class CorsSettingsTest { // D9 / FETCH-CORS-C3: "*" origin + credentials=true is forbidden and must fail fast. runner .withPropertyValues( - "ca-skeleton.cors.enabled=true", - "ca-skeleton.cors.allowed-origins=*", - "ca-skeleton.cors.allow-credentials=true", - "ca-skeleton.cors.max-age-seconds=600") + "app.cors.enabled=true", + "app.cors.allowed-origins=*", + "app.cors.allow-credentials=true", + "app.cors.max-age-seconds=600") .run( context -> { assertThat(context).hasFailed(); @@ -98,10 +98,10 @@ class CorsSettingsTest { // A wildcard origin is fine as long as credentials are not also enabled. runner .withPropertyValues( - "ca-skeleton.cors.enabled=true", - "ca-skeleton.cors.allowed-origins=*", - "ca-skeleton.cors.allow-credentials=false", - "ca-skeleton.cors.max-age-seconds=600") + "app.cors.enabled=true", + "app.cors.allowed-origins=*", + "app.cors.allow-credentials=false", + "app.cors.max-age-seconds=600") .run( context -> { assertThat(context).hasNotFailed(); @@ -112,7 +112,7 @@ class CorsSettingsTest { @Test void disabledWithoutOriginsIsAllowed() { runner - .withPropertyValues("ca-skeleton.cors.enabled=false", "ca-skeleton.cors.max-age-seconds=0") + .withPropertyValues("app.cors.enabled=false", "app.cors.max-age-seconds=0") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/PresentationSettingsTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/PresentationSettingsTest.java index 2d01c284..49c077c4 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/PresentationSettingsTest.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/PresentationSettingsTest.java @@ -19,7 +19,7 @@ class PresentationSettingsTest { @Test void validApiBasePathBindsAsIs() { runner - .withPropertyValues("ca-skeleton.presentation.api-base-path=/api") + .withPropertyValues("app.presentation.api-base-path=/api") .run( context -> { assertThat(context).hasNotFailed(); @@ -41,7 +41,7 @@ class PresentationSettingsTest { @Test void noLeadingSlashWarnsAndPrepends(CapturedOutput output) { runner - .withPropertyValues("ca-skeleton.presentation.api-base-path=api") + .withPropertyValues("app.presentation.api-base-path=api") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/SecuritySettingsTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/SecuritySettingsTest.java index 0b10a1b1..1dfb2098 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/SecuritySettingsTest.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/settings/SecuritySettingsTest.java @@ -31,8 +31,7 @@ class SecuritySettingsTest { @Test void audienceMissingWarnsAndDefaultsToEmpty(CapturedOutput output) { runner - .withPropertyValues( - "ca-skeleton.security.issuer-uri=http://localhost:8081/realms/ca-skeleton") + .withPropertyValues("app.security.issuer-uri=http://localhost:8081/realms/ca-skeleton") .run( context -> { assertThat(context).hasNotFailed(); @@ -45,9 +44,9 @@ class SecuritySettingsTest { void publicPathsBindAsList() { runner .withPropertyValues( - "ca-skeleton.security.issuer-uri=http://localhost:8081/realms/ca-skeleton", - "ca-skeleton.security.audience=ca-skeleton-api", - "ca-skeleton.security.public-paths=/api/healthcheck,/api/docs/**") + "app.security.issuer-uri=http://localhost:8081/realms/ca-skeleton", + "app.security.audience=ca-skeleton-api", + "app.security.public-paths=/api/healthcheck,/api/docs/**") .run( context -> { assertThat(context).hasNotFailed(); @@ -72,11 +71,11 @@ class SecuritySettingsTest { void redisSessionModeDoesNotRequireJwtAndBindsSecureHostOnlyCookiePolicy() { runner .withPropertyValues( - "ca-skeleton.security.auth-mode=redis-session", - "ca-skeleton.security.session.cookie-name=APP_SESSION", - "ca-skeleton.security.session.secure=true", - "ca-skeleton.security.session.http-only=true", - "ca-skeleton.security.session.same-site=Strict") + "app.security.auth-mode=redis-session", + "app.security.session.cookie-name=APP_SESSION", + "app.security.session.secure=true", + "app.security.session.http-only=true", + "app.security.session.same-site=Strict") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/adapter/inbound/web/src/testFixtures/resources/application-web-contract.yaml b/src/adapter/inbound/web/src/testFixtures/resources/application-web-contract.yaml index e7a8f90d..53ec72b9 100644 --- a/src/adapter/inbound/web/src/testFixtures/resources/application-web-contract.yaml +++ b/src/adapter/inbound/web/src/testFixtures/resources/application-web-contract.yaml @@ -14,7 +14,7 @@ server: error: include-stacktrace: never include-message: never -backend: +app: web: mvc: enabled: true diff --git a/src/adapter/inbound/websocket/src/main/java/dev/caskeleton/adapter/inbound/websocket/stomp/WebSocketSettings.java b/src/adapter/inbound/websocket/src/main/java/dev/caskeleton/adapter/inbound/websocket/stomp/WebSocketSettings.java index 550b1eed..752e3f25 100644 --- a/src/adapter/inbound/websocket/src/main/java/dev/caskeleton/adapter/inbound/websocket/stomp/WebSocketSettings.java +++ b/src/adapter/inbound/websocket/src/main/java/dev/caskeleton/adapter/inbound/websocket/stomp/WebSocketSettings.java @@ -9,7 +9,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; /** WebSocket (STOMP) settings bound from {@code app.websocket.*}. */ -@ConfigurationProperties(prefix = "app.websocket") +@ConfigurationProperties(prefix = "app.websocket", ignoreUnknownFields = false) @Validated public class WebSocketSettings { diff --git a/src/adapter/inbound/websocket/src/test/java/dev/caskeleton/adapter/inbound/websocket/stomp/WebSocketSettingsTest.java b/src/adapter/inbound/websocket/src/test/java/dev/caskeleton/adapter/inbound/websocket/stomp/WebSocketSettingsTest.java index 4f3494ea..7d0a8ad5 100644 --- a/src/adapter/inbound/websocket/src/test/java/dev/caskeleton/adapter/inbound/websocket/stomp/WebSocketSettingsTest.java +++ b/src/adapter/inbound/websocket/src/test/java/dev/caskeleton/adapter/inbound/websocket/stomp/WebSocketSettingsTest.java @@ -2,6 +2,7 @@ package dev.caskeleton.adapter.inbound.websocket.stomp; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -28,6 +29,20 @@ class WebSocketSettingsTest { assertThat(WebSocketSettings.class).hasAnnotation(Validated.class); } + @Test + @DisplayName("app.websocket 아래 오타 키는 기동을 실패시킨다") + void aMisspelledWebSocketKeyFailsStartup() { + // when + runner + .withPropertyValues("app.websocket.endpont=/live/ws") + .run( + context -> { + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()).hasStackTraceContaining("endpont"); + }); + } + @Test void enabledSafeSettingsBind() { runner diff --git a/src/adapter/outbound/cache-redis/README.md b/src/adapter/outbound/cache-redis/README.md index 044cef1b..83d178ab 100644 --- a/src/adapter/outbound/cache-redis/README.md +++ b/src/adapter/outbound/cache-redis/README.md @@ -40,7 +40,7 @@ runtimeOnly project(':adapter:outbound:cache-redis') // brings :adapter:outbou those are is this module's `RedisCorrectnessRoleSelectors`, registered in the same file as the runtime's `RedisCorrectnessRequirement` — the runtime asks, it does not list selectors; - the shipped settings `config/module-defaults/cache-redis.yml` — `app.redis.enabled`, - `app.rate-limit.*`, and the Redis parts of `ca-skeleton.capabilities.*` (cache, lease, rate-limit, + `app.rate-limit.*`, and the Redis parts of `app.capabilities.*` (cache, lease, rate-limit, the Redis idempotency store's tuning). The support leaf's `ModuleDefaultsEnvironmentPostProcessor` loads it below every application setting. @@ -65,14 +65,14 @@ Redis is on when this module is present. It has one off switch: A semantic role does **not** activate Redis by itself: with the switch off this module contributes no bean at all, whatever a role selector says. Redis idempotency refuses -`ca-skeleton.capabilities.idempotency.key-version` other than 1 at startup (no dual-read yet). +`app.capabilities.idempotency.key-version` other than 1 at startup (no dual-read yet). Current role selectors are: -- cache: `ca-skeleton.capabilities.cache.bindings.default=redis` -- rate limit: `ca-skeleton.capabilities.rate-limit.provider=redis` -- lease: `ca-skeleton.capabilities.lease.provider=redis` -- idempotency: `ca-skeleton.capabilities.idempotency.provider=redis` +- cache: `app.capabilities.cache.bindings.default=redis` +- rate limit: `app.capabilities.rate-limit.provider=redis` +- lease: `app.capabilities.lease.provider=redis` +- idempotency: `app.capabilities.idempotency.provider=redis` Only selected capabilities contribute their application port bean. @@ -182,7 +182,7 @@ The Redis idempotency adapter stores owner-safe claim state and executes claim/t programs atomically. `RedisIdempotencyConfig` contributes only the `IdempotencyStorePort`; the `IdempotencyExecutor` and its lifecycle policy (lease, replay TTL, retention, codec id, policy revision) come from app-bootstrap `IdempotencySettings`. This leaf reads only `key-version` and -`command-timeout` under `ca-skeleton.capabilities.idempotency`. +`command-timeout` under `app.capabilities.idempotency`. Redis `TIME` determines lease deadlines. A failure after a command may have executed is returned as an indeterminate outcome; the adapter does not convert an ambiguous write into a clean diff --git a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCacheConfig.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCacheConfig.java index 67205f63..51df86e3 100644 --- a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCacheConfig.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCacheConfig.java @@ -3,6 +3,7 @@ package dev.caskeleton.adapter.outbound.cache.redis.capability; import dev.caskeleton.adapter.outbound.cache.redis.cache.RedisCacheRegionAdapter; import dev.caskeleton.adapter.outbound.cache.redis.runtime.config.RedisRuntimeSettings; import dev.caskeleton.adapter.outbound.cache.redis.runtime.connection.RedisRuntimeOwner; +import dev.caskeleton.adapter.outbound.support.CapabilitySelectors; import dev.caskeleton.application.cache.CacheRegionPort; import dev.caskeleton.application.outbound.SecretSourcePort; import java.time.Clock; @@ -31,9 +32,7 @@ class RedisCacheConfig { * @return the cache region port */ @Bean - @ConditionalOnProperty( - name = "ca-skeleton.capabilities.cache.bindings.default", - havingValue = "redis") + @ConditionalOnProperty(name = CapabilitySelectors.CACHE_DEFAULT_BINDING, havingValue = "redis") CacheRegionPort redisDefaultCacheRegion( RedisRuntimeOwner owner, RedisRuntimeSettings redis, diff --git a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityConfig.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityConfig.java index 74fa46ff..49542bad 100644 --- a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityConfig.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityConfig.java @@ -7,9 +7,9 @@ import dev.caskeleton.application.outbound.SecretSourcePort; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; +import org.springframework.core.env.Environment; /** * Composes the Redis semantic ports the deployment's role selectors asked for. @@ -37,7 +37,6 @@ import org.springframework.context.annotation.Import; * the deployment's {@code ~} pattern can actually fence. */ @AutoConfiguration(after = RedisRuntimeAutoConfiguration.class) -@EnableConfigurationProperties(RedisCapabilitySettings.class) // The global switch, not a role selector. A role selector says which capability composes; it // never says Redis exists. @ConditionalOnProperty(prefix = "app.redis", name = "enabled", havingValue = "true") @@ -52,13 +51,24 @@ import org.springframework.context.annotation.Import; }) public class RedisCapabilityConfig { + /** + * The per-role settings, bound strictly and only while Redis is on. + * + * @param environment the environment to bind from + * @return the bound settings + */ + @Bean + RedisCapabilitySettings redisCapabilitySettings(Environment environment) { + return RedisCapabilitySettings.bind(environment); + } + /** * Bridges the deployment's configured secret backend into the Redis runtime. * *

    Without it the runtime falls back to reading the process environment directly, which quietly - * bypasses whichever backend {@code ca-skeleton.secret-source.strategy} selected — so a - * deployment using a secret manager would resolve its Redis credential from an environment - * variable that is not supposed to hold it. + * bypasses whichever backend {@code app.secret-source.strategy} selected — so a deployment using + * a secret manager would resolve its Redis credential from an environment variable that is not + * supposed to hold it. * * @param secretSource the configured backend * @return the runtime's view of it diff --git a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilitySettings.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilitySettings.java index b08d8efe..c10d57be 100644 --- a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilitySettings.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilitySettings.java @@ -1,29 +1,58 @@ package dev.caskeleton.adapter.outbound.cache.redis.capability; +import dev.caskeleton.adapter.outbound.support.CapabilitySelectors; import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import java.time.Duration; import java.util.LinkedHashMap; import java.util.Map; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.NestedConfigurationProperty; +import java.util.Set; +import org.springframework.core.env.Environment; /** * The per-capability knobs the Redis composition reads. * - *

    One class rather than four, bound at {@code ca-skeleton.capabilities}, because the - * capabilities share the decisions that matter: which provider is selected, how long a command may - * take, and where the material that digests a caller's identifier comes from. Splitting them - * produced four near-identical records and four places to forget the same setting. + *

    One class rather than four, bound at {@code app.capabilities}, because the capabilities share + * the decisions that matter: which provider is selected, how long a command may take, and where the + * material that digests a caller's identifier comes from. Splitting them produced four + * near-identical records and four places to forget the same setting. * *

    What is deliberately not here is a namespace. Each capability used to carry its own * {@code namespace-application} and {@code namespace-environment}, which is how the deployment * ended up with four key prefixes, none of which matched the ACL pattern that was supposed to fence * it in. The namespace now comes from {@code app.redis.namespace}, once, and every capability * renders below it. + * + *

    Bound strictly ({@link #bind}) by the gated composition, so a misspelt key under {@code + * app.capabilities} fails startup. The idempotency lifecycle policy under the same prefix belongs + * to {@code composition:idempotency} and is left to it. */ -@ConfigurationProperties(prefix = "ca-skeleton.capabilities") public class RedisCapabilitySettings { + /** + * Idempotency keys under the prefix that {@code composition:idempotency} binds, not this class. + */ + static final Set LIFECYCLE_OWNED_KEYS = + Set.of( + "idempotency.processing-lease", + "idempotency.replay-ttl", + "idempotency.failure-retention", + "idempotency.response-codec-id", + "idempotency.policy-revision", + "idempotency.reaper-interval"); + + /** + * Binds {@link CapabilitySelectors#ROOT} strictly, leaving the idempotency lifecycle policy to + * its owner. + * + * @param environment the environment to bind from + * @return the bound settings + */ + static RedisCapabilitySettings bind(Environment environment) { + return StrictSettingsBinder.bindExcept( + environment, CapabilitySelectors.ROOT, RedisCapabilitySettings.class, LIFECYCLE_OWNED_KEYS); + } + private final Cache cache = new Cache(); private final RateLimit rateLimit = new RateLimit(); private final Lease lease = new Lease(); @@ -33,7 +62,6 @@ public class RedisCapabilitySettings { return cache; } - @NestedConfigurationProperty public RateLimit getRateLimit() { return rateLimit; } diff --git a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCorrectnessRoleSelectors.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCorrectnessRoleSelectors.java index b8adee57..eb833f19 100644 --- a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCorrectnessRoleSelectors.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCorrectnessRoleSelectors.java @@ -1,6 +1,7 @@ package dev.caskeleton.adapter.outbound.cache.redis.capability; import dev.caskeleton.adapter.outbound.cache.redis.runtime.config.RedisCorrectnessRequirement; +import dev.caskeleton.adapter.outbound.support.CapabilitySelectors; import java.util.List; import org.springframework.core.env.Environment; @@ -48,35 +49,35 @@ public final class RedisCorrectnessRoleSelectors implements RedisCorrectnessRequ static final List ROLES = List.of( new Role( - "ca-skeleton.capabilities.cache.bindings.default", + CapabilitySelectors.CACHE_DEFAULT_BINDING, "disabled", "redis", false, false, List.of("APP_CACHE_REDIS_PASSWORD", "APP_CACHE_REDIS_KEY_HMAC_SECRET")), new Role( - "ca-skeleton.security.auth-mode", + "app.security.auth-mode", "jwt", "redis-session", true, false, List.of("APP_SESSION_REDIS_PASSWORD", "APP_SESSION_REDIS_KEY_HMAC_SECRET")), new Role( - "ca-skeleton.capabilities.idempotency.provider", + CapabilitySelectors.IDEMPOTENCY_PROVIDER, "disabled", "redis", true, true, List.of("APP_IDEMPOTENCY_REDIS_KEY_HMAC_SECRET")), new Role( - "ca-skeleton.capabilities.rate-limit.provider", + CapabilitySelectors.RATE_LIMIT_PROVIDER, "disabled", "redis", true, true, List.of("APP_RATE_LIMIT_REDIS_PASSWORD", "APP_RATE_LIMIT_REDIS_KEY_HMAC_SECRET")), new Role( - "ca-skeleton.capabilities.lease.provider", + CapabilitySelectors.LEASE_PROVIDER, "disabled", "redis", true, diff --git a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisIdempotencyConfig.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisIdempotencyConfig.java index cfca107f..7aca9619 100644 --- a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisIdempotencyConfig.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisIdempotencyConfig.java @@ -4,6 +4,7 @@ import dev.caskeleton.adapter.outbound.cache.redis.idempotency.IdempotencyScript import dev.caskeleton.adapter.outbound.cache.redis.idempotency.RedisIdempotencyStoreAdapter; import dev.caskeleton.adapter.outbound.cache.redis.runtime.config.RedisRuntimeSettings; import dev.caskeleton.adapter.outbound.cache.redis.runtime.connection.RedisRuntimeOwner; +import dev.caskeleton.adapter.outbound.support.CapabilitySelectors; import dev.caskeleton.adapter.outbound.support.startup.StartupPhase; import dev.caskeleton.adapter.outbound.support.startup.StartupValidationContext; import dev.caskeleton.application.idempotency.IdempotencyStorePort; @@ -29,9 +30,7 @@ class RedisIdempotencyConfig { * @return the store port */ @Bean - @ConditionalOnProperty( - name = "ca-skeleton.capabilities.idempotency.provider", - havingValue = "redis") + @ConditionalOnProperty(name = CapabilitySelectors.IDEMPOTENCY_PROVIDER, havingValue = "redis") IdempotencyStorePort redisIdempotencyStore( RedisRuntimeOwner owner, RedisRuntimeSettings redis, @@ -42,10 +41,10 @@ class RedisIdempotencyConfig { // A new key version would orphan every replay record written under the old one; refused // until a migration can read the previous keyspace during the replay-retention window. StartupValidationContext.forPhase(StartupPhase.ADAPTER_ENABLEMENT) - .reject("ca-skeleton.capabilities.idempotency.key-version=" + idempotency.getKeyVersion()) + .reject("app.capabilities.idempotency.key-version=" + idempotency.getKeyVersion()) .failIfViolated( "Redis idempotency key-version rotation is unsupported without dual-read", - "keep ca-skeleton.capabilities.idempotency.key-version=1 until a migration can read " + "keep app.capabilities.idempotency.key-version=1 until a migration can read " + "the previous keyspace during the replay-retention window."); } return new RedisIdempotencyStoreAdapter( diff --git a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisLeaseConfig.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisLeaseConfig.java index efd8845c..9c9efed4 100644 --- a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisLeaseConfig.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisLeaseConfig.java @@ -4,6 +4,7 @@ import dev.caskeleton.adapter.outbound.cache.redis.lease.LeaseScripts; import dev.caskeleton.adapter.outbound.cache.redis.lease.RedisDistributedLeaseAdapter; import dev.caskeleton.adapter.outbound.cache.redis.runtime.config.RedisRuntimeSettings; import dev.caskeleton.adapter.outbound.cache.redis.runtime.connection.RedisRuntimeOwner; +import dev.caskeleton.adapter.outbound.support.CapabilitySelectors; import dev.caskeleton.application.lease.DistributedLeasePort; import java.time.Clock; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -24,7 +25,7 @@ class RedisLeaseConfig { * @return the lease port */ @Bean - @ConditionalOnProperty(name = "ca-skeleton.capabilities.lease.provider", havingValue = "redis") + @ConditionalOnProperty(name = CapabilitySelectors.LEASE_PROVIDER, havingValue = "redis") DistributedLeasePort redisDistributedLeasePort( RedisRuntimeOwner owner, RedisRuntimeSettings redis, diff --git a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisRateLimitConfig.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisRateLimitConfig.java index ec76c48e..6bde639e 100644 --- a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisRateLimitConfig.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisRateLimitConfig.java @@ -8,6 +8,7 @@ import dev.caskeleton.adapter.outbound.cache.redis.ratelimit.RateLimitScripts; import dev.caskeleton.adapter.outbound.cache.redis.ratelimit.RedisEdgeRateLimitAdapter; import dev.caskeleton.adapter.outbound.cache.redis.runtime.config.RedisRuntimeSettings; import dev.caskeleton.adapter.outbound.cache.redis.runtime.connection.RedisRuntimeOwner; +import dev.caskeleton.adapter.outbound.support.CapabilitySelectors; import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; import dev.caskeleton.shared.ratelimit.EdgeRateLimitPort; import dev.caskeleton.shared.ratelimit.RateParameters; @@ -44,9 +45,7 @@ class RedisRateLimitConfig { * @return the rate limit port */ @Bean - @ConditionalOnProperty( - name = "ca-skeleton.capabilities.rate-limit.provider", - havingValue = "redis") + @ConditionalOnProperty(name = CapabilitySelectors.RATE_LIMIT_PROVIDER, havingValue = "redis") EdgeRateLimitPort redisEdgeRateLimitPort( RedisRuntimeOwner owner, RedisRuntimeSettings redis, @@ -55,7 +54,7 @@ class RedisRateLimitConfig { Environment environment) { RedisCapabilitySettings.RateLimit rateLimit = capabilities.getRateLimit(); // The id the HTTP boundary sends when a route names none. One key, app.rate-limit.*, read by - // both sides: a second copy under ca-skeleton.capabilities bound to the same env var could be + // both sides: a second copy under app.capabilities bound to the same env var could be // overridden alone, and this check would then approve a policy nobody requests. String defaultPolicyId = environment.getProperty(DEFAULT_POLICY_ID, "api-default"); return new RedisEdgeRateLimitAdapter( @@ -75,7 +74,7 @@ class RedisRateLimitConfig { // port reports as a deployment error on every call rather than once at startup. throw new CapabilityStartupValidationException( "the Redis rate limiter is selected but no policy is configured under" - + " ca-skeleton.capabilities.rate-limit.policies"); + + " app.capabilities.rate-limit.policies"); } Map policies = new LinkedHashMap<>(); rateLimit @@ -126,7 +125,7 @@ class RedisRateLimitConfig { // limit it believes is permissive and is not. throw new CapabilityStartupValidationException( "only fail-closed is supported for the Redis rate limiter, but" - + " ca-skeleton.capabilities.rate-limit.failure-policy is '" + + " app.capabilities.rate-limit.failure-policy is '" + rateLimit.getFailurePolicy() + "'"); } diff --git a/src/adapter/outbound/cache-redis/src/main/resources/config/module-defaults/cache-redis.yml b/src/adapter/outbound/cache-redis/src/main/resources/config/module-defaults/cache-redis.yml index a06686e7..a09b3a3e 100644 --- a/src/adapter/outbound/cache-redis/src/main/resources/config/module-defaults/cache-redis.yml +++ b/src/adapter/outbound/cache-redis/src/main/resources/config/module-defaults/cache-redis.yml @@ -18,8 +18,6 @@ app: default-policy-id: ${APP_RATE_LIMIT_DEFAULT_POLICY_ID:api-default} hash-key-version: ${APP_RATE_LIMIT_HASH_KEY_VERSION:1} caller-deadline-budget: 2s - -ca-skeleton: capabilities: # Every capability below renders its keys under one namespace — app.redis.namespace, which is # {environment}:{service}:{domain}. The per-capability namespace-application / diff --git a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityCompositionTest.java b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityCompositionTest.java index 2f424036..8954bec8 100644 --- a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityCompositionTest.java +++ b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityCompositionTest.java @@ -59,11 +59,11 @@ class RedisCapabilityCompositionTest { "app.redis.namespace.domain=shared", "app.redis.authentication.credential-reference=" + "secret://ca-skeleton-application@environment/APP_REDIS_PASSWORD", - "ca-skeleton.capabilities.cache.key-hmac-secret-reference=" + "app.capabilities.cache.key-hmac-secret-reference=" + "secret://environment/APP_CACHE_REDIS_KEY_HMAC_SECRET", - "ca-skeleton.capabilities.rate-limit.policies.api-default.algorithm=sliding-counter", - "ca-skeleton.capabilities.rate-limit.policies.api-default.limit=100", - "ca-skeleton.capabilities.rate-limit.policies.api-default.window=1s"); + "app.capabilities.rate-limit.policies.api-default.algorithm=sliding-counter", + "app.capabilities.rate-limit.policies.api-default.limit=100", + "app.capabilities.rate-limit.policies.api-default.window=1s"); @Test @DisplayName("Redis on with no role selected composes a runtime and no semantic port") @@ -83,7 +83,7 @@ class RedisCapabilityCompositionTest { @DisplayName("the cache binding composes a cache region and nothing else") void cacheBindingComposesTheCacheRegion() { runner - .withPropertyValues("ca-skeleton.capabilities.cache.bindings.default=redis") + .withPropertyValues("app.capabilities.cache.bindings.default=redis") .run( context -> { assertThat(context).hasNotFailed(); @@ -106,7 +106,7 @@ class RedisCapabilityCompositionTest { "app.redis.enabled=true", "app.redis.nodes=redis-a:6379", "app.redis.authentication.credential-reference=secret://u@environment/PW", - "ca-skeleton.capabilities.rate-limit.provider=redis") + "app.capabilities.rate-limit.provider=redis") .run( context -> { assertThat(context).hasFailed(); @@ -121,7 +121,7 @@ class RedisCapabilityCompositionTest { // given ApplicationContextRunner limiter = runner.withPropertyValues( - "ca-skeleton.capabilities.rate-limit.provider=redis", + "app.capabilities.rate-limit.provider=redis", "app.rate-limit.default-policy-id=missing-policy"); // when & then @@ -133,15 +133,46 @@ class RedisCapabilityCompositionTest { + " policies")); } + @Test + @DisplayName("app.capabilities 아래 오타 키는 기동을 실패시킨다") + void aMisspelledCapabilityKeyFailsStartup() { + // when + runner + .withPropertyValues( + "app.capabilities.lease.provider=redis", "app.capabilities.lease.drift-budgt=5ms") + .run( + context -> { + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()).hasStackTraceContaining("drift-budgt"); + }); + } + + @Test + @DisplayName("멱등성 lifecycle 키는 composition:idempotency의 것이라 Redis 설정이 거부하지 않는다") + void theIdempotencyLifecycleKeysAreLeftToTheirOwner() { + // when + runner + .withPropertyValues( + "app.capabilities.idempotency.provider=redis", + "app.capabilities.idempotency.replay-ttl=1h", + "app.capabilities.idempotency.processing-lease=10s") + .run( + context -> { + // then + assertThat(context).hasNotFailed(); + }); + } + @Test @DisplayName("every selected role composes at once, under one namespace") void allRolesComposeTogether() { runner .withPropertyValues( - "ca-skeleton.capabilities.cache.bindings.default=redis", - "ca-skeleton.capabilities.rate-limit.provider=redis", - "ca-skeleton.capabilities.lease.provider=redis", - "ca-skeleton.capabilities.idempotency.provider=redis") + "app.capabilities.cache.bindings.default=redis", + "app.capabilities.rate-limit.provider=redis", + "app.capabilities.lease.provider=redis", + "app.capabilities.idempotency.provider=redis") .run( context -> { assertThat(context).hasNotFailed(); @@ -156,13 +187,13 @@ class RedisCapabilityCompositionTest { void redisIdempotencyRefusesAKeyVersionRotationUntilDualReadExists() { runner .withPropertyValues( - "ca-skeleton.capabilities.idempotency.provider=redis", - "ca-skeleton.capabilities.idempotency.key-version=2") + "app.capabilities.idempotency.provider=redis", + "app.capabilities.idempotency.key-version=2") .run( context -> assertThat(context.getStartupFailure()) .hasRootCauseInstanceOf(StartupFailureException.class) - .hasStackTraceContaining("ca-skeleton.capabilities.idempotency.key-version=2") + .hasStackTraceContaining("app.capabilities.idempotency.key-version=2") .hasStackTraceContaining("unsupported without dual-read")); } @@ -174,8 +205,8 @@ class RedisCapabilityCompositionTest { .withUserConfiguration(Support.class) .withPropertyValues( "app.redis.enabled=false", - "ca-skeleton.capabilities.cache.bindings.default=redis", - "ca-skeleton.capabilities.lease.provider=redis") + "app.capabilities.cache.bindings.default=redis", + "app.capabilities.lease.provider=redis") .run(context -> assertThat(redisBeans(context)).isEmpty()); } diff --git a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisProductionSecretsTest.java b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisProductionSecretsTest.java index 4429b5a1..6001bab8 100644 --- a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisProductionSecretsTest.java +++ b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisProductionSecretsTest.java @@ -22,23 +22,23 @@ class RedisProductionSecretsTest { static Stream selectedRoles() { return Stream.of( Arguments.of( - "ca-skeleton.capabilities.cache.bindings.default", + "app.capabilities.cache.bindings.default", "redis", List.of("APP_CACHE_REDIS_PASSWORD", "APP_CACHE_REDIS_KEY_HMAC_SECRET")), Arguments.of( - "ca-skeleton.security.auth-mode", + "app.security.auth-mode", "redis-session", List.of("APP_SESSION_REDIS_PASSWORD", "APP_SESSION_REDIS_KEY_HMAC_SECRET")), Arguments.of( - "ca-skeleton.capabilities.idempotency.provider", + "app.capabilities.idempotency.provider", "redis", List.of("APP_IDEMPOTENCY_REDIS_KEY_HMAC_SECRET")), Arguments.of( - "ca-skeleton.capabilities.rate-limit.provider", + "app.capabilities.rate-limit.provider", "redis", List.of("APP_RATE_LIMIT_REDIS_PASSWORD", "APP_RATE_LIMIT_REDIS_KEY_HMAC_SECRET")), Arguments.of( - "ca-skeleton.capabilities.lease.provider", + "app.capabilities.lease.provider", "redis", List.of("APP_LEASE_REDIS_KEY_HMAC_SECRET"))); } @@ -68,8 +68,7 @@ class RedisProductionSecretsTest { void aRoleSelectingAnotherProviderRequiresNothingOfRedis() { // given MockEnvironment environment = - new MockEnvironment() - .withProperty("ca-skeleton.capabilities.rate-limit.provider", "disabled"); + new MockEnvironment().withProperty("app.capabilities.rate-limit.provider", "disabled"); // when List required = secrets.requiredSecrets(environment); diff --git a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisReadinessGroupPostProcessorTest.java b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisReadinessGroupPostProcessorTest.java index d33bbea3..b8a5af2a 100644 --- a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisReadinessGroupPostProcessorTest.java +++ b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisReadinessGroupPostProcessorTest.java @@ -114,7 +114,7 @@ class RedisReadinessGroupPostProcessorTest { @DisplayName("cache-only: Redis is on, readiness still does not gate on it") void cacheOnlyDoesNotGateReadiness() throws IOException { Map properties = redisOn(); - properties.put("ca-skeleton.capabilities.cache.bindings.default", "redis"); + properties.put("app.capabilities.cache.bindings.default", "redis"); try (ConfigurableApplicationContext context = boot(properties)) { HealthEndpointGroup readiness = context.getBean(HealthEndpointGroups.class).get("readiness"); assertThat(context.getBeansOfType(HealthIndicator.class)) @@ -132,7 +132,7 @@ class RedisReadinessGroupPostProcessorTest { @DisplayName("a correctness role: the contributor exists and readiness gates on it") void correctnessRoleGatesReadiness() throws IOException { Map properties = redisOn(); - properties.put("ca-skeleton.capabilities.lease.provider", "redis"); + properties.put("app.capabilities.lease.provider", "redis"); try (ConfigurableApplicationContext context = boot(properties)) { HealthEndpointGroup readiness = context.getBean(HealthEndpointGroups.class).get("readiness"); assertThat(context.getBeansOfType(HealthIndicator.class)).containsKey("redisRequired"); diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientEnvironmentKeys.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientEnvironmentKeys.java deleted file mode 100644 index 651f6edc..00000000 --- a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientEnvironmentKeys.java +++ /dev/null @@ -1,179 +0,0 @@ -package dev.caskeleton.adapter.outbound.httpclient.autoconfigure; - -import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.RecordComponent; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.Environment; -import org.springframework.core.env.PropertySource; -import org.springframework.core.env.SystemEnvironmentPropertySource; - -/** - * The environment surface of {@link HttpClientPlatformSettings}, derived from the record tree. - * - *

    This exists because strict binding cannot see a misspelled environment variable. Spring - * resolves {@code APP_HTTPCLIENT_CLIENTS_0_BASE_URL} to {@code app.httpclient.clients[0].base-url} - * by mapping the requested property name back to an environment name, but it enumerates - * the same variable as {@code app.httpclient.clients[0].base.url} — underscores become dots, never - * hyphens. {@code NoUnboundElementsBindHandler} compares against that enumeration, so pointing it - * at the system environment reports correctly-spelled variables as unbound while still saying - * nothing about a genuinely misspelled one. The check therefore runs the other way round: derive - * the names the settings tree accepts, and reject an {@code APP_HTTPCLIENT_} variable that is not - * among them. - * - *

    Without it {@code APP_HTTPCLIENT_CLIENTS_0_TIMEUOT_TOTAL_CALL} would leave the client running - * the default four-second budget while the deployment's manifest says six, and nothing anywhere - * would mention it. - */ -final class HttpClientEnvironmentKeys { - - /** Environment form of {@link HttpClientPlatformSettings#PREFIX}, with its trailing separator. */ - static final String ENV_PREFIX = "APP_HTTPCLIENT_"; - - /** Deepest list nesting {@link #indexLetter} can name. */ - private static final int MAXIMUM_LIST_DEPTH = 1; - - private static final java.util.regex.Pattern SEGMENT_SEPARATOR = - java.util.regex.Pattern.compile("_"); - - private HttpClientEnvironmentKeys() {} - - /** - * Maps each leaf property path to the environment variable template that sets it. - * - *

    A list index is rendered as a letter rather than a number, so the result describes a - * template rather than one deployment's cardinality: {@code N} for the outermost list, {@code M} - * inside it. - * - * @return leaf property path to environment variable template, in declaration order - */ - static Map fieldToEnvTemplate() { - Map templates = new LinkedHashMap<>(); - collect(HttpClientPlatformSettings.class, "APP_HTTPCLIENT", "", 0, templates); - return templates; - } - - /** - * Refuses an {@code APP_HTTPCLIENT_} variable that maps to no field. - * - * @param environment the environment to inspect; sources other than the system environment are - * covered by strict binding and are not re-checked here - * @throws IllegalStateException listing every unrecognised variable, so an operator fixes them in - * one pass rather than one restart at a time - */ - static void rejectUnrecognised(Environment environment) { - if (!(environment instanceof ConfigurableEnvironment configurable)) { - return; - } - Set accepted = Set.copyOf(fieldToEnvTemplate().values()); - Set unrecognised = new TreeSet<>(); - for (PropertySource source : configurable.getPropertySources()) { - if (!(source instanceof SystemEnvironmentPropertySource environmentSource)) { - continue; - } - for (String name : environmentSource.getPropertyNames()) { - String canonical = name.toUpperCase(Locale.ROOT); - if (canonical.startsWith(ENV_PREFIX) && !accepted.contains(asTemplate(canonical))) { - unrecognised.add(name); - } - } - } - if (!unrecognised.isEmpty()) { - throw new CapabilityStartupValidationException( - "unrecognised HTTP client environment variables " - + unrecognised - + "; see docs/httpclient/env-fields.yaml for the accepted names"); - } - } - - /** - * Replaces each index with the letter its depth uses, so a concrete variable can be looked up. - * - *

    Only a wholly numeric segment is an index. A field whose name happens to end in digits stays - * literal, which is why {@code DRAFT12} would not be mistaken for a position. - */ - private static String asTemplate(String environmentName) { - // -1 keeps trailing empty segments, so a stray trailing underscore stays visible and is - // rejected rather than normalised away into a name that happens to match. - String[] segments = SEGMENT_SEPARATOR.split(environmentName, -1); - int listDepth = 0; - StringBuilder template = new StringBuilder(environmentName.length()); - for (int index = 0; index < segments.length; index++) { - if (index > 0) { - template.append('_'); - } - String segment = segments[index]; - if (!segment.isEmpty() && segment.chars().allMatch(Character::isDigit)) { - if (listDepth > MAXIMUM_LIST_DEPTH) { - // Deeper than any field can express, so it cannot name one. Left literal, which no - // template matches, so the variable is reported rather than silently accepted. - template.append(segment); - continue; - } - template.append(indexLetter(listDepth)); - listDepth++; - } else { - template.append(segment); - } - } - return template.toString(); - } - - private static void collect( - Class type, String envPrefix, String pathPrefix, int listDepth, Map into) { - for (RecordComponent component : type.getRecordComponents()) { - String property = camelToKebab(component.getName()); - String path = pathPrefix.isEmpty() ? property : pathPrefix + "." + property; - String env = envPrefix + "_" + camelToScreamingSnake(component.getName()); - Class componentType = component.getType(); - if (componentType.isRecord()) { - collect(componentType, env, path, listDepth, into); - continue; - } - if (List.class.isAssignableFrom(componentType)) { - String index = indexLetter(listDepth); - Class element = elementTypeOf(component); - if (element != null && element.isRecord()) { - collect(element, env + "_" + index, path + "[" + index + "]", listDepth + 1, into); - } else { - into.put(path + "[" + index + "]", env + "_" + index); - } - continue; - } - into.put(path, env); - } - } - - /** {@code N} for the outermost list, {@code M} inside it. No settings field nests deeper. */ - private static String indexLetter(int depth) { - return switch (depth) { - case 0 -> "N"; - case 1 -> "M"; - default -> - throw new IllegalStateException( - "list nesting deeper than the environment template can express"); - }; - } - - private static Class elementTypeOf(RecordComponent component) { - if (component.getGenericType() instanceof ParameterizedType parameterized - && parameterized.getActualTypeArguments()[0] instanceof Class element) { - return element; - } - return null; - } - - private static String camelToKebab(String name) { - return name.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT); - } - - private static String camelToScreamingSnake(String name) { - return name.replaceAll("([a-z0-9])([A-Z])", "$1_$2").toUpperCase(Locale.ROOT); - } -} diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettings.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettings.java index 1fce5d54..0a9fe458 100644 --- a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettings.java +++ b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettings.java @@ -187,8 +187,7 @@ public record HttpClientPlatformSettings( @DefaultValue("1s") Duration requestWriteIdle, @DefaultValue("2s") Duration responseHeader, @DefaultValue("3s") Duration readIdle, - @DefaultValue("4s") Duration totalCall, - @DefaultValue("30s") Duration streamingIdle) {} + @DefaultValue("4s") Duration totalCall) {} /** Redirect policy; disabled by default (design §12.4). */ public record Redirect( diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettingsBinder.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettingsBinder.java index 5448a338..308b58a5 100644 --- a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettingsBinder.java +++ b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettingsBinder.java @@ -2,32 +2,23 @@ package dev.caskeleton.adapter.outbound.httpclient.autoconfigure; import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import org.springframework.core.env.Environment; -import org.springframework.core.env.SystemEnvironmentPropertySource; /** * Binds {@link HttpClientPlatformSettings} strictly, and only when asked. * - *

    The mechanics live in {@link StrictSettingsBinder} (BOOT-011). What stays here is this - * platform's one genuine difference: strictness needs two mechanisms because one does not cover - * both surfaces. - * - *

    Property sources that enumerate their keys in property form — YAML, properties files, test - * overrides — are checked by the shared binder's unbound-element handler. The system environment is - * excluded from it and checked by {@link HttpClientEnvironmentKeys#rejectUnrecognised} instead: - * Spring enumerates {@code APP_HTTPCLIENT_CLIENTS_0_BASE_URL} as {@code ...clients[0].base.url} - * while binding it as {@code ...clients[0].base-url}, so leaving it to the handler would reject - * every correctly spelled variable and still miss the misspelled ones. + *

    The mechanics live in {@link StrictSettingsBinder} (BOOT-011), including the check this + * platform used to carry alone: a misspelt {@code APP_HTTPCLIENT_*} variable is refused by name. + * Spring enumerates the system environment in a form strict binding cannot compare, so the shared + * binder checks it the other way round — against the names of the fields it bound — for every + * capability rather than, as before, for this one settings type by reflection over its records + * (S3-lead-2). */ final class HttpClientPlatformSettingsBinder { private HttpClientPlatformSettingsBinder() {} static HttpClientPlatformSettings bind(Environment environment) { - HttpClientEnvironmentKeys.rejectUnrecognised(environment); return StrictSettingsBinder.bind( - environment, - HttpClientPlatformSettings.PREFIX, - HttpClientPlatformSettings.class, - source -> !(source.getUnderlyingSource() instanceof SystemEnvironmentPropertySource)); + environment, HttpClientPlatformSettings.PREFIX, HttpClientPlatformSettings.class); } } diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientProfileFactory.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientProfileFactory.java index 5e6feb39..a4e89a3e 100644 --- a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientProfileFactory.java +++ b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientProfileFactory.java @@ -94,8 +94,7 @@ public final class HttpClientProfileFactory { timeout.requestWriteIdle(), timeout.responseHeader(), timeout.readIdle(), - timeout.totalCall(), - timeout.streamingIdle()); + timeout.totalCall()); } private AuthenticationSettings authentication( diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/profile/TimeoutSettings.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/profile/TimeoutSettings.java index b9502e98..643ed7c4 100644 --- a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/profile/TimeoutSettings.java +++ b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/profile/TimeoutSettings.java @@ -7,8 +7,7 @@ import java.util.Objects; * Stage timeouts and the total call budget (design §15.1). * *

    {@link #totalCall()} is the upper budget for everything, including pool acquire and retry - * backoff. {@link #streamingIdle()} is deliberately separate so a long-lived SSE stream is not - * killed by the request-shaped total budget (design §15.3). + * backoff. */ public record TimeoutSettings( // Hostname resolution budget. Currently unenforced: neither the Apache classic client nor the @@ -21,8 +20,7 @@ public record TimeoutSettings( Duration requestWriteIdle, Duration responseHeader, Duration readIdle, - Duration totalCall, - Duration streamingIdle) { + Duration totalCall) { /** * The shipped {@code timeout.dns} default. @@ -41,6 +39,5 @@ public record TimeoutSettings( Objects.requireNonNull(responseHeader, "response header timeout"); Objects.requireNonNull(readIdle, "read idle timeout"); Objects.requireNonNull(totalCall, "total call timeout"); - Objects.requireNonNull(streamingIdle, "streaming idle timeout"); } } diff --git a/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformEnvManifestTest.java b/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformEnvManifestTest.java index 42a57652..298664f8 100644 --- a/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformEnvManifestTest.java +++ b/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformEnvManifestTest.java @@ -6,11 +6,14 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import dev.caskeleton.adapter.outbound.httpclient.profile.HttpProtocol; import java.io.IOException; import java.io.UncheckedIOException; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.RecordComponent; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -43,7 +46,7 @@ class HttpClientPlatformEnvManifestTest { @Test @DisplayName("the manifest and the settings tree describe the same fields") void theManifestAndTheSettingsTreeAgree() { - Map derived = HttpClientEnvironmentKeys.fieldToEnvTemplate(); + Map derived = fieldToEnvTemplate(); assertThat(derived).as("the derivation itself must find something").isNotEmpty(); assertThat(manifest()) @@ -205,4 +208,49 @@ class HttpClientPlatformEnvManifestTest { throw new UncheckedIOException(path + " could not be read", exception); } } + + /** + * Maps each leaf property path of the settings tree to the environment variable template that + * sets it — the manifest's content, derived. + * + *

    A list index is rendered as a letter rather than a number, so the result describes a + * template rather than one deployment's cardinality: {@code N} for the outermost list, {@code M} + * inside it. This lives in the test: the runtime refuses a misspelt variable through the shared + * strict binder and needs no reflective copy of the tree (S3-lead-2). + */ + private static Map fieldToEnvTemplate() { + Map templates = new LinkedHashMap<>(); + collect(HttpClientPlatformSettings.class, "APP_HTTPCLIENT", "", 0, templates); + return templates; + } + + private static void collect( + Class type, String envPrefix, String pathPrefix, int listDepth, Map into) { + for (RecordComponent component : type.getRecordComponents()) { + String property = component.getName().replaceAll("([a-z0-9])([A-Z])", "$1-$2"); + property = property.toLowerCase(Locale.ROOT); + String path = pathPrefix.isEmpty() ? property : pathPrefix + "." + property; + String env = envPrefix + "_" + property.replace('-', '_').toUpperCase(Locale.ROOT); + Class componentType = component.getType(); + if (componentType.isRecord()) { + collect(componentType, env, path, listDepth, into); + continue; + } + if (List.class.isAssignableFrom(componentType)) { + String index = listDepth == 0 ? "N" : "M"; + Class element = + component.getGenericType() instanceof ParameterizedType parameterized + && parameterized.getActualTypeArguments()[0] instanceof Class resolved + ? resolved + : null; + if (element != null && element.isRecord()) { + collect(element, env + "_" + index, path + "[" + index + "]", listDepth + 1, into); + } else { + into.put(path + "[" + index + "]", env + "_" + index); + } + continue; + } + into.put(path, env); + } + } } diff --git a/src/adapter/outbound/httpclient/src/testFixtures/java/dev/caskeleton/adapter/outbound/httpclient/testkit/ClientProfiles.java b/src/adapter/outbound/httpclient/src/testFixtures/java/dev/caskeleton/adapter/outbound/httpclient/testkit/ClientProfiles.java index 2b27152a..f6407361 100644 --- a/src/adapter/outbound/httpclient/src/testFixtures/java/dev/caskeleton/adapter/outbound/httpclient/testkit/ClientProfiles.java +++ b/src/adapter/outbound/httpclient/src/testFixtures/java/dev/caskeleton/adapter/outbound/httpclient/testkit/ClientProfiles.java @@ -52,8 +52,7 @@ public final class ClientProfiles { Duration.ofSeconds(1), Duration.ofSeconds(2), Duration.ofSeconds(3), - Duration.ofSeconds(4), - Duration.ofSeconds(30)); + Duration.ofSeconds(4)); } public static ResponseLimits responseLimits() { @@ -110,8 +109,7 @@ public final class ClientProfiles { base.requestWriteIdle(), Duration.ofMillis(200), base.readIdle(), - totalCall, - base.streamingIdle())) + totalCall)) .build(); } diff --git a/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/MessagingConfig.java b/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/MessagingConfig.java index f2b3f624..283ab822 100644 --- a/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/MessagingConfig.java +++ b/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/MessagingConfig.java @@ -7,7 +7,6 @@ import dev.caskeleton.application.outbox.OutboxMessagePublishPort; import dev.caskeleton.application.outbox.OutboxRelayFailureReportPort; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -21,7 +20,6 @@ import org.springframework.context.annotation.Configuration; * was wanted, and nothing can publish. */ @Configuration -@EnableConfigurationProperties(MessagingSettings.class) public class MessagingConfig { /** The {@code dependency_name} the relay's failure log carries when no broker is named. */ diff --git a/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/MessagingSettings.java b/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/MessagingSettings.java index 8e06e28c..2cfd675c 100644 --- a/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/MessagingSettings.java +++ b/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/MessagingSettings.java @@ -1,17 +1,51 @@ package dev.caskeleton.adapter.outbound.messaging; -import org.springframework.boot.context.properties.ConfigurationProperties; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; +import java.util.Set; +import org.springframework.core.env.Environment; /** * The application bridge's own setting under {@code app.messaging}. * + *

    The tree is shared with the vendored {@code messaging:*} platform, which owns every other + * top-level entry and validates the inside of its own sections. The bridge binds the tree strictly + * except for those entries, so a misspelt top-level key — {@code app.messaging.prodcer-id}, {@code + * app.messaging.destinatons} — fails startup instead of binding nothing on either side. + * * @param producerId the explicit logical producing-service identity used by the canonical platform * bridge; blank means that bridge is not exposed */ -@ConfigurationProperties(prefix = "app.messaging") public record MessagingSettings(String producerId) { + /** The tree the bridge and the platform share. */ + static final String PREFIX = "app.messaging"; + + /** + * Top-level entries the vendored platform binds or reads. Its own validator checks inside them. + */ + static final Set PLATFORM_KEYS = + Set.of( + "enabled", + "broker", + "brokers", + "destinations", + "security", + "backpressure", + "shutdown", + "admin"); + public MessagingSettings { producerId = (producerId == null) ? "" : producerId.trim(); } + + /** + * Binds {@code app.messaging} strictly, leaving the platform's entries to the platform. + * + * @param environment the environment to bind from + * @return the bound settings + */ + public static MessagingSettings bind(Environment environment) { + return StrictSettingsBinder.bindExcept( + environment, PREFIX, MessagingSettings.class, PLATFORM_KEYS); + } } diff --git a/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingBridgeRootAutoConfiguration.java b/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingBridgeRootAutoConfiguration.java index 0de7505c..863fe1ad 100644 --- a/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingBridgeRootAutoConfiguration.java +++ b/src/adapter/outbound/messaging/src/main/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingBridgeRootAutoConfiguration.java @@ -11,11 +11,11 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Import; +import org.springframework.core.env.Environment; import org.springframework.core.type.AnnotatedTypeMetadata; import org.springframework.util.StringUtils; @@ -36,10 +36,20 @@ import org.springframework.util.StringUtils; name = "enabled", havingValue = "true", matchIfMissing = true) -@EnableConfigurationProperties(MessagingSettings.class) @Import(MessagingConfig.class) public class MessagingBridgeRootAutoConfiguration { + /** + * The bridge setting, bound strictly and only while the bridge is on. + * + * @param environment the environment to bind from + * @return the bound settings + */ + @Bean + MessagingSettings messagingBridgeSettings(Environment environment) { + return MessagingSettings.bind(environment); + } + /** * Connects canonical application integration events to the central messaging platform. * diff --git a/src/adapter/outbound/messaging/src/test/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingPlatformBridgeAutoConfigurationTest.java b/src/adapter/outbound/messaging/src/test/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingPlatformBridgeAutoConfigurationTest.java index c56aef1b..bc50447a 100644 --- a/src/adapter/outbound/messaging/src/test/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingPlatformBridgeAutoConfigurationTest.java +++ b/src/adapter/outbound/messaging/src/test/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingPlatformBridgeAutoConfigurationTest.java @@ -6,6 +6,7 @@ import dev.caskeleton.adapter.outbound.messaging.MessagingSettings; import dev.caskeleton.application.messaging.event.IntegrationEventPublishPort; import dev.caskeleton.application.outbox.OutboxMessagePublishPort; import dev.caskeleton.messaging.schema.EncodedMessagePublisher; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -75,6 +76,39 @@ class MessagingPlatformBridgeAutoConfigurationTest { .hasMessageContaining("no IntegrationEventPublishPort exists")); } + @Test + @DisplayName("app.messaging 최상위 오타 키는 기동을 실패시킨다") + void aMisspelledTopLevelMessagingKeyFailsStartup() { + // when + runner + .withPropertyValues( + "app.messaging.producer-id=portfolio-service", "app.messaging.prodcer-id=typo") + .run( + context -> { + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()).hasStackTraceContaining("prodcer-id"); + }); + } + + @Test + @DisplayName("플랫폼이 가진 app.messaging 하위 트리는 bridge가 거부하지 않는다") + void thePlatformsOwnSectionsAreLeftToThePlatform() { + // when + runner + .withPropertyValues( + "app.messaging.producer-id=portfolio-service", + "app.messaging.broker=kafka", + "app.messaging.brokers.kafka.type=kafka", + "app.messaging.backpressure.global-limit=64", + "app.messaging.admin.enabled=false") + .run( + context -> { + // then + assertThat(context).hasNotFailed(); + }); + } + @Test void switchedOffHoldsNothing() { new ApplicationContextRunner() diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationConfig.java index 23a21360..8918b370 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationConfig.java @@ -4,12 +4,14 @@ import dev.caskeleton.adapter.outbound.notification.core.FailOpenNotificationPro import dev.caskeleton.adapter.outbound.notification.core.NotificationProvider; import dev.caskeleton.adapter.outbound.notification.core.RoutingNotifier; import dev.caskeleton.adapter.outbound.support.FailOpenDependencyLogger; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import dev.caskeleton.application.notification.NotificationPort; import java.util.List; +import java.util.Set; import org.springframework.beans.factory.ObjectProvider; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; /** * Assembles the {@link RoutingNotifier} from every contributed {@link NotificationProvider} bean, @@ -23,9 +25,24 @@ import org.springframework.context.annotation.Configuration; * config cannot forget it. */ @Configuration -@EnableConfigurationProperties(NotificationRoutesSettings.class) public class NotificationConfig { + /** Keys under {@code app.notification} that another owner binds or reads. */ + private static final Set FOREIGN_KEYS = + Set.of("platform", "slack-webhook", "google-email"); + + /** + * The route table, bound strictly. + * + * @param environment the environment to bind from + * @return the bound routes + */ + @Bean + public NotificationRoutesSettings notificationRoutesSettings(Environment environment) { + return StrictSettingsBinder.bindExcept( + environment, "app.notification", NotificationRoutesSettings.class, FOREIGN_KEYS); + } + @Bean public NotificationPort notificationPort( ObjectProvider> providers, diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationRoutesSettings.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationRoutesSettings.java index 18b75473..d842044f 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationRoutesSettings.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationRoutesSettings.java @@ -4,7 +4,6 @@ import dev.caskeleton.adapter.outbound.notification.core.RoutingNotifier; import dev.caskeleton.application.notification.NotificationChannel; import java.util.List; import java.util.Map; -import org.springframework.boot.context.properties.ConfigurationProperties; /** * Routes binding for the multi-provider notification template: {@code @@ -18,9 +17,12 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * (every referenced providerId has an enabled provider) is validated fail-fast by {@link * RoutingNotifier} at construction time. * + *

    Bound strictly by {@link NotificationConfig}: a misspelt key under {@code app.notification} + * fails startup. The platform tree and the two R0 provider gates under the same prefix belong to + * their own owners and are left to them. + * * @param routes channel → (route → providerId list), default empty */ -@ConfigurationProperties(prefix = "app.notification") public record NotificationRoutesSettings( Map>> routes) { diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationActivationEnvironmentPostProcessor.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationActivationEnvironmentPostProcessor.java index c53e1541..634fac0b 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationActivationEnvironmentPostProcessor.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationActivationEnvironmentPostProcessor.java @@ -15,7 +15,7 @@ import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MapPropertySource; /** - * Makes an explicit {@code ca-skeleton.notification.platform.enabled=false} complete. + * Makes an explicit {@code app.notification.platform.enabled=false} complete. * *

    The platform's own configurations stand down on the switch, but Spring Boot's mail * auto-configurations arrive with this module's {@code spring-boot-starter-mail} and read no switch @@ -29,7 +29,7 @@ import org.springframework.core.env.MapPropertySource; */ class NotificationActivationEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { - static final String SWITCH = "ca-skeleton.notification.platform.enabled"; + static final String SWITCH = "app.notification.platform.enabled"; static final String EXCLUDE = "spring.autoconfigure.exclude"; diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationCallbackProviderConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationCallbackProviderConfig.java index f583615e..b9e7e7d6 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationCallbackProviderConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationCallbackProviderConfig.java @@ -25,7 +25,7 @@ import org.springframework.context.annotation.Configuration; /** Provider-side callback verification contributors. */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformAutoConfiguration.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformAutoConfiguration.java index 57921507..e26c345b 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformAutoConfiguration.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformAutoConfiguration.java @@ -1,12 +1,10 @@ package dev.caskeleton.adapter.outbound.notification.platform.autoconfigure; import dev.caskeleton.adapter.outbound.notification.NotificationConfig; -import dev.caskeleton.adapter.outbound.notification.NotificationRoutesSettings; import dev.caskeleton.adapter.outbound.notification.email.google.GoogleEmailNotificationAdapterConfig; import dev.caskeleton.adapter.outbound.notification.slack.webhook.SlackNotificationAdapterConfig; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Import; /** @@ -14,16 +12,15 @@ import org.springframework.context.annotation.Import; * *

    The reusable Notification leaf owns its Spring composition. The application composition root * only decides whether this artifact is present. Present means on; {@code - * ca-skeleton.notification.platform.enabled=false} turns it off, and {@link + * app.notification.platform.enabled=false} turns it off, and {@link * NotificationActivationEnvironmentPostProcessor} takes Boot's mail auto-configuration off with it. */ @AutoConfiguration @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) -@EnableConfigurationProperties(NotificationRoutesSettings.class) @Import({ NotificationPlatformCoreConfig.class, NotificationPlatformRuntimeConfig.class, diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCodecConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCodecConfig.java index 7a2cc17e..2faeaab7 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCodecConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCodecConfig.java @@ -37,7 +37,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCoreConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCoreConfig.java index cbc0aef1..43af6ee7 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCoreConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCoreConfig.java @@ -5,15 +5,17 @@ import dev.caskeleton.adapter.outbound.notification.platform.template.JacksonNot import dev.caskeleton.adapter.outbound.notification.platform.template.JsonSchemaVariableValidator; import dev.caskeleton.adapter.outbound.notification.platform.template.NotificationTemplateEngine; import dev.caskeleton.adapter.outbound.notification.platform.template.PlaceholderTemplateEngine; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import dev.caskeleton.application.notification.platform.dispatch.NotificationVariablesCodecPort; import dev.caskeleton.application.notification.platform.security.ContactPointProtector; import dev.caskeleton.application.notification.platform.security.SecretMaterialProvider; import dev.caskeleton.application.notification.platform.template.TemplateVariableValidator; +import java.util.Set; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; /** * Internal notification platform core wiring. @@ -23,14 +25,35 @@ import org.springframework.context.annotation.Configuration; * without keys would fail on the first delivery instead of at startup. */ @Configuration(proxyBeanMethods = false) -@EnableConfigurationProperties(NotificationPlatformSettings.class) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) class NotificationPlatformCoreConfig { + /** The platform tree. */ + static final String PREFIX = "app.notification.platform"; + + /** + * Keys under the platform tree that other settings bind ({@code smtp}, {@code secrets}) or the + * notification composition reads ({@code default-locale}). + */ + private static final Set FOREIGN_KEYS = Set.of("smtp", "secrets", "default-locale"); + + /** + * The platform settings, bound strictly: a misspelt key fails startup rather than leaving its + * default in force. + * + * @param environment the environment to bind from + * @return the bound settings + */ + @Bean + NotificationPlatformSettings notificationPlatformSettings(Environment environment) { + return StrictSettingsBinder.bindExcept( + environment, PREFIX, NotificationPlatformSettings.class, FOREIGN_KEYS); + } + /** Canonical variables codec. */ @Bean @ConditionalOnMissingBean diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformDispatchConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformDispatchConfig.java index 50b409b6..d12aab0c 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformDispatchConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformDispatchConfig.java @@ -35,7 +35,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformObservabilityConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformObservabilityConfig.java index ee2fb263..70b102fe 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformObservabilityConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformObservabilityConfig.java @@ -33,7 +33,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformPolicyConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformPolicyConfig.java index 6c1d162c..d0fafbf6 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformPolicyConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformPolicyConfig.java @@ -40,7 +40,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformProviderConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformProviderConfig.java index fe86317a..692e1fe6 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformProviderConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformProviderConfig.java @@ -34,7 +34,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRegistriesConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRegistriesConfig.java index 229aaeef..0c0b7e23 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRegistriesConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRegistriesConfig.java @@ -21,7 +21,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRuntimeConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRuntimeConfig.java index 07d60557..7c692b3c 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRuntimeConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRuntimeConfig.java @@ -22,7 +22,7 @@ import org.springframework.context.annotation.Import; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSecretsConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSecretsConfig.java index 2aa67b31..cd0c0da9 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSecretsConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSecretsConfig.java @@ -3,6 +3,7 @@ package dev.caskeleton.adapter.outbound.notification.platform.autoconfigure; import dev.caskeleton.adapter.outbound.notification.platform.security.ProviderCredentialManager; import dev.caskeleton.adapter.outbound.notification.platform.security.SettingsSecretMaterialProvider; import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import dev.caskeleton.application.notification.platform.security.SecretKeyMaterial; import dev.caskeleton.application.notification.platform.security.SecretMaterialProvider; import dev.caskeleton.application.notification.platform.security.SecretPurpose; @@ -14,10 +15,9 @@ import java.util.Objects; import java.util.Set; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; /** * Key material for the notification platform. @@ -52,15 +52,13 @@ import org.springframework.context.annotation.Configuration; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) -@EnableConfigurationProperties(NotificationPlatformSecretsConfig.NotificationSecretsSettings.class) class NotificationPlatformSecretsConfig { /** Base64 key material bound from the environment. */ - @ConfigurationProperties("ca-skeleton.notification.platform.secrets") public record NotificationSecretsSettings( String contactEncryptionKey, String contactLookupHmacKey, @@ -85,6 +83,21 @@ class NotificationPlatformSecretsConfig { } } + /** + * The key material, bound strictly: a misspelt key name would otherwise leave that purpose + * without its key until the first message that needs it. + * + * @param environment the environment to bind from + * @return the bound key material + */ + @Bean + NotificationSecretsSettings notificationSecretsSettings(Environment environment) { + return StrictSettingsBinder.bind( + environment, + NotificationPlatformCoreConfig.PREFIX + ".secrets", + NotificationSecretsSettings.class); + } + /** * Secret provider assembled from the bound settings. * diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSettings.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSettings.java index f9e2014d..d6ac50d5 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSettings.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSettings.java @@ -5,7 +5,6 @@ import java.time.Duration; import java.util.List; import java.util.Map; import java.util.Objects; -import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.bind.ConstructorBinding; import org.springframework.boot.context.properties.bind.DefaultValue; @@ -17,7 +16,6 @@ import org.springframework.boot.context.properties.bind.DefaultValue; * value may be "unlimited", because an unbounded queue or payload is a resource failure waiting for * the first burst. */ -@ConfigurationProperties("ca-skeleton.notification.platform") public record NotificationPlatformSettings( boolean enabled, NotificationPlatformMode mode, @@ -74,8 +72,7 @@ public record NotificationPlatformSettings( Objects.requireNonNull(shutdownGrace, "shutdownGrace"); if (claimBatchSize < 1 || claimBatchSize > MAX_CLAIM_BATCH) { throw new IllegalArgumentException( - "ca-skeleton.notification.platform.dispatch.claim-batch-size must be 1.." - + MAX_CLAIM_BATCH); + "app.notification.platform.dispatch.claim-batch-size must be 1.." + MAX_CLAIM_BATCH); } if (maxGlobalConcurrency < 1) { throw new IllegalArgumentException("max-global-concurrency must be positive"); diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformWorkerConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformWorkerConfig.java index 2de2169d..c7d75608 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformWorkerConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformWorkerConfig.java @@ -33,7 +33,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) @@ -110,7 +110,7 @@ class NotificationPlatformWorkerConfig { */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "mode", havingValue = "SERVING", matchIfMissing = true) diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationProviderAssembly.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationProviderAssembly.java index 5d57a7c6..d6000da5 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationProviderAssembly.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationProviderAssembly.java @@ -239,7 +239,7 @@ public final class NotificationProviderAssembly { throw new IllegalStateException( "the notification platform is enabled with no assembled provider. Every request would be" + " accepted durably and then find no eligible route. Configure a provider, or" - + " declare ca-skeleton.notification.platform.mode=INGEST_ONLY so readiness reports" + + " declare app.notification.platform.mode=INGEST_ONLY so readiness reports" + " non-serving."); } } diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationSmtpProviderConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationSmtpProviderConfig.java index 1addd45e..5281db1e 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationSmtpProviderConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationSmtpProviderConfig.java @@ -5,6 +5,7 @@ import dev.caskeleton.adapter.outbound.notification.platform.provider.smtp.SmtpD import dev.caskeleton.adapter.outbound.notification.platform.provider.smtp.SmtpFailureClassifier; import dev.caskeleton.adapter.outbound.notification.platform.provider.smtp.SmtpMimeMessageFactory; import dev.caskeleton.adapter.outbound.notification.platform.provider.smtp.SmtpProviderProperties; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import dev.caskeleton.application.notification.platform.dispatch.AttachmentIntegrityGuard; import dev.caskeleton.application.notification.platform.security.ContactPointProtector; import jakarta.mail.Session; @@ -17,9 +18,9 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl; @@ -57,9 +58,20 @@ import org.springframework.mail.javamail.JavaMailSenderImpl; // owns // is the narrower question: is a relay configured at all. @ConditionalOnProperty(name = "spring.mail.host") -@EnableConfigurationProperties(NotificationSmtpSettings.class) public class NotificationSmtpProviderConfig { + /** + * The SMTP settings, bound strictly. + * + * @param environment the environment to bind from + * @return the bound settings + */ + @Bean + NotificationSmtpSettings notificationSmtpSettings(Environment environment) { + return StrictSettingsBinder.bind( + environment, NotificationSmtpSettings.PREFIX, NotificationSmtpSettings.class); + } + /** The send itself, over the mail sender Spring configured. */ @Bean @ConditionalOnMissingBean @@ -105,10 +117,10 @@ public class NotificationSmtpProviderConfig { ThreadPoolExecutor executor = new ThreadPoolExecutor( 1, - settings.maxConcurrency(), + settings.dispatchConcurrency(), 60L, TimeUnit.SECONDS, - new LinkedBlockingQueue<>(settings.maxConcurrency() * 4), + new LinkedBlockingQueue<>(settings.dispatchConcurrency() * 4), runnable -> { Thread thread = new Thread(runnable, "notification-smtp"); thread.setDaemon(true); @@ -195,7 +207,7 @@ public class NotificationSmtpProviderConfig { connectTimeout, readTimeout, writeTimeout, - settings.maxConcurrency()); + settings.dispatchConcurrency()); } private static SmtpProviderProperties.TlsMode requiredTlsMode(Properties mail) { diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationSmtpSettings.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationSmtpSettings.java index 2637e912..62dbcf77 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationSmtpSettings.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationSmtpSettings.java @@ -1,24 +1,32 @@ package dev.caskeleton.adapter.outbound.notification.platform.autoconfigure; import java.util.Objects; -import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.bind.DefaultValue; /** - * Notification-specific SMTP settings that Spring Mail does not own. + * Notification-specific SMTP settings that Spring Mail does not own, bound strictly at {@code + * app.notification.platform.smtp} by {@link NotificationSmtpProviderConfig}. * *

    The relay address, credentials, TLS policy and socket timeouts belong exclusively to {@code * spring.mail.*}. Duplicating those values under this prefix lets validation succeed against one * relay description while the actual {@code JavaMailSender} uses another. The SMTP assembly * validates the sender's effective JavaMail properties instead. * + *

    The dispatch pool size is {@code dispatch-concurrency}, the name its environment variable + * {@code APP_NOTIFICATION_PLATFORM_SMTP_DISPATCH_CONCURRENCY} always had. It was {@code + * max-concurrency}, and under the {@code app} root that property's environment spelling is {@code + * APP_NOTIFICATION_PLATFORM_SMTP_MAX_CONCURRENCY} — the variable that sets the SMTP provider + * profile's in-flight limit. One variable would have set both. + * * @param senderIdentity the envelope sender every message is sent as - * @param maxConcurrency how many sends may run at once + * @param dispatchConcurrency how many sends may run at once */ -@ConfigurationProperties("ca-skeleton.notification.platform.smtp") public record NotificationSmtpSettings( @DefaultValue("no-reply@example.invalid") String senderIdentity, - @DefaultValue("4") int maxConcurrency) { + @DefaultValue("4") int dispatchConcurrency) { + + /** The settings tree. */ + static final String PREFIX = "app.notification.platform.smtp"; public NotificationSmtpSettings { Objects.requireNonNull(senderIdentity, "senderIdentity"); @@ -26,12 +34,10 @@ public record NotificationSmtpSettings( // by RFC 2606 and resolves nowhere, so a deployment that forgot to set one gets a bounce it can // trace rather than mail that appears to come from a real address it does not own. if (senderIdentity.isBlank() || senderIdentity.indexOf('@') <= 0) { - throw new IllegalArgumentException( - "ca-skeleton.notification.platform.smtp.sender-identity must be an email address"); + throw new IllegalArgumentException(PREFIX + ".sender-identity must be an email address"); } - if (maxConcurrency < 1) { - throw new IllegalArgumentException( - "ca-skeleton.notification.platform.smtp.max-concurrency must be at least 1"); + if (dispatchConcurrency < 1) { + throw new IllegalArgumentException(PREFIX + ".dispatch-concurrency must be at least 1"); } } } diff --git a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationLegacyNamespaceRetirementTest.java b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationLegacyNamespaceRetirementTest.java index 3af91f4a..648a1393 100644 --- a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationLegacyNamespaceRetirementTest.java +++ b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationLegacyNamespaceRetirementTest.java @@ -17,8 +17,8 @@ import org.junit.jupiter.api.Test; * *

    The legacy R0 selectors live under {@code app.notification.*} — {@code slack-webhook.enabled}, * {@code google-email.enabled}, {@code routes..} — while the delivery platform - * lives under {@code ca-skeleton.notification.platform.*}. Both are reachable from the same master - * switch, so a deployment that turns notification on is configuring one capability through two + * lives under {@code app.notification.platform.*}. Both are reachable from the same master switch, + * so a deployment that turns notification on is configuring one capability through two * vocabularies, neither of which validates the other. * *

    What decides the sequence: R0 has real {@code NotificationProvider} implementations and @@ -48,7 +48,7 @@ class NotificationLegacyNamespaceRetirementTest { assertThat(legacySelectors) .as( - "app.notification.* is the R0 vocabulary; ca-skeleton.notification.platform.* is the " + "app.notification.* is the R0 vocabulary; app.notification.platform.* is the " + "canonical one. Two vocabularies for one capability, and neither validates the " + "other") .isNotEmpty(); diff --git a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCoreConfigurationTest.java b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCoreConfigurationTest.java index 967da7fe..a95f7e96 100644 --- a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCoreConfigurationTest.java +++ b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformCoreConfigurationTest.java @@ -12,6 +12,7 @@ import dev.caskeleton.application.notification.platform.security.SecretMaterialP import dev.caskeleton.application.notification.platform.security.SecretPurpose; import dev.caskeleton.application.notification.platform.template.TemplateVariableValidator; import java.util.Arrays; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; @@ -32,7 +33,7 @@ class NotificationPlatformCoreConfigurationTest { @Test void thePlatformContributesNothingWhenExplicitlyDisabled() { runner - .withPropertyValues("ca-skeleton.notification.platform.enabled=false") + .withPropertyValues("app.notification.platform.enabled=false") .run( context -> { assertThat(context).hasNotFailed(); @@ -46,17 +47,35 @@ class NotificationPlatformCoreConfigurationTest { } @Test - void aLegacyTemplateEnginePropertyCannotEnableExpressionEvaluation() { + @DisplayName("app.notification.platform 아래 오타 키는 기동을 실패시킨다") + void aMisspelledPlatformKeyFailsStartup() { + // when enabled() - .withPropertyValues("ca-skeleton.notification.platform.template.engine=thymeleaf") + .withPropertyValues("app.notification.platform.dispatch.pol-interval=1s") .run( context -> { - assertThat(context).hasSingleBean(NotificationTemplateEngine.class); - assertThat(context.getBean(NotificationTemplateEngine.class)) - .isInstanceOf(PlaceholderTemplateEngine.class); + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()).hasStackTraceContaining("pol-interval"); }); } + @Test + void aLegacyTemplateEnginePropertyCannotEnableExpressionEvaluation() { + // The engine is not selectable; the only one is the placeholder engine. The retired selector + // is now refused outright by strict binding rather than quietly ignored. + enabled() + .run( + context -> + assertThat(context.getBean(NotificationTemplateEngine.class)) + .isInstanceOf(PlaceholderTemplateEngine.class)); + enabled() + .withPropertyValues("app.notification.platform.template.engine=thymeleaf") + .run( + context -> + assertThat(context.getStartupFailure()).hasStackTraceContaining("template.engine")); + } + @Test void contactPointProtectionIsUnconditionalAndFailsLoudlyWithoutKeyMaterial() { // Was "appears only once key material exists", asserted by loading this configuration with no @@ -82,7 +101,7 @@ class NotificationPlatformCoreConfigurationTest { }); runner - .withPropertyValues("ca-skeleton.notification.platform.enabled=true") + .withPropertyValues("app.notification.platform.enabled=true") .run( context -> assertThat(context) @@ -101,13 +120,13 @@ class NotificationPlatformCoreConfigurationTest { void anSesProfileWithoutItsSesBlockFailsStartup() { enabled() .withPropertyValues( - "ca-skeleton.notification.platform.providers.mail.type=SES", - "ca-skeleton.notification.platform.providers.mail.enabled=true", - "ca-skeleton.notification.platform.providers.mail.environment=PRODUCTION", - "ca-skeleton.notification.platform.providers.mail.credential-profile=default", - "ca-skeleton.notification.platform.providers.mail.timeout=5s", - "ca-skeleton.notification.platform.providers.mail.max-concurrency=4", - "ca-skeleton.notification.platform.providers.mail.rate-per-second=10") + "app.notification.platform.providers.mail.type=SES", + "app.notification.platform.providers.mail.enabled=true", + "app.notification.platform.providers.mail.environment=PRODUCTION", + "app.notification.platform.providers.mail.credential-profile=default", + "app.notification.platform.providers.mail.timeout=5s", + "app.notification.platform.providers.mail.max-concurrency=4", + "app.notification.platform.providers.mail.rate-per-second=10") .run( context -> // The validation failure is wrapped by the binder, so assert on the whole chain. @@ -118,13 +137,13 @@ class NotificationPlatformCoreConfigurationTest { void ambiguousFallbackCannotBeTurnedOnByConfiguration() { enabled() .withPropertyValues( - "ca-skeleton.notification.platform.dispatch.allow-ambiguous-fallback=true", - "ca-skeleton.notification.platform.dispatch.claim-batch-size=100", - "ca-skeleton.notification.platform.dispatch.lease-duration=30s", - "ca-skeleton.notification.platform.dispatch.poll-interval=250ms", - "ca-skeleton.notification.platform.dispatch.max-global-concurrency=8", - "ca-skeleton.notification.platform.dispatch.max-additional-attempts=3", - "ca-skeleton.notification.platform.dispatch.max-queue-age=1h") + "app.notification.platform.dispatch.allow-ambiguous-fallback=true", + "app.notification.platform.dispatch.claim-batch-size=100", + "app.notification.platform.dispatch.lease-duration=30s", + "app.notification.platform.dispatch.poll-interval=250ms", + "app.notification.platform.dispatch.max-global-concurrency=8", + "app.notification.platform.dispatch.max-additional-attempts=3", + "app.notification.platform.dispatch.max-queue-age=1h") .run( context -> assertThat(context) @@ -136,12 +155,12 @@ class NotificationPlatformCoreConfigurationTest { void anUnboundedClaimBatchIsRefusedAtStartup() { enabled() .withPropertyValues( - "ca-skeleton.notification.platform.dispatch.claim-batch-size=100000", - "ca-skeleton.notification.platform.dispatch.lease-duration=30s", - "ca-skeleton.notification.platform.dispatch.poll-interval=250ms", - "ca-skeleton.notification.platform.dispatch.max-global-concurrency=8", - "ca-skeleton.notification.platform.dispatch.max-additional-attempts=3", - "ca-skeleton.notification.platform.dispatch.max-queue-age=1h") + "app.notification.platform.dispatch.claim-batch-size=100000", + "app.notification.platform.dispatch.lease-duration=30s", + "app.notification.platform.dispatch.poll-interval=250ms", + "app.notification.platform.dispatch.max-global-concurrency=8", + "app.notification.platform.dispatch.max-additional-attempts=3", + "app.notification.platform.dispatch.max-queue-age=1h") .run( context -> assertThat(context).getFailure().hasStackTraceContaining("claim-batch-size")); @@ -160,7 +179,7 @@ class NotificationPlatformCoreConfigurationTest { */ private ApplicationContextRunner enabled() { return runner - .withPropertyValues("ca-skeleton.notification.platform.enabled=true") + .withPropertyValues("app.notification.platform.enabled=true") .withUserConfiguration(SecretsConfiguration.class); } diff --git a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSettingsTest.java b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSettingsTest.java index af5c56ce..05182ad6 100644 --- a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSettingsTest.java +++ b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformSettingsTest.java @@ -67,7 +67,7 @@ class NotificationPlatformSettingsTest { // given Map properties = sesWithCallbacksEnabled(); properties.put( - "ca-skeleton.notification.platform.providers.ses.ses.allowed-topic-arns", + "app.notification.platform.providers.ses.ses.allowed-topic-arns", "arn:aws:sns:us-east-1:123456789012:ses-events,arn:aws:sns:eu-west-1:123456789012:ses-eu"); // when @@ -153,13 +153,13 @@ class NotificationPlatformSettingsTest { private static NotificationPlatformSettings bind(Map properties) { return new Binder(new MapConfigurationPropertySource(properties)) - .bind("ca-skeleton.notification.platform", NotificationPlatformSettings.class) + .bind("app.notification.platform", NotificationPlatformSettings.class) .get(); } /** An enabled SES profile with callbacks on, complete except for the topic allowlist. */ private static Map sesWithCallbacksEnabled() { - String prefix = "ca-skeleton.notification.platform."; + String prefix = "app.notification.platform."; Map properties = new HashMap<>(); properties.put(prefix + "enabled", "true"); properties.put(prefix + "callbacks.enabled", "true"); diff --git a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationWorkerLifecycleTest.java b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationWorkerLifecycleTest.java index a7766202..27929bf1 100644 --- a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationWorkerLifecycleTest.java +++ b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationWorkerLifecycleTest.java @@ -50,7 +50,7 @@ class NotificationWorkerLifecycleTest { + "INGEST_ONLY delivers", beanMethod) .isNotNull(); - assertThat(condition.prefix()).isEqualTo("ca-skeleton.notification.platform"); + assertThat(condition.prefix()).isEqualTo("app.notification.platform"); assertThat(condition.name()).containsExactly("mode"); assertThat(condition.havingValue()).isEqualTo("SERVING"); assertThat(condition.matchIfMissing()) diff --git a/src/adapter/outbound/objectstorage/CLAUDE.md b/src/adapter/outbound/objectstorage/CLAUDE.md index 20d6b59a..973d3a8f 100644 --- a/src/adapter/outbound/objectstorage/CLAUDE.md +++ b/src/adapter/outbound/objectstorage/CLAUDE.md @@ -26,9 +26,10 @@ readiness live in [README.md](README.md) and - Project dependencies are exactly those allowed by the `adapter-outbound-objectstorage` entry in `src/config/architecture/modules.json`; currently application-core, shared-contract, - application-objectstorage and the registered support edge (`adapter:outbound:support`, whose - descriptor-based `SecureFileAccess`/`SecureDirectoryWalk` every local-dev file access goes - through). + application-objectstorage and the registered support edge (`adapter:outbound:support`: its + descriptor-based `SecureFileAccess`/`SecureDirectoryWalk`, which every local-dev file access goes + through, and `StrictSettingsBinder` — the `app.object-storage` tree is bound strictly, environment + included, capability rule 4). - Provider SDK/configuration types stay within this leaf. - Provider contributions may describe support without side effects and may construct resources only after exact selection. diff --git a/src/adapter/outbound/objectstorage/build.gradle b/src/adapter/outbound/objectstorage/build.gradle index 59a587f2..313b706f 100644 --- a/src/adapter/outbound/objectstorage/build.gradle +++ b/src/adapter/outbound/objectstorage/build.gradle @@ -53,7 +53,8 @@ dependencies { implementation project(':application-objectstorage') implementation project(':shared-contract') // The local-development provider opens, publishes and deletes through directory descriptors - // (SecureFileAccess / SecureDirectoryWalk), the one primitive fileserver uses too (S4-lead-2). + // (SecureFileAccess / SecureDirectoryWalk), the one primitive fileserver uses too (S4-lead-2), + // and StrictSettingsBinder binds app.object-storage strictly, env included (capability rule 4). implementation project(':adapter:outbound:support') implementation 'org.springframework.boot:spring-boot-autoconfigure' diff --git a/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilityConfig.java b/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilityConfig.java index a6da14a3..78941106 100644 --- a/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilityConfig.java +++ b/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilityConfig.java @@ -13,16 +13,30 @@ import java.util.Set; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; /** Disabled-by-default canonical composition root for normal object-storage semantic ports. */ @Configuration(proxyBeanMethods = false) -@EnableConfigurationProperties(ObjectStorageCapabilitySettings.class) public class ObjectStorageCapabilityConfig { + /** + * The capability settings, bound strictly and only while the capability is on. + * + * @param environment the environment to bind from + * @return the bound settings + */ + @Bean + @ConditionalOnProperty( + prefix = "app.object-storage", + name = "enabled", + havingValue = "true", + matchIfMissing = true) + public ObjectStorageCapabilitySettings objectStorageCapabilitySettings(Environment environment) { + return ObjectStorageCapabilitySettings.bind(environment); + } + @Bean @ConditionalOnProperty( prefix = "app.object-storage", diff --git a/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilitySettings.java b/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilitySettings.java index bd5efbce..015259ab 100644 --- a/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilitySettings.java +++ b/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilitySettings.java @@ -1,29 +1,52 @@ package dev.caskeleton.adapter.outbound.objectstorage.config; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; +import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; -import org.springframework.boot.context.properties.ConfigurationProperties; +import java.util.Set; import org.springframework.boot.context.properties.bind.DefaultValue; +import org.springframework.core.env.Environment; /** * Canonical constructor-bound object-storage capability declaration. On when the module is present; * {@code enabled=false} turns the canonical capability off. + * + *

    Bound strictly ({@link #bind}) by {@link ObjectStorageCapabilityConfig} while the capability + * is on: a misspelt key under {@code app.object-storage} — in a file or as an {@code + * APP_OBJECT_STORAGE_*} variable — fails startup instead of leaving a provider or destination + * silently unconfigured. {@code scan-maintenance} is the scanner workflow's own switch and is left + * to {@link ObjectStorageScanMaintenanceConfig}. */ -@ConfigurationProperties(prefix = "app.object-storage") public record ObjectStorageCapabilitySettings( @DefaultValue("true") boolean enabled, String defaultDestination, Map providers, Map destinations) { + /** The settings tree. */ + static final String PREFIX = "app.object-storage"; + + /** Keys under the tree that another configuration reads. */ + static final Set FOREIGN_KEYS = Set.of("scan-maintenance"); + public ObjectStorageCapabilitySettings { providers = - providers == null - ? Map.of() - : java.util.Collections.unmodifiableMap(new LinkedHashMap<>(providers)); + providers == null ? Map.of() : Collections.unmodifiableMap(new LinkedHashMap<>(providers)); destinations = destinations == null ? Map.of() - : java.util.Collections.unmodifiableMap(new LinkedHashMap<>(destinations)); + : Collections.unmodifiableMap(new LinkedHashMap<>(destinations)); + } + + /** + * Binds {@link #PREFIX} strictly. + * + * @param environment the environment to bind from + * @return the bound settings + */ + static ObjectStorageCapabilitySettings bind(Environment environment) { + return StrictSettingsBinder.bindExcept( + environment, PREFIX, ObjectStorageCapabilitySettings.class, FOREIGN_KEYS); } } diff --git a/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilityConfigTest.java b/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilityConfigTest.java index 6d1dc1a0..fb832749 100644 --- a/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilityConfigTest.java +++ b/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/config/ObjectStorageCapabilityConfigTest.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -53,6 +54,25 @@ class ObjectStorageCapabilityConfigTest { }); } + @Test + @DisplayName("app.object-storage 아래 오타 키는 기동을 실패시킨다") + void aMisspelledObjectStorageKeyFailsStartup() { + // given + Path providerRoot = root.resolve("typo"); + + // when + new ApplicationContextRunner() + .withUserConfiguration(ObjectStorageCapabilityConfig.class) + .withPropertyValues(providerProperties(providerRoot, true)) + .withPropertyValues("app.object-storage.default-destinaton=poster") + .run( + context -> { + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()).hasStackTraceContaining("default-destinaton"); + }); + } + @Test void explicitLocalBindingCreatesOnlyNormalSemanticPorts() { Path providerRoot = root.resolve("selected"); diff --git a/src/adapter/outbound/persistence-jpa/CLAUDE.md b/src/adapter/outbound/persistence-jpa/CLAUDE.md index 5f49dc73..9417ed80 100644 --- a/src/adapter/outbound/persistence-jpa/CLAUDE.md +++ b/src/adapter/outbound/persistence-jpa/CLAUDE.md @@ -52,7 +52,7 @@ The entry points and the test that proves each one are listed in [README.md](REA `META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports` publishes two package-private entries: `PersistenceJpaAutoConfiguration` and `PersistenceJpaRuntimeConfig`. Because Boot loads those candidates independently, **both** require -`ca-skeleton.persistence-jpa.enabled=true`. The first owns vendor/entity/repository and +`app.persistence-jpa.enabled=true`. The first owns vendor/entity/repository and capability-store imports. The second contributes only the provider runtime beans (`HibernateProviderPolicy`, `PostgreSqlRuntimeRoleVerifier`). The transaction engine is `SpringTransaction` alone; the second engine @@ -66,11 +66,11 @@ to `spring.autoconfigure.exclude`, so no DataSource, pool, EntityManagerFactory The same split applies to owner-safe PostgreSQL idempotency: this leaf constructs the concrete PostgreSQL store behind `IdempotencyStorePort` (`PostgreSqlIdempotencyStoreConfig`, active only with -`ca-skeleton.capabilities.idempotency.provider=postgresql`), while `composition:idempotency` owns provider +`app.capabilities.idempotency.provider=postgresql`), while `composition:idempotency` owns provider selection, TTL/lease/codec policy, executor construction, and exclusivity validation. With that provider the leaf also applies the `db/migration/jpa/core` + `db/migration/jpa/idempotency` Flyway streams and activates the capability registry row at startup (`IdempotencySchemaStream`, skipped -when `ca-skeleton.runtime.migration-on-startup=false`), refuses a non-PostgreSQL data source, and +when `app.runtime.migration-on-startup=false`), refuses a non-PostgreSQL data source, and runs `IdempotencyReaper`. There is no V1/JDBC idempotency store and no `jdbc` provider value. This module is a capability selected by one build line (`runtimeOnly @@ -150,8 +150,8 @@ two SPI beans (outbox claim, SQLState mapping): | Vendor | Package | Selected by | Schema owner | | --- | --- | --- | --- | -| PostgreSQL | `.postgresql` | `ca-skeleton.persistence.vendor=postgresql` (also the default) | Flyway, `db/migration/postgresql` | -| H2 | `.h2` | `ca-skeleton.persistence.vendor=h2` | Hibernate `ddl-auto`, entities only | +| PostgreSQL | `.postgresql` | `app.persistence.vendor=postgresql` (also the default) | Flyway, `db/migration/postgresql` | +| H2 | `.h2` | `app.persistence.vendor=h2` | Hibernate `ddl-auto`, entities only | The outbox and idempotency features keep their pieces together, by feature and then by vendor: `outbox/{jpa,postgresql,h2}` and `idempotency/{jpa,postgresql}`. The vendor configurations above still diff --git a/src/adapter/outbound/persistence-jpa/README.md b/src/adapter/outbound/persistence-jpa/README.md index bbc806bc..c6e775f6 100644 --- a/src/adapter/outbound/persistence-jpa/README.md +++ b/src/adapter/outbound/persistence-jpa/README.md @@ -36,8 +36,8 @@ bean과 함께 Boot의 JDBC·Hibernate·Spring Data JPA·Flyway 자동 설정도 readiness 그룹에 `db` 추가, 꺼져 있으면 Boot의 `jdbc`·`hibernate`·`data.jpa`·`flyway` 자동 설정 패키지를 `spring.autoconfigure.exclude`에 추가(기존 값은 유지). - 기본 설정 `config/module-defaults/persistence-jpa.yml`(`spring.datasource/flyway/jpa`, - `ca-skeleton.persistence*`, `ca-skeleton.lock.*`, `ca-skeleton.outbox.*`, - `ca-skeleton.realtime.replay.*`, `ca-skeleton.runtime.migration-on-startup`). support 모듈의 + `app.persistence*`, `app.lock.*`, `app.outbox.*`, + `app.realtime.replay.*`, `app.runtime.migration-on-startup`). support 모듈의 `ModuleDefaultsEnvironmentPostProcessor`가 가장 낮은 우선순위로 읽으므로 애플리케이션 설정과 환경변수가 언제나 이긴다. @@ -203,7 +203,7 @@ failure translation contract 다. 여기서는 SPI 구조와 fallback 근거만 ## idempotency — PostgreSQL provider -`ca-skeleton.capabilities.idempotency.provider=postgresql` 일 때만 켜진다 +`app.capabilities.idempotency.provider=postgresql` 일 때만 켜진다 (`autoconfigure/PostgreSqlIdempotencyStoreConfig`). 이 leaf 는 `IdempotencyStorePort` 구현 (`PostgreSqlIdempotencyStore`) 하나만 내놓고, executor 는 app-bootstrap `IdempotencyProviderSelectionConfig` 가 만든다. V1 JDBC store 와 `jdbc` provider 값은 없다. @@ -212,7 +212,7 @@ failure translation contract 다. 여기서는 SPI 구조와 fallback 근거만 owner-safe 컬럼은 `db/migration/jpa/idempotency` stream 이 소유한다. 기동 시 `IdempotencySchemaStream` 이 `db/migration/jpa/core` → `db/migration/jpa/idempotency` 순서로 적용하고 capability registry 행을 `ACTIVE` 로 올린다. 알림 capability 의 - `NotificationSchemaStream` 과 같은 방식이다. `ca-skeleton.runtime.migration-on-startup=false` + `NotificationSchemaStream` 과 같은 방식이다. `app.runtime.migration-on-startup=false` 면 건너뛰고, 운영자가 적용·활성화할 때까지 store 가 fail closed 한다. - **PostgreSQL 전용**: data source 가 PostgreSQL 이 아니면 기동을 거부한다. `bootRunH2` 는 provider 를 `disabled` 나 `redis` 로 둔다. @@ -226,7 +226,7 @@ failure translation contract 다. 여기서는 SPI 구조와 fallback 근거만 스키마는 Flyway(`V3__outbox_event.sql`)가 소유하고, `V13__outbox_canonical_transport_compatibility.sql`이 canonical metadata와 exact `BYTEA envelope_bytes`를 더했다. append 모델은 canonical 하나다(2026-09-28, 소유자 결정 7): `JpaOutboxStore`가 `OutboxAppendPort`(`ValidatedIntegrationEvent`)와 -`OutboxStorePort`를 함께 구현하고, `ca-skeleton.outbox.enabled=true`일 때만 존재한다. row는 validated +`OutboxStorePort`를 함께 구현하고, `app.outbox.enabled=true`일 때만 존재한다. row는 validated event의 exact envelope bytes와 hash를 저장하고, claim은 그 bytes로 같은 event를 복원한다 (`ClaimedOutboxEvent`). `event_type`·`aggregate_id`·`correlation_id`는 claim gate와 metrics query를 위해 contract id·aggregate id·correlation id를 한 번 더 적는다. @@ -462,7 +462,7 @@ provider 선택표(flag → bean → registry)의 SSOT 는 CLAUDE.md(또는 app- `DistributedLock.tryLock(waitTime, leaseTtl)` 로 전달한다. ### `LockSettings` -`ca-skeleton.lock.*` 에서 바인딩되는 yaml-only 기본값이다(`config/module-defaults/persistence-jpa.yml`). +`app.lock.*` 에서 바인딩되는 yaml-only 기본값이다(`config/module-defaults/persistence-jpa.yml`). 새 `APP_*` env 키가 아니므로 `env-keys.yaml` 엔트리가 필요 없다. `DistributedLockPersistenceConfig`의 `@EnableConfigurationProperties`가 바인딩한다. cross-field invariant: `leaseTtl >= waitTime` 이어야 한다 — TTL 이 waitTime 보다 먼저 만료되면 첫 holder 의 보호작업이 끝나기 전에 두 번째 @@ -494,7 +494,7 @@ holder 가 락을 잡을 수 있다. ## startup — 관계형 기동 정책 (app-bootstrap에서 이동) -`JpaStartupAutoConfiguration`(package-private, 모듈 스위치 `ca-skeleton.persistence-jpa.enabled` +`JpaStartupAutoConfiguration`(package-private, 모듈 스위치 `app.persistence-jpa.enabled` 아래)이 아래 가드를 등록한다. 전부 `adapter:outbound:support`의 `StartupFailures`로 실패하므로 exit 코드(78/70/71)와 구조화 로그 필드(`startup.phase`/`error.code`/`error.category`)는 옮기기 전과 같다. `migrationStartupRunner`는 `@ConditionalOnMissingBean(FlywayMigrationStrategy)`라, 자기 전략을 둔 diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/JpaAdapterBeansConfig.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/JpaAdapterBeansConfig.java index 9c52ff03..b7820b6a 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/JpaAdapterBeansConfig.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/JpaAdapterBeansConfig.java @@ -16,6 +16,7 @@ import dev.caskeleton.adapter.outbound.persistence.outbox.jpa.OutboxClaimReposit import dev.caskeleton.adapter.outbound.persistence.outbox.jpa.OutboxEventJpaRepository; import dev.caskeleton.adapter.outbound.persistence.outbox.jpa.OutboxReaper; import dev.caskeleton.adapter.outbound.persistence.transaction.SpringTransaction; +import dev.caskeleton.adapter.outbound.support.CapabilitySelectors; import dev.caskeleton.shared.concurrency.DomainContextPropagator; import java.time.Clock; import java.time.Duration; @@ -88,7 +89,7 @@ class JpaAdapterBeansConfig { * repository comes from the vendor configuration (PostgreSQL or H2). */ @Configuration(proxyBeanMethods = false) - @ConditionalOnProperty(prefix = "ca-skeleton.outbox", name = "enabled", havingValue = "true") + @ConditionalOnProperty(prefix = "app.outbox", name = "enabled", havingValue = "true") static class Outbox { @Bean @@ -103,7 +104,7 @@ class JpaAdapterBeansConfig { OutboxReaper outboxReaper( OutboxEventJpaRepository repository, Clock clock, - @Value("${ca-skeleton.outbox.published-retention:P7D}") Duration retention) { + @Value("${app.outbox.published-retention:P7D}") Duration retention) { return new OutboxReaper(repository, clock, retention); } } @@ -114,12 +115,9 @@ class JpaAdapterBeansConfig { * default on purpose: a replay window nobody chose is one nobody sized. */ @Configuration(proxyBeanMethods = false) + @ConditionalOnProperty(prefix = "app.realtime.replay", name = "enabled", havingValue = "true") @ConditionalOnProperty( - prefix = "ca-skeleton.realtime.replay", - name = "enabled", - havingValue = "true") - @ConditionalOnProperty( - prefix = "ca-skeleton.persistence", + prefix = "app.persistence", name = "vendor", havingValue = "postgresql", matchIfMissing = true) @@ -130,7 +128,7 @@ class JpaAdapterBeansConfig { LiveEventJpaRepository repository, JdbcOperations jdbc, Clock clock, - @Value("${ca-skeleton.realtime.replay.retention}") Duration retention) { + @Value("${app.realtime.replay.retention}") Duration retention) { return new JpaLiveEventReplay(repository, jdbc, clock, retention); } } @@ -141,7 +139,7 @@ class JpaAdapterBeansConfig { */ @Configuration(proxyBeanMethods = false) @ConditionalOnProperty( - name = "ca-skeleton.capabilities.idempotency.provider", + name = CapabilitySelectors.IDEMPOTENCY_PROVIDER, havingValue = "postgresql") static class IdempotencyExpiry { diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfiguration.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfiguration.java index 8e8126bf..ccda39c2 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfiguration.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfiguration.java @@ -5,27 +5,33 @@ import dev.caskeleton.adapter.outbound.persistence.h2.H2PersistenceConfig; import dev.caskeleton.adapter.outbound.persistence.postgresql.PostgreSqlPersistenceConfig; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; +import org.springframework.core.env.Environment; /** * Capability-owned Spring entry point for relational persistence. * *

    On whenever this module is on the classpath: selecting the module is the decision, and {@code - * ca-skeleton.persistence-jpa.enabled=false} is only the escape hatch for a deployment that ships - * the jar but must not use it. + * app.persistence-jpa.enabled=false} is only the escape hatch for a deployment that ships the jar + * but must not use it. */ @AutoConfiguration @ConditionalOnProperty( - prefix = "ca-skeleton.persistence-jpa", + prefix = "app.persistence-jpa", name = "enabled", havingValue = "true", matchIfMissing = true) -@EnableConfigurationProperties(PersistenceVendorSettings.class) @Import({ JpaAdapterBeansConfig.class, PostgreSqlPersistenceConfig.class, H2PersistenceConfig.class, PostgreSqlIdempotencyStoreConfig.class }) -class PersistenceJpaAutoConfiguration {} +class PersistenceJpaAutoConfiguration { + + @Bean + PersistenceVendorSettings persistenceVendorSettings(Environment environment) { + return PersistenceVendorSettings.bind(environment); + } +} diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaRuntimeConfig.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaRuntimeConfig.java index 3951a1dd..66b5cb6b 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaRuntimeConfig.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaRuntimeConfig.java @@ -16,7 +16,7 @@ import org.springframework.context.annotation.Bean; }) @ConditionalOnClass(javax.sql.DataSource.class) @ConditionalOnProperty( - prefix = "ca-skeleton.persistence-jpa", + prefix = "app.persistence-jpa", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PostgreSqlIdempotencyStoreConfig.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PostgreSqlIdempotencyStoreConfig.java index ce5745c0..630dcaab 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PostgreSqlIdempotencyStoreConfig.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PostgreSqlIdempotencyStoreConfig.java @@ -2,6 +2,7 @@ package dev.caskeleton.adapter.outbound.persistence.autoconfigure; import dev.caskeleton.adapter.outbound.persistence.idempotency.postgresql.IdempotencySchemaStream; import dev.caskeleton.adapter.outbound.persistence.idempotency.postgresql.PostgreSqlIdempotencyStore; +import dev.caskeleton.adapter.outbound.support.CapabilitySelectors; import dev.caskeleton.application.idempotency.IdempotencyStorePort; import javax.sql.DataSource; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -19,9 +20,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; */ @Configuration(proxyBeanMethods = false) @EnableScheduling -@ConditionalOnProperty( - name = "ca-skeleton.capabilities.idempotency.provider", - havingValue = "postgresql") +@ConditionalOnProperty(name = CapabilitySelectors.IDEMPOTENCY_PROVIDER, havingValue = "postgresql") class PostgreSqlIdempotencyStoreConfig { @Bean @@ -31,12 +30,12 @@ class PostgreSqlIdempotencyStoreConfig { /** * Applies the stream at startup unless the deployment migrates out of band ({@code - * ca-skeleton.runtime.migration-on-startup=false}); the store then fails closed until an operator - * applies and activates it. + * app.runtime.migration-on-startup=false}); the store then fails closed until an operator applies + * and activates it. */ @Bean @ConditionalOnProperty( - name = "ca-skeleton.runtime.migration-on-startup", + name = "app.runtime.migration-on-startup", havingValue = "true", matchIfMissing = true) IdempotencySchemaStream idempotencySchemaStream(DataSource dataSource) { diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceVendorSettings.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceVendorSettings.java index e08dbc96..f84f28b1 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceVendorSettings.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceVendorSettings.java @@ -1,6 +1,7 @@ package dev.caskeleton.adapter.outbound.persistence.config; -import org.springframework.boot.context.properties.ConfigurationProperties; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; +import org.springframework.core.env.Environment; /** * Selects which RDBMS vendor composition this deployment runs. @@ -14,11 +15,13 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * two {@code @ConditionalOnProperty} vendor configurations would both stay off, and the first * missing SPI bean would surface as a {@code NoSuchBeanDefinitionException} naming {@code * OutboxClaimRepository} — a symptom several layers away from the misspelled value that caused it. + * + *

    Bound strictly ({@link #bind}), inside the module's gated auto-configuration: a misspelt key + * under {@code app.persistence} fails startup instead of leaving the default vendor in force. */ -@ConfigurationProperties(prefix = PersistenceVendorSettings.PREFIX) public record PersistenceVendorSettings(Vendor vendor) { - public static final String PREFIX = "ca-skeleton.persistence"; + public static final String PREFIX = "app.persistence"; public static final String VENDOR_PROPERTY = PREFIX + ".vendor"; /** The RDBMS vendors this repository composes a persistence adapter for. */ @@ -32,4 +35,14 @@ public record PersistenceVendorSettings(Vendor vendor) { // upgrade that does not set the key keeps its datastore. vendor = vendor == null ? Vendor.POSTGRESQL : vendor; } + + /** + * Binds {@link #PREFIX} strictly. + * + * @param environment the environment to bind from + * @return the bound settings + */ + public static PersistenceVendorSettings bind(Environment environment) { + return StrictSettingsBinder.bind(environment, PREFIX, PersistenceVendorSettings.class); + } } diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/h2/H2PersistenceConfig.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/h2/H2PersistenceConfig.java index 04447856..80c9c338 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/h2/H2PersistenceConfig.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/h2/H2PersistenceConfig.java @@ -13,8 +13,8 @@ import org.springframework.context.annotation.Import; /** * H2 vendor persistence configuration — the same four SPI beans the PostgreSQL vendor registers, - * implemented against H2. Selected by {@code ca-skeleton.persistence.vendor=h2}, which the {@code - * local} profile sets. + * implemented against H2. Selected by {@code app.persistence.vendor=h2}, which the {@code local} + * profile sets. * *

    No Flyway location customizer, deliberately. The PostgreSQL vendor points Flyway at * {@code classpath:db/migration/postgresql}; there is no H2 equivalent tree, because the local diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/jpa/IdempotencyReaper.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/jpa/IdempotencyReaper.java index 3dfed85b..3e754839 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/jpa/IdempotencyReaper.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/jpa/IdempotencyReaper.java @@ -23,7 +23,7 @@ public class IdempotencyReaper { this.clock = clock; } - @Scheduled(fixedDelayString = "${ca-skeleton.capabilities.idempotency.reaper-interval:PT10M}") + @Scheduled(fixedDelayString = "${app.capabilities.idempotency.reaper-interval:PT10M}") @Transactional public int reap() { int purged = repository.deleteExpired(clock.instant()); diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/postgresql/IdempotencySchemaStream.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/postgresql/IdempotencySchemaStream.java index f2b0f6fe..576a2a38 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/postgresql/IdempotencySchemaStream.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/postgresql/IdempotencySchemaStream.java @@ -1,5 +1,6 @@ package dev.caskeleton.adapter.outbound.persistence.idempotency.postgresql; +import dev.caskeleton.adapter.outbound.support.CapabilitySelectors; import java.util.Objects; import javax.sql.DataSource; import org.flywaydb.core.Flyway; @@ -69,7 +70,8 @@ public final class IdempotencySchemaStream implements SmartInitializingSingleton connection -> connection.getMetaData().getDatabaseProductName()); if (!"PostgreSQL".equalsIgnoreCase(product)) { throw new IllegalStateException( - "ca-skeleton.capabilities.idempotency.provider=postgresql requires PostgreSQL; this data" + CapabilitySelectors.IDEMPOTENCY_PROVIDER + + "=postgresql requires PostgreSQL; this data" + " source reports " + product + ". Select disabled or redis instead."); diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/lock/DistributedLockPersistenceConfig.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/lock/DistributedLockPersistenceConfig.java index 6859a131..dd242484 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/lock/DistributedLockPersistenceConfig.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/lock/DistributedLockPersistenceConfig.java @@ -6,10 +6,10 @@ import javax.sql.DataSource; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; +import org.springframework.core.env.Environment; import org.springframework.integration.jdbc.lock.DefaultLockRepository; import org.springframework.integration.jdbc.lock.JdbcLockRegistry; import org.springframework.integration.support.locks.DefaultLockRegistry; @@ -21,17 +21,27 @@ import org.springframework.integration.support.locks.DefaultLockRegistry; * See README "lock" for the provider-selection and wiring rationale. */ @Configuration(proxyBeanMethods = false) -// LockSettings is bound here rather than by the composition root's @ConfigurationPropertiesScan, -// which excludes this tree so a JPA-off deployment binds no persistence settings. Both providers -// below are built from its lease TTL, so without this the configuration cannot assemble either. -@EnableConfigurationProperties(LockSettings.class) public class DistributedLockPersistenceConfig { + /** + * The lock settings, bound strictly here rather than by a scan, so a JPA-off deployment binds no + * persistence settings. Both providers below are built from its lease TTL. + */ + @Bean + @ConditionalOnProperty( + prefix = "app.persistence-jpa", + name = "enabled", + havingValue = "true", + matchIfMissing = true) + LockSettings lockSettings(Environment environment) { + return LockSettings.bind(environment); + } + /** In-process adapter; active when {@code multi-instance-enabled} is {@code false} or absent. */ @Bean @Primary @ConditionalOnProperty( - prefix = "ca-skeleton.runtime", + prefix = "app.runtime", name = "multi-instance-enabled", havingValue = "false", matchIfMissing = true) @@ -45,7 +55,7 @@ public class DistributedLockPersistenceConfig { */ @Bean @ConditionalOnProperty( - prefix = "ca-skeleton.runtime", + prefix = "app.runtime", name = "multi-instance-enabled", havingValue = "true") DefaultLockRepository lockRepository(DataSource dataSource) { @@ -57,7 +67,7 @@ public class DistributedLockPersistenceConfig { @Bean @ConditionalOnProperty( - prefix = "ca-skeleton.runtime", + prefix = "app.runtime", name = "multi-instance-enabled", havingValue = "true") JdbcLockRegistry jdbcLockRegistry(DefaultLockRepository lockRepository, LockSettings settings) { @@ -67,7 +77,7 @@ public class DistributedLockPersistenceConfig { /** JDBC-backed adapter; named {@code jdbcDistributedLock} and wrapped below (not primary). */ @Bean("jdbcDistributedLock") @ConditionalOnProperty( - prefix = "ca-skeleton.runtime", + prefix = "app.runtime", name = "multi-instance-enabled", havingValue = "true") DistributedLockPort jdbcDistributedLock( @@ -83,7 +93,7 @@ public class DistributedLockPersistenceConfig { @Bean(name = "distributedLockProvider") @Primary @ConditionalOnProperty( - prefix = "ca-skeleton.runtime", + prefix = "app.runtime", name = "multi-instance-enabled", havingValue = "true") DistributedLockPort distributedLockProvider( diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/lock/LockSettings.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/lock/LockSettings.java index b32c34af..54cc10d6 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/lock/LockSettings.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/lock/LockSettings.java @@ -1,19 +1,18 @@ package dev.caskeleton.adapter.outbound.persistence.lock; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import java.time.Duration; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.validation.annotation.Validated; +import org.springframework.core.env.Environment; /** - * Distributed-lock tuning knobs bound from {@code ca-skeleton.lock.*} (yaml-only defaults, not - * {@code APP_*} env keys). {@code waitTime} = max wait before timeout (default 3s); {@code - * leaseTtl} = max lock hold before auto-expiry (default 30s, must be ≥ {@code waitTime}). See - * README "lock". + * Distributed-lock tuning knobs bound from {@code app.lock.*} (yaml-only defaults, not {@code + * APP_*} env keys). {@code waitTime} = max wait before timeout (default 3s); {@code leaseTtl} = max + * lock hold before auto-expiry (default 30s, must be ≥ {@code waitTime}). See README "lock". */ -@Validated -@ConfigurationProperties(prefix = "ca-skeleton.lock") public record LockSettings(Duration waitTime, Duration leaseTtl) { + static final String PREFIX = "app.lock"; + private static final Duration DEFAULT_WAIT_TIME = Duration.ofSeconds(3); private static final Duration DEFAULT_LEASE_TTL = Duration.ofSeconds(30); @@ -22,24 +21,35 @@ public record LockSettings(Duration waitTime, Duration leaseTtl) { waitTime = DEFAULT_WAIT_TIME; } else if (waitTime.isNegative() || waitTime.isZero()) { throw new IllegalArgumentException( - "ca-skeleton.lock.wait-time must be positive (> 0), was " + waitTime); + "app.lock.wait-time must be positive (> 0), was " + waitTime); } if (leaseTtl == null) { leaseTtl = DEFAULT_LEASE_TTL; } else if (leaseTtl.isNegative() || leaseTtl.isZero()) { throw new IllegalArgumentException( - "ca-skeleton.lock.lease-ttl must be positive (> 0), was " + leaseTtl); + "app.lock.lease-ttl must be positive (> 0), was " + leaseTtl); } // Cross-field invariant: a lease shorter than the max wait is nonsensical. // If the TTL fires before the waitTime elapses, a second holder could acquire // the lock before the first holder's protected work is complete. if (leaseTtl.compareTo(waitTime) < 0) { throw new IllegalArgumentException( - "ca-skeleton.lock.lease-ttl (" + "app.lock.lease-ttl (" + leaseTtl - + ") must be >= ca-skeleton.lock.wait-time (" + + ") must be >= app.lock.wait-time (" + waitTime + ") — a lease shorter than the max wait is nonsensical"); } } + + /** + * Binds {@link #PREFIX} strictly: a misspelt key fails startup rather than leaving a default + * lease in force. + * + * @param environment the environment to bind from + * @return the bound settings + */ + static LockSettings bind(Environment environment) { + return StrictSettingsBinder.bind(environment, PREFIX, LockSettings.class); + } } diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/outbox/jpa/OutboxReaper.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/outbox/jpa/OutboxReaper.java index 49fbc87e..e9042775 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/outbox/jpa/OutboxReaper.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/outbox/jpa/OutboxReaper.java @@ -38,7 +38,7 @@ public class OutboxReaper { *

    Not transactional itself: each batch is its own transaction (see {@link * OutboxEventJpaRepository#deletePublishedBatch}). */ - @Scheduled(fixedDelayString = "${ca-skeleton.outbox.reaper-interval:PT10M}") + @Scheduled(fixedDelayString = "${app.outbox.reaper-interval:PT10M}") public int reap() { Instant cutoff = clock.instant().minus(retention); int purged = 0; diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaActivationEnvironmentPostProcessor.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaActivationEnvironmentPostProcessor.java index 7c0214ad..5066835f 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaActivationEnvironmentPostProcessor.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaActivationEnvironmentPostProcessor.java @@ -16,8 +16,7 @@ import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MapPropertySource; /** - * What the module switch, {@code ca-skeleton.persistence-jpa.enabled}, decides before any bean - * exists. + * What the module switch, {@code app.persistence-jpa.enabled}, decides before any bean exists. * *

    On (the default while the module is present): the {@code db} health contributor joins * the readiness group. {@code validate-group-membership} is on, so a static {@code diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaSafetySettings.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaSafetySettings.java index 63d578ac..e3086eeb 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaSafetySettings.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaSafetySettings.java @@ -1,9 +1,10 @@ package dev.caskeleton.adapter.outbound.persistence.startup; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import dev.caskeleton.shared.runtime.RuntimeEnvironment; import java.util.Set; -import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.bind.DefaultValue; +import org.springframework.core.env.Environment; /** * The JPA safety switches this module binds (design §15, §31). @@ -20,12 +21,13 @@ import org.springframework.boot.context.properties.bind.DefaultValue; * changes. Open Session In View has no local exception: {@link OpenInViewSafetyValidator} refuses * it in every profile. */ -@ConfigurationProperties(prefix = "app.jpa-platform") record JpaSafetySettings( @DefaultValue("true") boolean enabled, Set localConvenienceProfiles, Set schemaMutatingProfiles) { + static final String PREFIX = "app.jpa-platform"; + /** The local convenience profiles, when nothing else is configured. */ public static final Set DEFAULT_LOCAL_PROFILES = Set.of(RuntimeEnvironment.LOCAL.profileName(), RuntimeEnvironment.testProfileName()); @@ -39,6 +41,17 @@ record JpaSafetySettings( schemaMutatingProfiles == null ? Set.of() : Set.copyOf(schemaMutatingProfiles); } + /** + * Binds {@link #PREFIX} strictly: a misspelt switch fails startup rather than silently leaving a + * safety guard in its default state. + * + * @param environment the environment to bind from + * @return the bound settings + */ + static JpaSafetySettings bind(Environment environment) { + return StrictSettingsBinder.bind(environment, PREFIX, JpaSafetySettings.class); + } + /** The defaults: enabled, local convenience in local/test, schema mutation nowhere. */ public static JpaSafetySettings defaults() { return new JpaSafetySettings(true, DEFAULT_LOCAL_PROFILES, Set.of()); diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaStartupAutoConfiguration.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaStartupAutoConfiguration.java index 3825eb6e..95266179 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaStartupAutoConfiguration.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaStartupAutoConfiguration.java @@ -4,14 +4,15 @@ import dev.caskeleton.adapter.outbound.persistence.config.PersistenceVendorSetti import dev.caskeleton.adapter.outbound.persistence.hibernate.HibernateProviderPolicy; import dev.caskeleton.adapter.outbound.persistence.migration.FlywaySchemaPolicy; import dev.caskeleton.adapter.outbound.persistence.security.PostgreSqlRuntimeRoleVerifier; +import dev.caskeleton.adapter.outbound.support.startup.RequiredProductionSecrets; import java.sql.SQLException; +import java.util.List; import javax.sql.DataSource; import org.springframework.beans.factory.InitializingBean; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.flyway.autoconfigure.FlywayMigrationStrategy; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -29,15 +30,14 @@ import org.springframework.core.env.Environment; */ @AutoConfiguration @ConditionalOnProperty( - prefix = "ca-skeleton.persistence-jpa", + prefix = "app.persistence-jpa", name = "enabled", havingValue = "true", matchIfMissing = true) -@EnableConfigurationProperties(JpaSafetySettings.class) class JpaStartupAutoConfiguration { /** The module switch: on while the module is present unless a deployment turns it off. */ - static final String ENABLED_PROPERTY = "ca-skeleton.persistence-jpa.enabled"; + static final String ENABLED_PROPERTY = "app.persistence-jpa.enabled"; static boolean enabled(Environment environment) { return Boolean.parseBoolean(environment.getProperty(ENABLED_PROPERTY, "true").trim()); @@ -53,7 +53,7 @@ class JpaStartupAutoConfiguration { @ConditionalOnMissingBean(FlywayMigrationStrategy.class) FlywayMigrationStrategy migrationStartupRunner(Environment environment) { return new MigrationStartupRunner( - environment.getProperty("ca-skeleton.runtime.migration-on-startup", Boolean.class, true)); + environment.getProperty("app.runtime.migration-on-startup", Boolean.class, true)); } /** Env-validation (exit 78): datasource connection env present before migration runs. */ @@ -106,6 +106,25 @@ class JpaStartupAutoConfiguration { return () -> validator.validateResolved(dataSource, "postgresql".equalsIgnoreCase(vendor)); } + /** + * The relational credential, owed under {@code prod} exactly while this module is on. + * + *

    The composition root's secret guard used to decide this by reading this module's switch + * itself (P22-new-1) — knowledge of a capability in the leaf that is supposed to hold none. The + * module now names its own secret, the way the Redis roles do, and a composition without it owes + * no database password because nothing contributes one. + */ + @Bean + RequiredProductionSecrets jpaProductionSecrets() { + return environment -> List.of("APP_DATASOURCE_PASSWORD"); + } + + /** The safety switches, bound strictly and only while the module is on. */ + @Bean + JpaSafetySettings jpaSafetySettings(Environment environment) { + return JpaSafetySettings.bind(environment); + } + /** The guard for the two settings that quietly break production. */ @Bean JpaDangerousConfigurationGuard jpaDangerousConfigurationGuard(JpaSafetySettings safety) { diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/MigrationStartupRunner.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/MigrationStartupRunner.java index 96c1cf55..850b136c 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/MigrationStartupRunner.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/MigrationStartupRunner.java @@ -25,8 +25,8 @@ class MigrationStartupRunner implements FlywayMigrationStrategy { private final boolean migrationOnStartup; /** - * @param migrationOnStartup {@code ca-skeleton.runtime.migration-on-startup}; {@code false} - * leaves the migration to an out-of-band run + * @param migrationOnStartup {@code app.runtime.migration-on-startup}; {@code false} leaves the + * migration to an out-of-band run */ MigrationStartupRunner(boolean migrationOnStartup) { this.migrationOnStartup = migrationOnStartup; @@ -36,7 +36,7 @@ class MigrationStartupRunner implements FlywayMigrationStrategy { public void migrate(Flyway flyway) { if (!migrationOnStartup) { log.info( - "startup phase {}: in-app Flyway migration is disabled via configuration (ca-skeleton.runtime.migration-on-startup=false)", + "startup phase {}: in-app Flyway migration is disabled via configuration (app.runtime.migration-on-startup=false)", kv("startup.phase", StartupPhase.MIGRATION.wireName())); return; } diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/PersistenceVendorProdSafetyValidator.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/PersistenceVendorProdSafetyValidator.java index 55df08a4..1fd0cb3c 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/PersistenceVendorProdSafetyValidator.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/startup/PersistenceVendorProdSafetyValidator.java @@ -10,10 +10,10 @@ import org.springframework.core.env.Environment; /** * Keeps the in-memory development datastore out of production. * - *

    {@code application-prod.yml} already pins {@code ca-skeleton.persistence.vendor=postgresql}, - * but a YAML default only wins against the property sources quieter than it: an environment - * variable or a container override outranks every committed file. The two ways prod could end up on - * H2 are therefore checked at startup, where the source of the value no longer matters. + *

    {@code application-prod.yml} already pins {@code app.persistence.vendor=postgresql}, but a + * YAML default only wins against the property sources quieter than it: an environment variable or a + * container override outranks every committed file. The two ways prod could end up on H2 are + * therefore checked at startup, where the source of the value no longer matters. * *

    Both checks are worth having separately, because either one alone leaves a hole: * @@ -33,7 +33,7 @@ import org.springframework.core.env.Environment; */ final class PersistenceVendorProdSafetyValidator implements StartupRule { - static final String VENDOR_KEY = "ca-skeleton.persistence.vendor"; + static final String VENDOR_KEY = "app.persistence.vendor"; static final String JDBC_URL_KEY = "spring.datasource.url"; static final String JDBC_URL_ENV_KEY = "APP_DATASOURCE_URL"; diff --git a/src/adapter/outbound/persistence-jpa/src/main/resources/config/module-defaults/persistence-jpa.yml b/src/adapter/outbound/persistence-jpa/src/main/resources/config/module-defaults/persistence-jpa.yml index d6330787..9d1553e8 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/resources/config/module-defaults/persistence-jpa.yml +++ b/src/adapter/outbound/persistence-jpa/src/main/resources/config/module-defaults/persistence-jpa.yml @@ -150,7 +150,7 @@ spring: default_batch_fetch_size: ${APP_JPA_HIBERNATE_DEFAULT_BATCH_FETCH_SIZE:0} generate_statistics: ${APP_JPA_HIBERNATE_GENERATE_STATISTICS:false} -ca-skeleton: +app: persistence-jpa: # true | false — on while this module is on the classpath. false switches it fully off: this # module's beans and Boot's JDBC/Hibernate/Spring Data JPA/Flyway auto-configurations @@ -197,7 +197,7 @@ ca-skeleton: # ISO-8601 duration — read also by adapter-persistence OutboxReaper @Scheduled reaper-interval: PT10M # ISO-8601 duration — PUBLISHED row retention before reaper deletes them (I3) - # read also by adapter-persistence OutboxReaper via ${ca-skeleton.outbox.published-retention:P7D} + # read also by adapter-persistence OutboxReaper via ${app.outbox.published-retention:P7D} published-retention: P7D # /actuator/info 에 싣는 이 모듈의 상태(management.info.env). compose smoke 가 lane 이 실제로 켠 @@ -206,5 +206,5 @@ ca-skeleton: info: capabilities: persistence-jpa: - enabled: ${ca-skeleton.persistence-jpa.enabled:true} - vendor: ${ca-skeleton.persistence.vendor:postgresql} + enabled: ${app.persistence-jpa.enabled:true} + vendor: ${app.persistence.vendor:postgresql} diff --git a/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/readiness/OutboxIntegrationSupport.java b/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/readiness/OutboxIntegrationSupport.java index 334d5312..97289e7b 100644 --- a/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/readiness/OutboxIntegrationSupport.java +++ b/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/readiness/OutboxIntegrationSupport.java @@ -84,7 +84,7 @@ final class OutboxIntegrationSupport { .getPropertySources() .addFirst( new MapPropertySource( - "outbox-integration", java.util.Map.of("ca-skeleton.outbox.enabled", "true"))); + "outbox-integration", java.util.Map.of("app.outbox.enabled", "true"))); // Register DataSource — no destroy (caller owns lifecycle). ctx.registerBean( diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/IdempotencyReaperWiringTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/IdempotencyReaperWiringTest.java index 3a03003b..a3eb48b2 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/IdempotencyReaperWiringTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/IdempotencyReaperWiringTest.java @@ -23,14 +23,14 @@ class IdempotencyReaperWiringTest { @Test void thePostgresqlSelectionHasTheExpiredRecordReaper() { runner - .withPropertyValues("ca-skeleton.capabilities.idempotency.provider=postgresql") + .withPropertyValues("app.capabilities.idempotency.provider=postgresql") .run(context -> assertThat(context).hasSingleBean(IdempotencyReaper.class)); } @Test void otherSelectionsHaveNoReaper() { runner - .withPropertyValues("ca-skeleton.capabilities.idempotency.provider=redis") + .withPropertyValues("app.capabilities.idempotency.provider=redis") .run(context -> assertThat(context).doesNotHaveBean(IdempotencyReaper.class)); } } diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/JpaLiveEventReplayActivationTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/JpaLiveEventReplayActivationTest.java index 6b75d6b9..98739e4d 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/JpaLiveEventReplayActivationTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/JpaLiveEventReplayActivationTest.java @@ -37,12 +37,12 @@ class JpaLiveEventReplayActivationTest { @Test void enabledReplayCapabilityRequiresExplicitRetention() { runner - .withPropertyValues("ca-skeleton.realtime.replay.enabled=true") + .withPropertyValues("app.realtime.replay.enabled=true") .run( context -> { assertThat(context).hasFailed(); assertThat(context.getStartupFailure()) - .hasMessageContaining("ca-skeleton.realtime.replay.retention"); + .hasMessageContaining("app.realtime.replay.retention"); }); } @@ -50,9 +50,9 @@ class JpaLiveEventReplayActivationTest { void h2VendorDoesNotCreateThePostgreSqlReplayAdapter() { runner .withPropertyValues( - "ca-skeleton.realtime.replay.enabled=true", - "ca-skeleton.realtime.replay.retention=PT1H", - "ca-skeleton.persistence.vendor=h2") + "app.realtime.replay.enabled=true", + "app.realtime.replay.retention=PT1H", + "app.persistence.vendor=h2") .run( context -> { assertThat(context).hasNotFailed(); @@ -64,8 +64,7 @@ class JpaLiveEventReplayActivationTest { void enabledReplayCapabilityWithRetentionCreatesAdapter() { runner .withPropertyValues( - "ca-skeleton.realtime.replay.enabled=true", - "ca-skeleton.realtime.replay.retention=PT1H") + "app.realtime.replay.enabled=true", "app.realtime.replay.retention=PT1H") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/OutboxReaperWiringTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/OutboxReaperWiringTest.java index 32a9d91d..6e763f4b 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/OutboxReaperWiringTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/OutboxReaperWiringTest.java @@ -28,9 +28,9 @@ import org.springframework.context.annotation.Configuration; * Clock} bean are present. This catches the "Spring cannot auto-wire" defect described in the * spec-reviewer finding. *

  5. Drift guard: the {@code Duration retention} constructor parameter carries - * {@code @Value("${ca-skeleton.outbox.published-retention:P7D}")} with the exact expression. - * Checked via reflection so that a future rename of the property key or default fails the - * build immediately. + * {@code @Value("${app.outbox.published-retention:P7D}")} with the exact expression. Checked + * via reflection so that a future rename of the property key or default fails the build + * immediately. *
*/ class OutboxReaperWiringTest { @@ -95,7 +95,7 @@ class OutboxReaperWiringTest { @Test void outboxReaperUsesDefaultP7dRetentionWhenOutboxIsEnabled() { contextRunner - .withPropertyValues("ca-skeleton.outbox.enabled=true") + .withPropertyValues("app.outbox.enabled=true") .run( context -> { assertThat(context).hasNotFailed(); @@ -109,8 +109,7 @@ class OutboxReaperWiringTest { @Test void outboxReaperUsesConfiguredRetentionWhenPropertyIsSet() { contextRunner - .withPropertyValues( - "ca-skeleton.outbox.enabled=true", "ca-skeleton.outbox.published-retention=P30D") + .withPropertyValues("app.outbox.enabled=true", "app.outbox.published-retention=P30D") .run( context -> { assertThat(context).hasNotFailed(); @@ -123,8 +122,7 @@ class OutboxReaperWiringTest { // (catches property-key rename or default value drift without a full Spring boot) // ----------------------------------------------------------------------- - private static final String EXPECTED_VALUE_EXPRESSION = - "${ca-skeleton.outbox.published-retention:P7D}"; + private static final String EXPECTED_VALUE_EXPRESSION = "${app.outbox.published-retention:P7D}"; @Test void durationRetentionBeanParameterCarriesValueAnnotationWithExactExpression() diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/OutboxSwitchWiringContractTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/OutboxSwitchWiringContractTest.java index 1cf49cca..33103586 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/OutboxSwitchWiringContractTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/OutboxSwitchWiringContractTest.java @@ -22,7 +22,7 @@ class OutboxSwitchWiringContractTest { assertThat(condition) .as(type.getSimpleName() + " must be gated by the outbox switch") .isNotNull(); - assertThat(condition.prefix()).isEqualTo("ca-skeleton.outbox"); + assertThat(condition.prefix()).isEqualTo("app.outbox"); assertThat(condition.name()).containsExactly("enabled"); assertThat(condition.havingValue()).isEqualTo("true"); assertThat(condition.matchIfMissing()).isFalse(); diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfigurationTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfigurationTest.java index 5d9158ae..becea5c9 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfigurationTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfigurationTest.java @@ -14,7 +14,6 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Import; import org.springframework.core.annotation.AnnotatedElementUtils; @@ -31,7 +30,7 @@ class PersistenceJpaAutoConfigurationTest { ConditionalOnProperty condition = PersistenceJpaAutoConfiguration.class.getAnnotation(ConditionalOnProperty.class); assertThat(condition).isNotNull(); - assertThat(condition.prefix()).isEqualTo("ca-skeleton.persistence-jpa"); + assertThat(condition.prefix()).isEqualTo("app.persistence-jpa"); assertThat(condition.name()).containsExactly("enabled"); assertThat(condition.havingValue()).isEqualTo("true"); assertThat(condition.matchIfMissing()) @@ -40,19 +39,23 @@ class PersistenceJpaAutoConfigurationTest { } @Test - void leafRootOwnsVendorSettingsBinding() { - EnableConfigurationProperties binding = - PersistenceJpaAutoConfiguration.class.getAnnotation(EnableConfigurationProperties.class); + void leafRootOwnsVendorSettingsBinding() throws NoSuchMethodException { + // when + java.lang.reflect.Method binding = + PersistenceJpaAutoConfiguration.class.getDeclaredMethod( + "persistenceVendorSettings", org.springframework.core.env.Environment.class); - assertThat(binding).isNotNull(); - assertThat(binding.value()).containsExactly(PersistenceVendorSettings.class); + // then + assertThat(binding.getReturnType()).isEqualTo(PersistenceVendorSettings.class); + assertThat(binding.isAnnotationPresent(org.springframework.context.annotation.Bean.class)) + .isTrue(); } @Test void packagePrivateLeafRootLoadsThroughBootAutoConfigurationWhenDisabled() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(PersistenceJpaAutoConfiguration.class)) - .withPropertyValues("ca-skeleton.persistence-jpa.enabled=false") + .withPropertyValues("app.persistence-jpa.enabled=false") .run(context -> assertThat(context).hasNotFailed()); } diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaCapabilityAssemblyTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaCapabilityAssemblyTest.java index c5d6af8c..ba472561 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaCapabilityAssemblyTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaCapabilityAssemblyTest.java @@ -48,7 +48,7 @@ class PersistenceJpaCapabilityAssemblyTest { assertThat(context.getBean(DistributedLockPort.class)) .isSameAs(context.getBean("inProcessDistributedLock")); assertThat(context.containsBean("migrationStartupRunner")).isTrue(); - assertThat(context.getEnvironment().getProperty("ca-skeleton.persistence-jpa.enabled")) + assertThat(context.getEnvironment().getProperty("app.persistence-jpa.enabled")) .as("the switch the module ships, on while it is present") .isEqualTo("true"); assertThat( @@ -63,7 +63,7 @@ class PersistenceJpaCapabilityAssemblyTest { @Test void multiInstanceLockIsTheMeteredJdbcProvider() { try (ConfigurableApplicationContext context = - start("--ca-skeleton.runtime.multi-instance-enabled=true")) { + start("--app.runtime.multi-instance-enabled=true")) { assertThat(context.containsBean("jdbcDistributedLock")).isTrue(); assertThat(context.getBean("distributedLockProvider").getClass().getSimpleName()) .as("every caller gets the JDBC provider behind the metrics decorator") @@ -75,7 +75,7 @@ class PersistenceJpaCapabilityAssemblyTest { @Test void theOutboxSwitchBringsTheStoreTheApplicationRelaysFrom() { - try (ConfigurableApplicationContext context = start("--ca-skeleton.outbox.enabled=true")) { + try (ConfigurableApplicationContext context = start("--app.outbox.enabled=true")) { assertThat(context.getBeansOfType(OutboxStorePort.class)).hasSize(1); } try (ConfigurableApplicationContext context = start()) { @@ -92,7 +92,7 @@ class PersistenceJpaCapabilityAssemblyTest { @Test void postgresqlIdempotencyStoreArrivesWithTheModule() { try (ConfigurableApplicationContext context = - start("--ca-skeleton.capabilities.idempotency.provider=postgresql")) { + start("--app.capabilities.idempotency.provider=postgresql")) { assertThat(context.getBeansOfType(IdempotencyStorePort.class)).hasSize(1); } } @@ -105,7 +105,7 @@ class PersistenceJpaCapabilityAssemblyTest { void theSwitchTurnsTheModuleAndBootsRelationalStackOffWithoutADatabase() { // when try (ConfigurableApplicationContext context = - boot(List.of("--ca-skeleton.persistence-jpa.enabled=false"))) { + boot(List.of("--app.persistence-jpa.enabled=false"))) { // then assertThat(relationalOrModuleBeans(context)).isEmpty(); @@ -116,7 +116,7 @@ class PersistenceJpaCapabilityAssemblyTest { List arguments = new ArrayList<>( List.of( - "--ca-skeleton.persistence.vendor=h2", + "--app.persistence.vendor=h2", "--spring.datasource.url=jdbc:h2:mem:" + UUID.randomUUID() + ";MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DB_CLOSE_DELAY=-1", @@ -125,7 +125,7 @@ class PersistenceJpaCapabilityAssemblyTest { "--spring.datasource.driver-class-name=org.h2.Driver", "--spring.flyway.enabled=false", "--spring.jpa.hibernate.ddl-auto=create-drop", - "--ca-skeleton.runtime.migration-on-startup=false")); + "--app.runtime.migration-on-startup=false")); arguments.addAll(List.of(overrides)); return boot(arguments); } diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaRuntimeConfigTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaRuntimeConfigTest.java index e8d18a24..00aab6c7 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaRuntimeConfigTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaRuntimeConfigTest.java @@ -13,13 +13,13 @@ class PersistenceJpaRuntimeConfigTest { private final ApplicationContextRunner runner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(PersistenceJpaRuntimeConfig.class)) - .withPropertyValues("ca-skeleton.persistence-jpa.enabled=true"); + .withPropertyValues("app.persistence-jpa.enabled=true"); @Test void moduleSwitchOffContributesNoRuntimeBeans() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(PersistenceJpaRuntimeConfig.class)) - .withPropertyValues("ca-skeleton.persistence-jpa.enabled=false") + .withPropertyValues("app.persistence-jpa.enabled=false") .run( context -> assertThat(context) diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PostgreSqlIdempotencyStoreConfigTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PostgreSqlIdempotencyStoreConfigTest.java index a76b316d..ec3a033e 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PostgreSqlIdempotencyStoreConfigTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PostgreSqlIdempotencyStoreConfigTest.java @@ -16,12 +16,12 @@ class PostgreSqlIdempotencyStoreConfigTest { new ApplicationContextRunner() .withUserConfiguration(PostgreSqlIdempotencyStoreConfig.class) .withBean(JdbcOperations.class, () -> org.mockito.Mockito.mock(JdbcOperations.class)) - .withPropertyValues("ca-skeleton.runtime.migration-on-startup=false"); + .withPropertyValues("app.runtime.migration-on-startup=false"); @Test void postgresqlSelectionComposesTheConcreteStoreBehindTheApplicationPort() { runner - .withPropertyValues("ca-skeleton.capabilities.idempotency.provider=postgresql") + .withPropertyValues("app.capabilities.idempotency.provider=postgresql") .run( context -> assertThat(context.getBean(IdempotencyStorePort.class)) @@ -31,14 +31,14 @@ class PostgreSqlIdempotencyStoreConfigTest { @Test void migrationOffLeavesTheSchemaStreamToTheOperator() { runner - .withPropertyValues("ca-skeleton.capabilities.idempotency.provider=postgresql") + .withPropertyValues("app.capabilities.idempotency.provider=postgresql") .run(context -> assertThat(context).doesNotHaveBean(IdempotencySchemaStream.class)); } @Test void otherSelectionsDoNotComposeThePostgresqlStore() { runner - .withPropertyValues("ca-skeleton.capabilities.idempotency.provider=redis") + .withPropertyValues("app.capabilities.idempotency.provider=redis") .run(context -> assertThat(context).doesNotHaveBean(IdempotencyStorePort.class)); } } diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceVendorSelectionTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceVendorSelectionTest.java index dd04cd08..6794af29 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceVendorSelectionTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceVendorSelectionTest.java @@ -5,13 +5,15 @@ import static org.assertj.core.api.Assertions.assertThat; import dev.caskeleton.adapter.outbound.persistence.config.PersistenceVendorSettings.Vendor; import dev.caskeleton.adapter.outbound.persistence.h2.H2PersistenceConfig; import dev.caskeleton.adapter.outbound.persistence.postgresql.PostgreSqlPersistenceConfig; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.runner.ApplicationContextRunner; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; /** * Guards the vendor selector itself: the value binding, and the two conditions that turn a value @@ -60,6 +62,20 @@ class PersistenceVendorSelectionTest { }); } + @Test + @DisplayName("app.persistence 아래 오타 키는 기동을 실패시킨다") + void aMisspelledPersistenceKeyFailsStartup() { + // when + runner + .withPropertyValues("app.persistence.vendr=h2") + .run( + context -> { + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()).hasStackTraceContaining("vendr"); + }); + } + @Test void postgreSqlIsTheCompositionAKeylessDeploymentGets() { ConditionalOnProperty condition = @@ -89,6 +105,11 @@ class PersistenceVendorSelectionTest { } @Configuration(proxyBeanMethods = false) - @EnableConfigurationProperties(PersistenceVendorSettings.class) - static class VendorSettings {} + static class VendorSettings { + + @Bean + PersistenceVendorSettings persistenceVendorSettings(Environment environment) { + return PersistenceVendorSettings.bind(environment); + } + } } diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/lock/DistributedLockPersistenceConfigTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/lock/DistributedLockPersistenceConfigTest.java index 412e79e4..72fe3def 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/lock/DistributedLockPersistenceConfigTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/lock/DistributedLockPersistenceConfigTest.java @@ -5,6 +5,7 @@ import static org.mockito.Mockito.mock; import dev.caskeleton.application.lock.DistributedLockPort; import javax.sql.DataSource; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.jdbc.datasource.DataSourceTransactionManager; @@ -24,7 +25,7 @@ class DistributedLockPersistenceConfigTest { @Test void singleInstanceUsesOnlyTheInProcessProvider() { contextRunner - .withPropertyValues("ca-skeleton.runtime.multi-instance-enabled=false") + .withPropertyValues("app.runtime.multi-instance-enabled=false") .run( context -> { assertThat(context).hasSingleBean(DistributedLockPort.class); @@ -34,10 +35,24 @@ class DistributedLockPersistenceConfigTest { }); } + @Test + @DisplayName("app.lock 아래 오타 키는 기동을 실패시킨다") + void aMisspelledLockKeyFailsStartup() { + // when + contextRunner + .withPropertyValues("app.lock.wait-tme=5s") + .run( + context -> { + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()).hasStackTraceContaining("wait-tme"); + }); + } + @Test void multiInstanceBuildsTheJdbcProviderAndNotTheInProcessProvider() { contextRunner - .withPropertyValues("ca-skeleton.runtime.multi-instance-enabled=true") + .withPropertyValues("app.runtime.multi-instance-enabled=true") .run( context -> { assertThat(context).hasBean("jdbcDistributedLock"); diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaActivationEnvironmentPostProcessorTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaActivationEnvironmentPostProcessorTest.java index 49d8b974..0fba8e55 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaActivationEnvironmentPostProcessorTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaActivationEnvironmentPostProcessorTest.java @@ -20,8 +20,7 @@ class JpaActivationEnvironmentPostProcessorTest { @Test void offExcludesBootsRelationalAutoConfigurationsButNotTheSharedTransactionOne() { // given - StandardEnvironment environment = - environment(Map.of("ca-skeleton.persistence-jpa.enabled", "false")); + StandardEnvironment environment = environment(Map.of("app.persistence-jpa.enabled", "false")); // when processor.postProcessEnvironment(environment, new SpringApplication()); @@ -47,7 +46,7 @@ class JpaActivationEnvironmentPostProcessorTest { StandardEnvironment environment = environment( Map.of( - "ca-skeleton.persistence-jpa.enabled", + "app.persistence-jpa.enabled", "false", JpaActivationEnvironmentPostProcessor.EXCLUDE, "com.example.OneAutoConfiguration")); @@ -64,8 +63,7 @@ class JpaActivationEnvironmentPostProcessorTest { @Test void offLeavesTheDatabaseOutOfReadiness() { // given - StandardEnvironment environment = - environment(Map.of("ca-skeleton.persistence-jpa.enabled", "false")); + StandardEnvironment environment = environment(Map.of("app.persistence-jpa.enabled", "false")); // when processor.postProcessEnvironment(environment, new SpringApplication()); diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaStartupAutoConfigurationTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaStartupAutoConfigurationTest.java index 169eb169..5f52c3fd 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaStartupAutoConfigurationTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/startup/JpaStartupAutoConfigurationTest.java @@ -4,11 +4,13 @@ import static org.assertj.core.api.Assertions.assertThat; import dev.caskeleton.adapter.outbound.persistence.hibernate.HibernateProviderPolicy; import dev.caskeleton.adapter.outbound.persistence.security.PostgreSqlRuntimeRoleVerifier; +import dev.caskeleton.adapter.outbound.support.startup.RequiredProductionSecrets; import java.lang.reflect.Proxy; import java.sql.Connection; import java.sql.DatabaseMetaData; import javax.sql.DataSource; import org.flywaydb.core.Flyway; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.flyway.autoconfigure.FlywayMigrationStrategy; @@ -58,7 +60,7 @@ class JpaStartupAutoConfigurationTest { void theModuleSwitchRemovesThePolicy() { runner .withUserConfiguration(DataSourceConfiguration.class) - .withPropertyValues("ca-skeleton.persistence-jpa.enabled=false") + .withPropertyValues("app.persistence-jpa.enabled=false") .run( context -> assertThat(context) @@ -79,6 +81,54 @@ class JpaStartupAutoConfigurationTest { }); } + @Test + @DisplayName("모듈이 켜져 있으면 prod secret으로 APP_DATASOURCE_PASSWORD를 기여한다") + void theModuleContributesTheDatabasePasswordAsAProductionSecret() { + // when + runner + .withUserConfiguration(DataSourceConfiguration.class) + .withPropertyValues("spring.jpa.open-in-view=false") + .run( + context -> { + // then + assertThat(context).hasSingleBean(RequiredProductionSecrets.class); + assertThat( + context + .getBean(RequiredProductionSecrets.class) + .requiredSecrets(context.getEnvironment())) + .containsExactly("APP_DATASOURCE_PASSWORD"); + }); + } + + @Test + @DisplayName("모듈을 끄면 데이터베이스 비밀번호를 요구하지 않는다") + void aSwitchedOffModuleOwesNoDatabasePassword() { + // when + runner + .withUserConfiguration(DataSourceConfiguration.class) + .withPropertyValues("app.persistence-jpa.enabled=false") + .run( + context -> { + // then + assertThat(context).doesNotHaveBean(RequiredProductionSecrets.class); + }); + } + + @Test + @DisplayName("app.jpa-platform 아래 오타 키는 기동을 실패시킨다") + void aMisspelledSafetyKeyFailsStartup() { + // when + runner + .withUserConfiguration(DataSourceConfiguration.class) + .withPropertyValues("spring.jpa.open-in-view=false", "app.jpa-platform.enabeld=false") + .run( + context -> { + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()).hasStackTraceContaining("enabeld"); + }); + } + @Test void safetySettingsDefaultToEnabled() { runner diff --git a/src/adapter/outbound/persistence-mongo/CLAUDE.md b/src/adapter/outbound/persistence-mongo/CLAUDE.md index e364a23b..9416a9de 100644 --- a/src/adapter/outbound/persistence-mongo/CLAUDE.md +++ b/src/adapter/outbound/persistence-mongo/CLAUDE.md @@ -20,11 +20,11 @@ design package's assumed module layout onto this leaf lives in implementation. - It does **not** reimplement idempotency / outbox / lock on Mongo (those stay JPA-only). - On when present: `MongoRootAutoConfiguration` and everything it imports run unless - `ca-skeleton.persistence-mongo.enabled=false` (`matchIfMissing = true`; the shipped + `app.persistence-mongo.enabled=false` (`matchIfMissing = true`; the shipped `config/mongo.yml` maps `APP_PERSISTENCE_MONGO_ENABLED`, default `true`). Absent from the build is the ordinary off state. The connection URI and database come from Spring's standard `spring.mongodb.*` settings; platform profiles come from - `ca-skeleton.persistence-mongo.platform.*`. + `app.persistence-mongo.platform.*`. The connection source is fail-closed: either `spring.mongodb.uri` / `SPRING_MONGODB_URI` is non-blank, or the selected typed profile supplies `uri-secret` and the deployment supplies `MongoCredentialResolver`. The typed profile is not documentation-only: diff --git a/src/adapter/outbound/persistence-mongo/README.md b/src/adapter/outbound/persistence-mongo/README.md index 9520dd7c..f3184a6d 100644 --- a/src/adapter/outbound/persistence-mongo/README.md +++ b/src/adapter/outbound/persistence-mongo/README.md @@ -44,13 +44,13 @@ registry를 같은 변경에서 함께 넓힌다. `SPRING_MONGODB_URI`가 relaxed binding으로 `spring.mongodb.uri`에 들어가는 방식이다. ```properties -ca-skeleton.persistence-mongo.enabled=true -ca-skeleton.persistence-mongo.platform.active-profile=standard-uri +app.persistence-mongo.enabled=true +app.persistence-mongo.platform.active-profile=standard-uri spring.mongodb.uri=${SPRING_MONGODB_URI} ``` typed profile을 사용하는 배포는 `SPRING_MONGODB_URI` 대신 선택된 -`ca-skeleton.persistence-mongo.platform.profiles..uri-secret`을 설정한다. +`app.persistence-mongo.platform.profiles..uri-secret`을 설정한다. `SecretSourcePort` bean이 있으면 그것으로 resolve하는 `MongoCredentialResolver`가 자동으로 등록되고, 배포가 직접 `MongoCredentialResolver`를 주면 그것을 쓴다. 이 경우 `MongoClientSettingsFactory`가 같은 Boot client builder에 connection string, TLS, Stable API, socket/server-selection/operation timeout, pool bound를 적용한다. @@ -74,7 +74,7 @@ composition-owned bean을 함께 준비해야 한다. 구성해야 한다. production profile의 14개 component는 다음 형태다. ```yaml -ca-skeleton: +app: persistence-mongo: enabled: true platform: @@ -116,7 +116,7 @@ Mongo auto-configuration 이름을 Boot 자신의 등록 파일에서 읽어 배 `MongoPersistenceSettings`는 모듈 opt-in만 소유한다. URI, database, credential은 Spring의 표준 `spring.mongodb.*` 설정을 사용한다. 플랫폼 profile은 -`ca-skeleton.persistence-mongo.platform.*` (`MongoPlatformSettings`)이 소유한다. +`app.persistence-mongo.platform.*` (`MongoPlatformSettings`)이 소유한다. ## 자동 구성 — 모듈이 있고 `enabled=false`가 아니면 bean으로 등록된다 @@ -134,7 +134,7 @@ Mongo auto-configuration 이름을 Boot 자신의 등록 파일에서 읽어 배 없으면 기동 거부, `MongoClientGenerationRegistry`(`MongoCredentialRotationPolicy` bean이 있을 때), `MongoPlatformHealthIndicator` + health contributor -설정 키는 `ca-skeleton.persistence-mongo.enabled`, `.platform.active-profile`, `.platform.transactions`, +설정 키는 `app.persistence-mongo.enabled`, `.platform.active-profile`, `.platform.transactions`, `.platform.required-secondaries`, `.platform.profiles..*`(위 예시의 14개)뿐이다. ## 라이브러리 API — 서비스의 어댑터 leaf에서 `implementation`으로 받아 직접 호출 diff --git a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoDefaultsEnvironmentPostProcessor.java b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoDefaultsEnvironmentPostProcessor.java index ac81340e..37f98326 100644 --- a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoDefaultsEnvironmentPostProcessor.java +++ b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoDefaultsEnvironmentPostProcessor.java @@ -26,10 +26,10 @@ import org.springframework.core.io.ClassPathResource; *

The settings are added last, below every configuration file, profile and environment variable, * so a deployment's own value always wins. * - *

The module is on when present. {@code ca-skeleton.persistence-mongo.enabled=false} turns off - * {@link MongoRootAutoConfiguration}, but Spring Boot's own Mongo auto-configurations come with the - * driver on the classpath and read no switch of ours — left alone they would still build a client - * and a template. So an explicit off also excludes them, by adding them to {@code + *

The module is on when present. {@code app.persistence-mongo.enabled=false} turns off {@link + * MongoRootAutoConfiguration}, but Spring Boot's own Mongo auto-configurations come with the driver + * on the classpath and read no switch of ours — left alone they would still build a client and a + * template. So an explicit off also excludes them, by adding them to {@code * spring.autoconfigure.exclude} alongside whatever the deployment already excludes. The names are * read from Boot's own registration files, not listed here, so a Boot release that adds one is * covered without an edit. @@ -42,9 +42,9 @@ public class MongoDefaultsEnvironmentPostProcessor implements EnvironmentPostPro static final String RESOURCE = "config/mongo.yml"; - static final String SWITCH = "ca-skeleton.persistence-mongo.enabled"; + static final String SWITCH = "app.persistence-mongo.enabled"; - static final String ACTIVE_PROFILE = "ca-skeleton.persistence-mongo.platform.active-profile"; + static final String ACTIVE_PROFILE = "app.persistence-mongo.platform.active-profile"; private static final String EXCLUDE = "spring.autoconfigure.exclude"; @@ -106,8 +106,7 @@ public class MongoDefaultsEnvironmentPostProcessor implements EnvironmentPostPro + ACTIVE_PROFILE + " (APP_PERSISTENCE_MONGO_ACTIVE_PROFILE)."); } - String profileSecret = - "ca-skeleton.persistence-mongo.platform.profiles." + profile + ".uri-secret"; + String profileSecret = "app.persistence-mongo.platform.profiles." + profile + ".uri-secret"; if (environment.getProperty("spring.mongodb.uri", "").isBlank() && environment.getProperty(profileSecret, "").isBlank()) { throw new IllegalStateException( diff --git a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfig.java b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfig.java index ff221347..b2d7e4be 100644 --- a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfig.java +++ b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfig.java @@ -7,7 +7,7 @@ import org.springframework.boot.mongodb.autoconfigure.MongoAutoConfiguration; /** * Opt-in wiring for MongoDB infrastructure. The configuration, Mongo client, and template activate - * only when {@code ca-skeleton.persistence-mongo.enabled=true}. + * only when {@code app.persistence-mongo.enabled=true}. * *

{@link ImportAutoConfiguration} is an explicit import that is not affected by {@code * spring.autoconfigure.exclude}, so re-importing the Mongo auto-configuration here cleanly turns diff --git a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceSettings.java b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceSettings.java index b1b1c359..b001410a 100644 --- a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceSettings.java +++ b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceSettings.java @@ -4,7 +4,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; /** * Typed enablement settings for the MongoDB infrastructure, bound from {@code - * ca-skeleton.persistence-mongo.*}. + * app.persistence-mongo.*}. * *

The Mongo connection URI is intentionally NOT modelled here — it is read from Spring's * own standard {@code spring.mongodb.uri} (owned by Spring Boot's {@code MongoProperties}), which @@ -18,7 +18,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * Compose lanes have always supplied {@code SPRING_MONGODB_URI}, so only the documentation was * behind. {@code MongoNamespaceContractTest} keeps it from drifting back. */ -@ConfigurationProperties(prefix = "ca-skeleton.persistence-mongo") +@ConfigurationProperties(prefix = "app.persistence-mongo") public class MongoPersistenceSettings { /** diff --git a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoRootAutoConfiguration.java b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoRootAutoConfiguration.java index 2eb2b815..e9c261d1 100644 --- a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoRootAutoConfiguration.java +++ b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/MongoRootAutoConfiguration.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Import; * The one place that decides whether this application talks to MongoDB. * *

On when present: an application that selected this module wants MongoDB, so a missing {@code - * ca-skeleton.persistence-mongo.enabled} means on. {@code false} turns this root off, and {@link + * app.persistence-mongo.enabled} means on. {@code false} turns this root off, and {@link * MongoDefaultsEnvironmentPostProcessor} excludes Spring Boot's own Mongo auto-configurations in * the same case, so an explicit off leaves no client, template or pool behind. * @@ -22,7 +22,7 @@ import org.springframework.context.annotation.Import; */ @AutoConfiguration @ConditionalOnProperty( - prefix = "ca-skeleton.persistence-mongo", + prefix = "app.persistence-mongo", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoPlatformSettings.java b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoPlatformSettings.java index 631c45a4..559e6fe2 100644 --- a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoPlatformSettings.java +++ b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoPlatformSettings.java @@ -10,7 +10,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; /** * The platform's typed configuration (design §28). * - *

Bound under {@code ca-skeleton.persistence-mongo.platform} rather than the design's {@code + *

Bound under {@code app.persistence-mongo.platform} rather than the design's {@code * backend.mongodb}, so it sits inside this repository's existing module namespace; the schema below * it is the design's. * @@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * standalone {@code local} failed startup, or kept readiness down, on account of a profile nobody * selected. */ -@ConfigurationProperties("ca-skeleton.persistence-mongo.platform") +@ConfigurationProperties(prefix = "app.persistence-mongo.platform", ignoreUnknownFields = false) public record MongoPlatformSettings( String activeProfile, Map profiles, diff --git a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/client/MongoProfileClientSettingsAutoConfiguration.java b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/client/MongoProfileClientSettingsAutoConfiguration.java index 0471bc26..d7c94a9d 100644 --- a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/client/MongoProfileClientSettingsAutoConfiguration.java +++ b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/client/MongoProfileClientSettingsAutoConfiguration.java @@ -21,7 +21,7 @@ import org.springframework.core.Ordered; @AutoConfiguration( beforeName = "org.springframework.boot.mongodb.autoconfigure.MongoAutoConfiguration") @ConditionalOnProperty( - prefix = "ca-skeleton.persistence-mongo", + prefix = "app.persistence-mongo", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/adapter/outbound/persistence-mongo/src/main/resources/config/mongo.yml b/src/adapter/outbound/persistence-mongo/src/main/resources/config/mongo.yml index ffab45de..e3a8272e 100644 --- a/src/adapter/outbound/persistence-mongo/src/main/resources/config/mongo.yml +++ b/src/adapter/outbound/persistence-mongo/src/main/resources/config/mongo.yml @@ -3,7 +3,7 @@ # 이 모듈이 직접 읽는다(MongoDefaultsEnvironmentPostProcessor). 우선순위는 가장 낮아서 # application*.yml, 환경 변수, 시스템 속성이 항상 이긴다. 이 모듈을 빌드에서 빼면 이 파일도 함께 # 빠진다. Registry SSOT: docs/registries/env-keys.yaml. -ca-skeleton: +app: persistence-mongo: # true | false — 모듈이 있으면 켜진다. false 로 끄면 Spring Boot 의 Mongo 자동 설정도 함께 빠진다. enabled: ${APP_PERSISTENCE_MONGO_ENABLED:true} @@ -14,7 +14,7 @@ ca-skeleton: active-profile: ${APP_PERSISTENCE_MONGO_ACTIVE_PROFILE:} # 연결 source 도 명시해야 한다. 표준 배포는 SPRING_MONGODB_URI(Boot 4 -> spring.mongodb.uri)를 # 준다. typed-profile 배포는 대신 - # ca-skeleton.persistence-mongo.platform.profiles..uri-secret 을 준다 + # app.persistence-mongo.platform.profiles..uri-secret 을 준다 # (secret:/// 의 을 SecretSourcePort 가 resolve 한다). 둘 다 없으면 # driver 의 localhost 기본값을 쓰지 않고 기동을 거절한다. # @@ -43,4 +43,4 @@ ca-skeleton: info: capabilities: persistence-mongo: - enabled: ${ca-skeleton.persistence-mongo.enabled:true} + enabled: ${app.persistence-mongo.enabled:true} diff --git a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoConnectionSourceRuleTest.java b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoConnectionSourceRuleTest.java index 49606c91..bf758796 100644 --- a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoConnectionSourceRuleTest.java +++ b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoConnectionSourceRuleTest.java @@ -18,28 +18,26 @@ class MongoConnectionSourceRuleTest { assertThat(failure) .isInstanceOf(IllegalStateException.class) - .hasMessageContaining("ca-skeleton.persistence-mongo.platform.active-profile"); + .hasMessageContaining("app.persistence-mongo.platform.active-profile"); } @Test void anOnModuleWithoutAConnectionSourceIsRefusedNamingBothSources() { Throwable failure = catchThrowable( - () -> - postProcess( - Map.of("ca-skeleton.persistence-mongo.platform.active-profile", "primary"))); + () -> postProcess(Map.of("app.persistence-mongo.platform.active-profile", "primary"))); assertThat(failure) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("spring.mongodb.uri") - .hasMessageContaining("ca-skeleton.persistence-mongo.platform.profiles.primary.uri-secret"); + .hasMessageContaining("app.persistence-mongo.platform.profiles.primary.uri-secret"); } @ParameterizedTest @ValueSource( strings = { "spring.mongodb.uri", - "ca-skeleton.persistence-mongo.platform.profiles.primary.uri-secret" + "app.persistence-mongo.platform.profiles.primary.uri-secret" }) void eitherConnectionSourceSatisfiesTheRule(String source) { Throwable failure = @@ -47,7 +45,7 @@ class MongoConnectionSourceRuleTest { () -> postProcess( Map.of( - "ca-skeleton.persistence-mongo.platform.active-profile", + "app.persistence-mongo.platform.active-profile", "primary", source, "mongodb://db.example:27017/app"))); @@ -58,7 +56,7 @@ class MongoConnectionSourceRuleTest { @Test void anExplicitlyOffModuleIsNotAskedForAConnection() { Throwable failure = - catchThrowable(() -> postProcess(Map.of("ca-skeleton.persistence-mongo.enabled", "false"))); + catchThrowable(() -> postProcess(Map.of("app.persistence-mongo.enabled", "false"))); assertThat(failure).isNull(); } diff --git a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfigTest.java b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfigTest.java index 9db28254..a4f2c8b6 100644 --- a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfigTest.java +++ b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfigTest.java @@ -4,7 +4,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import com.mongodb.client.MongoClient; +import dev.caskeleton.adapter.outbound.mongo.autoconfigure.MongoPlatformSettings; import java.util.Arrays; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -32,7 +34,7 @@ class MongoPersistenceConfigTest { void enableFlagBindsThroughTypedProperties() { new ApplicationContextRunner() .withUserConfiguration(PropertiesOnly.class) - .withPropertyValues("ca-skeleton.persistence-mongo.enabled=true") + .withPropertyValues("app.persistence-mongo.enabled=true") .run( context -> { assertThat(context).hasNotFailed(); @@ -48,7 +50,7 @@ class MongoPersistenceConfigTest { runner .withBean(MongoClient.class, () -> client) .withPropertyValues( - "ca-skeleton.persistence-mongo.enabled=true", "spring.mongodb.database=portfolio") + "app.persistence-mongo.enabled=true", "spring.mongodb.database=portfolio") .run( context -> { assertThat(context).hasNotFailed(); @@ -60,10 +62,29 @@ class MongoPersistenceConfigTest { }); } + @Test + @DisplayName("app.persistence-mongo.platform 아래 오타 키는 기동을 실패시킨다") + void aMisspelledPlatformKeyFailsStartup() { + // when + new ApplicationContextRunner() + .withUserConfiguration(PlatformPropertiesOnly.class) + .withPropertyValues("app.persistence-mongo.platform.active-profil=primary") + .run( + context -> { + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()).hasStackTraceContaining("active-profil"); + }); + } + @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties(MongoPersistenceSettings.class) static class PropertiesOnly {} + @Configuration(proxyBeanMethods = false) + @EnableConfigurationProperties(MongoPlatformSettings.class) + static class PlatformPropertiesOnly {} + @Configuration(proxyBeanMethods = false) @EnableAutoConfiguration static class BootAutoConfigurationApp {} diff --git a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoDriverObservabilityWiringTest.java b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoDriverObservabilityWiringTest.java index 2b5768cd..192ddf69 100644 --- a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoDriverObservabilityWiringTest.java +++ b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoDriverObservabilityWiringTest.java @@ -29,7 +29,7 @@ class MongoDriverObservabilityWiringTest { .withConfiguration( org.springframework.boot.autoconfigure.AutoConfigurations.of( MongoDriverObservabilityAutoConfiguration.class)) - .withPropertyValues("ca-skeleton.persistence-mongo.enabled=true"); + .withPropertyValues("app.persistence-mongo.enabled=true"); @Test @DisplayName("with a meter registry the customizer is registered") diff --git a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoPlatformWiringTest.java b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoPlatformWiringTest.java index a8dc471d..89186b03 100644 --- a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoPlatformWiringTest.java +++ b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoPlatformWiringTest.java @@ -101,14 +101,14 @@ class MongoPlatformWiringTest { .importPackages("dev.caskeleton.adapter.outbound.mongo"); private static ArchCondition carryTheMongoSwitch() { - return new ArchCondition<>("carry ca-skeleton.persistence-mongo.enabled") { + return new ArchCondition<>("carry app.persistence-mongo.enabled") { @Override public void check(JavaClass javaClass, ConditionEvents events) { ConditionalOnProperty condition = javaClass.reflect().getAnnotation(ConditionalOnProperty.class); boolean switched = condition != null - && condition.prefix().equals("ca-skeleton.persistence-mongo") + && condition.prefix().equals("app.persistence-mongo") && java.util.Arrays.asList(condition.name()).equals(java.util.List.of("enabled")); events.add( new SimpleConditionEvent( diff --git a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/client/MongoProfileClientSettingsAutoConfigurationTest.java b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/client/MongoProfileClientSettingsAutoConfigurationTest.java index 2d976a1e..f13360a1 100644 --- a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/client/MongoProfileClientSettingsAutoConfigurationTest.java +++ b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/client/MongoProfileClientSettingsAutoConfigurationTest.java @@ -37,7 +37,7 @@ class MongoProfileClientSettingsAutoConfigurationTest { MongoPlatformSettings.class, () -> new MongoPlatformSettings(ACTIVE, Map.of(ACTIVE, profile), false, null)) .withBean(MongoCredentialResolver.class, () -> resolver(URI)) - .withPropertyValues("ca-skeleton.persistence-mongo.enabled=true") + .withPropertyValues("app.persistence-mongo.enabled=true") .run( context -> { assertThat(context).hasSingleBean(MongoClientSettingsBuilderCustomizer.class); @@ -71,7 +71,7 @@ class MongoProfileClientSettingsAutoConfigurationTest { MongoPlatformSettings.class, () -> new MongoPlatformSettings("primry", Map.of(ACTIVE, profile), false, null)) .withBean(MongoCredentialResolver.class, () -> resolver(URI)) - .withPropertyValues("ca-skeleton.persistence-mongo.enabled=true") + .withPropertyValues("app.persistence-mongo.enabled=true") .run( context -> assertThatThrownBy( @@ -91,7 +91,7 @@ class MongoProfileClientSettingsAutoConfigurationTest { .withUserConfiguration(MongoProfileClientSettingsAutoConfiguration.class) .withBean(MongoPlatformSettings.class, MongoPlatformSettings::empty) .withBean(MongoTopologyProbe.class, () -> probe) - .withPropertyValues("ca-skeleton.persistence-mongo.enabled=true") + .withPropertyValues("app.persistence-mongo.enabled=true") .run( context -> { MongoClientSettingsBuilderCustomizer customizer = @@ -123,7 +123,7 @@ class MongoProfileClientSettingsAutoConfigurationTest { .withBean( MongoPlatformSettings.class, () -> new MongoPlatformSettings("standard-uri", Map.of(), false, null)) - .withPropertyValues("ca-skeleton.persistence-mongo.enabled=true") + .withPropertyValues("app.persistence-mongo.enabled=true") .run( context -> { MongoClientSettings.Builder builder = MongoClientSettings.builder(); @@ -141,7 +141,7 @@ class MongoProfileClientSettingsAutoConfigurationTest { .withBean( MongoPlatformSettings.class, () -> new MongoPlatformSettings(ACTIVE, Map.of(ACTIVE, profile), false, null)) - .withPropertyValues("ca-skeleton.persistence-mongo.enabled=true") + .withPropertyValues("app.persistence-mongo.enabled=true") .run( context -> assertThatThrownBy( @@ -170,7 +170,7 @@ class MongoProfileClientSettingsAutoConfigurationTest { MongoPlatformSettings.class, () -> new MongoPlatformSettings(ACTIVE, Map.of(ACTIVE, profile), false, null)) .withBean(SecretSourcePort.class, () -> secrets) - .withPropertyValues("ca-skeleton.persistence-mongo.enabled=true") + .withPropertyValues("app.persistence-mongo.enabled=true") .run( context -> { // when diff --git a/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/NotificationJpaPersistenceConfig.java b/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/NotificationJpaPersistenceConfig.java index 41d9f1b8..6470d39a 100644 --- a/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/NotificationJpaPersistenceConfig.java +++ b/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/NotificationJpaPersistenceConfig.java @@ -19,10 +19,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; * thing everywhere: no entity metadata, no repository beans, no schema expectation. */ @Configuration(proxyBeanMethods = false) -@ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", - name = "enabled", - havingValue = "true") +@ConditionalOnProperty(prefix = "app.notification.platform", name = "enabled", havingValue = "true") @EntityScan(basePackages = "dev.caskeleton.adapter.outbound.persistence.notification") @EnableJpaRepositories(basePackages = "dev.caskeleton.adapter.outbound.persistence.notification") public class NotificationJpaPersistenceConfig {} diff --git a/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/NotificationSchemaActivation.java b/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/NotificationSchemaActivation.java index dfede0d3..3c0e07cd 100644 --- a/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/NotificationSchemaActivation.java +++ b/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/NotificationSchemaActivation.java @@ -78,7 +78,7 @@ public final class NotificationSchemaActivation implements SmartInitializingSing + " is not ACTIVE at core epoch 1 revision 4. Apply " + "db/migration/jpa/notification-platform against history table " + "flyway_jpa_notification_history and promote the capability before enabling " - + "ca-skeleton.notification.platform.enabled"); + + "app.notification.platform.enabled"); } } } diff --git a/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/configuration/NotificationJpaPersistenceFacade.java b/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/configuration/NotificationJpaPersistenceFacade.java index 33154131..0a44244e 100644 --- a/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/configuration/NotificationJpaPersistenceFacade.java +++ b/src/adapter/outbound/persistence-notification/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/configuration/NotificationJpaPersistenceFacade.java @@ -92,10 +92,7 @@ import org.springframework.jdbc.core.JdbcOperations; @AutoConfiguration( beforeName = "dev.caskeleton.adapter.outbound.persistence.autoconfigure.PersistenceJpaAutoConfiguration") -@ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", - name = "enabled", - havingValue = "true") +@ConditionalOnProperty(prefix = "app.notification.platform", name = "enabled", havingValue = "true") // The entity scan travels with the stores it serves. NotificationJpaPersistenceConfig carries the // same condition and was imported by nothing at all — the composition root's component scan // excludes diff --git a/src/adapter/outbound/persistence-notification/src/test/java/dev/caskeleton/adapter/outbound/persistence/notification/configuration/NotificationPersistenceActivationTest.java b/src/adapter/outbound/persistence-notification/src/test/java/dev/caskeleton/adapter/outbound/persistence/notification/configuration/NotificationPersistenceActivationTest.java index 0eca476b..49b86b62 100644 --- a/src/adapter/outbound/persistence-notification/src/test/java/dev/caskeleton/adapter/outbound/persistence/notification/configuration/NotificationPersistenceActivationTest.java +++ b/src/adapter/outbound/persistence-notification/src/test/java/dev/caskeleton/adapter/outbound/persistence/notification/configuration/NotificationPersistenceActivationTest.java @@ -36,7 +36,7 @@ class NotificationPersistenceActivationTest { ConditionalOnProperty condition = configuration.getAnnotation(ConditionalOnProperty.class); // then - assertThat(condition.prefix()).isEqualTo("ca-skeleton.notification.platform"); + assertThat(condition.prefix()).isEqualTo("app.notification.platform"); assertThat(condition.name()).containsExactly("enabled"); assertThat(condition.havingValue()).isEqualTo("true"); assertThat(List.of(configuration.getAnnotation(EntityScan.class).basePackages())) @@ -71,6 +71,6 @@ class NotificationPersistenceActivationTest { NotificationJpaPersistenceFacade.class .getAnnotation(ConditionalOnProperty.class) .prefix()) - .isEqualTo("ca-skeleton.notification.platform"); + .isEqualTo("app.notification.platform"); } } diff --git a/src/adapter/outbound/redis-runtime/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/runtime/config/RedisRuntimeAutoConfigurationTest.java b/src/adapter/outbound/redis-runtime/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/runtime/config/RedisRuntimeAutoConfigurationTest.java index 4437818e..b7d2b57e 100644 --- a/src/adapter/outbound/redis-runtime/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/runtime/config/RedisRuntimeAutoConfigurationTest.java +++ b/src/adapter/outbound/redis-runtime/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/runtime/config/RedisRuntimeAutoConfigurationTest.java @@ -383,8 +383,7 @@ class RedisRuntimeAutoConfigurationTest { authenticated // A selector the runtime used to hard-code. It means nothing to the runtime now: only the // module that owns the role can say it needs Redis. - .withPropertyValues( - "app.redis.enabled=true", "ca-skeleton.capabilities.idempotency.provider=redis") + .withPropertyValues("app.redis.enabled=true", "app.capabilities.idempotency.provider=redis") .run(context -> assertThat(context).doesNotHaveBean("redisRequired")); } diff --git a/src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/CapabilitySelectors.java b/src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/CapabilitySelectors.java new file mode 100644 index 00000000..dc7d5c56 --- /dev/null +++ b/src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/CapabilitySelectors.java @@ -0,0 +1,31 @@ +package dev.caskeleton.adapter.outbound.support; + +/** + * The property keys that select which provider serves a role, in one place. + * + *

A selector is read by more than one module: {@code app.capabilities.idempotency.provider} + * decides between persistence-jpa's PostgreSQL store and cache-redis's Redis store, and the + * idempotency composition decides from the same key whether to build an executor at all. Each of + * them used to spell the key itself, so renaming the tree meant finding every copy and a missed one + * meant a store nobody selected — or a selected one nobody built. They are constants here, the leaf + * all three already depend on, and a condition names the constant. + */ +public final class CapabilitySelectors { + + /** The tree the role selectors and their per-role tuning live under. */ + public static final String ROOT = "app.capabilities"; + + /** {@code disabled | redis}: which store backs the default semantic cache region. */ + public static final String CACHE_DEFAULT_BINDING = ROOT + ".cache.bindings.default"; + + /** {@code disabled | postgresql | redis}: which store backs request idempotency. */ + public static final String IDEMPOTENCY_PROVIDER = ROOT + ".idempotency.provider"; + + /** {@code disabled | redis}: which store enforces rate limits. */ + public static final String RATE_LIMIT_PROVIDER = ROOT + ".rate-limit.provider"; + + /** {@code disabled | redis}: which store grants efficiency leases. */ + public static final String LEASE_PROVIDER = ROOT + ".lease.provider"; + + private CapabilitySelectors() {} +} diff --git a/src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/StrictSettingsBinder.java b/src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/StrictSettingsBinder.java index 218cccdc..3b696435 100644 --- a/src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/StrictSettingsBinder.java +++ b/src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/StrictSettingsBinder.java @@ -1,19 +1,31 @@ package dev.caskeleton.adapter.outbound.support; +import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Set; -import java.util.function.Predicate; +import java.util.TreeSet; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import org.springframework.boot.context.properties.bind.AbstractBindHandler; +import org.springframework.boot.context.properties.bind.BindContext; import org.springframework.boot.context.properties.bind.BindHandler; import org.springframework.boot.context.properties.bind.Bindable; import org.springframework.boot.context.properties.bind.Binder; import org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver; import org.springframework.boot.context.properties.bind.handler.NoUnboundElementsBindHandler; +import org.springframework.boot.context.properties.source.ConfigurationProperty; import org.springframework.boot.context.properties.source.ConfigurationPropertyName; +import org.springframework.boot.context.properties.source.ConfigurationPropertyName.Form; import org.springframework.boot.context.properties.source.ConfigurationPropertySource; import org.springframework.boot.context.properties.source.ConfigurationPropertySources; +import org.springframework.boot.context.properties.source.IterableConfigurationPropertySource; +import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.Environment; +import org.springframework.core.env.PropertySource; +import org.springframework.core.env.SystemEnvironmentPropertySource; /** * Binds a capability's settings strictly, and only when the capability is switched on. @@ -30,70 +42,55 @@ import org.springframework.core.env.Environment; * the default limit while its configuration file says otherwise, and discovering that from a * production incident is the whole failure mode this prevents. * - *

Why this is shared

+ *

Two surfaces, two checks

* - *

The Fileserver and HTTP client platforms each had their own copy of this — same handler, same - * {@code Binder.get(...).bind(PREFIX, Bindable.of(T), strict)}, same {@code orElseThrow}, differing - * only in which prefix they named and in one word of the failure message (BOOT-011). The one real - * difference between them is which property sources the unbound-element check applies to, so that - * is the parameter, and everything else is here once. + *

Property sources that enumerate their keys in property form — YAML, properties files, test + * overrides, system properties — are checked by {@link NoUnboundElementsBindHandler}. The system + * environment cannot be: Spring enumerates {@code APP_OUTBOX_POLL_INTERVAL} as {@code + * app.outbox.poll.interval} while binding it as {@code app.outbox.poll-interval}, so the handler + * would reject every correctly spelled hyphenated variable and still say nothing useful about a + * misspelt one. Every settings tree is under {@code app.*} and fed by {@code APP_*} variables + * (owner decision 16), so this is every capability's problem, not one module's. + * + *

The environment is checked the other way round instead. A variable whose name starts with the + * prefix's environment form ({@code APP_OUTBOX_}) is accepted when it is the environment form of a + * property this binding actually bound, of a property some other source declares (the name {@code + * APP_PERSISTENCE_JPA_ENABLED} starts with {@code APP_PERSISTENCE_} but belongs to {@code + * app.persistence-jpa.enabled}), or of a variable a {@code ${...}} placeholder reads. Anything else + * under the prefix names no setting and is refused by name, every offender at once. + * + *

This replaced the HTTP client's own reflective variant (S3-lead-2), which derived the accepted + * names from its record tree and so worked for that one settings type only. */ public final class StrictSettingsBinder { + private static final Pattern PLACEHOLDER = Pattern.compile("\\$\\{([A-Za-z0-9_]+)"); + private StrictSettingsBinder() {} /** - * Binds the prefix strictly against every property source. + * Binds the prefix strictly. * * @param environment the environment to bind from * @param prefix the settings prefix * @param type the settings type * @param the settings type * @return the bound settings + * @throws CapabilityStartupValidationException when an environment variable under the prefix + * names no setting */ public static T bind(Environment environment, String prefix, Class type) { - return bind(environment, prefix, type, source -> true); + return bindExcept(environment, prefix, type, Set.of()); } /** - * Binds the prefix strictly, checking unbound elements only in the sources the filter accepts. - * - *

The filter exists for one real case rather than as generality for its own sake. Spring - * enumerates {@code APP_HTTPCLIENT_CLIENTS_0_BASE_URL} from the system environment as {@code - * ...clients[0].base.url} while binding it as {@code ...clients[0].base-url}, so leaving the - * system environment to {@link NoUnboundElementsBindHandler} would reject every correctly spelled - * variable and still miss the misspelled ones. A caller that excludes it here is expected to - * check that source by another route. - * - * @param environment the environment to bind from - * @param prefix the settings prefix - * @param type the settings type - * @param unboundCheckScope which property sources the unbound-element check applies to - * @param the settings type - * @return the bound settings - */ - public static T bind( - Environment environment, - String prefix, - Class type, - Predicate unboundCheckScope) { - BindHandler strict = - new NoUnboundElementsBindHandler(BindHandler.DEFAULT, unboundCheckScope::test); - return Binder.get(environment) - .bind(prefix, Bindable.of(type), strict) - .orElseThrow( - () -> - new CapabilityStartupValidationException( - prefix + " could not be bound although the capability is enabled")); - } - - /** - * Binds the prefix strictly, except for keys under it that another module owns. + * Binds the prefix strictly, except for the subtrees under it that another module owns. * *

For a prefix two modules share: the idempotency lifecycle policy and the Redis store's own - * tuning both live under {@code ca-skeleton.capabilities.idempotency}. Each owner names what is - * not its own, rather than the check being dropped for the whole prefix — a misspelt lifecycle - * key is still refused. + * tuning both live under {@code app.capabilities.idempotency}. Each owner names what is not its + * own, rather than the check being dropped for the whole prefix — a misspelt lifecycle key is + * still refused. A foreign key covers its whole subtree, so {@code platform} leaves {@code + * platform.*} to the module that binds it. * * @param environment the environment to bind from * @param prefix the settings prefix @@ -105,20 +102,154 @@ public final class StrictSettingsBinder { */ public static T bindExcept( Environment environment, String prefix, Class type, Set foreignKeys) { + ConfigurationPropertyName root = ConfigurationPropertyName.of(prefix); Set foreign = foreignKeys.stream() .map(key -> ConfigurationPropertyName.of(prefix + "." + key)) .collect(Collectors.toUnmodifiableSet()); + // Foreign keys are hidden from the unbound-element check by filtering the sources it inspects. + // The system environment is left whole: a filtered view loses Spring's environment-name + // mapping, and a list such as APP_HTTPCLIENT_DYNAMIC_TARGETS_0_NAME would then silently bind + // as empty. It needs no filter anyway — the handler skips it, and the environment check below + // honours the foreign keys itself. List sources = StreamSupport.stream(ConfigurationPropertySources.get(environment).spliterator(), false) - .map(source -> source.filter(name -> !foreign.contains(name))) + .map( + source -> + isSystemEnvironment(source) || foreign.isEmpty() + ? source + : source.filter(name -> !ownedBy(foreign, name))) .toList(); - BindHandler strict = new NoUnboundElementsBindHandler(BindHandler.DEFAULT); - return new Binder(sources, new PropertySourcesPlaceholdersResolver(environment)) - .bind(prefix, Bindable.of(type), strict) - .orElseThrow( - () -> - new CapabilityStartupValidationException( - prefix + " could not be bound although the capability is enabled")); + RecordingBindHandler recorded = new RecordingBindHandler(); + BindHandler strict = + new NoUnboundElementsBindHandler(recorded, source -> !isSystemEnvironment(source)); + // bindOrCreate: a prefix nobody configured is the type's defaults, the same as a scanned + // @ConfigurationProperties class, and the compact constructor still validates them. + T settings = + new Binder(sources, new PropertySourcesPlaceholdersResolver(environment)) + .bindOrCreate(prefix, Bindable.of(type), strict); + rejectUnrecognisedEnvironment(environment, root, foreign, recorded.bound); + return settings; + } + + private static void rejectUnrecognisedEnvironment( + Environment environment, + ConfigurationPropertyName root, + Set foreign, + Set bound) { + if (!(environment instanceof ConfigurableEnvironment configurable)) { + return; + } + Set prefixes = environmentNames(root); + Set foreignPrefixes = new LinkedHashSet<>(); + foreign.forEach(name -> foreignPrefixes.addAll(environmentNames(name))); + Set accepted = new LinkedHashSet<>(); + bound.forEach(name -> accepted.addAll(environmentNames(name))); + accepted.addAll(declaredElsewhere(environment)); + + Set unrecognised = new TreeSet<>(); + for (PropertySource source : configurable.getPropertySources()) { + if (!(source instanceof SystemEnvironmentPropertySource variables)) { + continue; + } + for (String name : variables.getPropertyNames()) { + String canonical = name.toUpperCase(Locale.ROOT); + if (under(canonical, prefixes) + && !under(canonical, foreignPrefixes) + && !foreignPrefixes.contains(canonical) + && !accepted.contains(canonical)) { + unrecognised.add(name); + } + } + } + if (!unrecognised.isEmpty()) { + throw new CapabilityStartupValidationException( + "unrecognised environment variables under " + + root + + ": " + + unrecognised + + " — no setting under " + + root + + " has that name; check the spelling against the module README or" + + " docs/registries/env-keys.yaml"); + } + } + + /** + * The environment names every other property source vouches for. + * + *

A property some file declares — whether this binding reads it or another module does — has a + * legitimate environment spelling, and so does a variable a placeholder reads. Neither is a typo, + * however much its name looks like it belongs under this prefix. + */ + private static Set declaredElsewhere(Environment environment) { + Set names = new LinkedHashSet<>(); + for (ConfigurationPropertySource source : ConfigurationPropertySources.get(environment)) { + if (isSystemEnvironment(source) + || !(source instanceof IterableConfigurationPropertySource iterable)) { + continue; + } + iterable.stream() + .forEach( + name -> { + names.addAll(environmentNames(name)); + ConfigurationProperty property = iterable.getConfigurationProperty(name); + if (property != null && property.getValue() instanceof String text) { + Matcher placeholder = PLACEHOLDER.matcher(text); + while (placeholder.find()) { + names.add(placeholder.group(1).toUpperCase(Locale.ROOT)); + } + } + }); + } + return names; + } + + /** + * Both spellings Spring's system-environment mapping accepts for a property: hyphens as + * underscores ({@code APP_OUTBOX_POLL_INTERVAL}) and hyphens dropped ({@code + * APP_OUTBOX_POLLINTERVAL}). + */ + static Set environmentNames(ConfigurationPropertyName name) { + StringBuilder dashed = new StringBuilder(); + StringBuilder uniform = new StringBuilder(); + for (int index = 0; index < name.getNumberOfElements(); index++) { + if (index > 0) { + dashed.append('_'); + uniform.append('_'); + } + dashed.append(name.getElement(index, Form.DASHED).replace('-', '_')); + uniform.append(name.getElement(index, Form.UNIFORM)); + } + Set names = new LinkedHashSet<>(); + names.add(dashed.toString().toUpperCase(Locale.ROOT)); + names.add(uniform.toString().toUpperCase(Locale.ROOT)); + return names; + } + + private static boolean under(String variable, Set prefixes) { + return prefixes.stream().anyMatch(prefix -> variable.startsWith(prefix + "_")); + } + + private static boolean ownedBy( + Set foreign, ConfigurationPropertyName name) { + return foreign.stream().anyMatch(owner -> owner.equals(name) || owner.isAncestorOf(name)); + } + + private static boolean isSystemEnvironment(ConfigurationPropertySource source) { + return source.getUnderlyingSource() instanceof SystemEnvironmentPropertySource; + } + + /** Remembers every property the binding actually bound, so its variable is not called a typo. */ + private static final class RecordingBindHandler extends AbstractBindHandler { + + private final Set bound = new LinkedHashSet<>(); + + @Override + public Object onSuccess( + ConfigurationPropertyName name, Bindable target, BindContext context, Object result) { + bound.add(name); + return super.onSuccess(name, target, context, result); + } } } diff --git a/src/adapter/outbound/support/src/test/java/dev/caskeleton/adapter/outbound/support/StrictSettingsBinderTest.java b/src/adapter/outbound/support/src/test/java/dev/caskeleton/adapter/outbound/support/StrictSettingsBinderTest.java index 30762d56..1b592f1b 100644 --- a/src/adapter/outbound/support/src/test/java/dev/caskeleton/adapter/outbound/support/StrictSettingsBinderTest.java +++ b/src/adapter/outbound/support/src/test/java/dev/caskeleton/adapter/outbound/support/StrictSettingsBinderTest.java @@ -4,9 +4,14 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; import java.time.Duration; +import java.util.List; +import java.util.Map; import java.util.Set; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.context.properties.bind.BindException; +import org.springframework.core.env.StandardEnvironment; +import org.springframework.core.env.SystemEnvironmentPropertySource; import org.springframework.mock.env.MockEnvironment; class StrictSettingsBinderTest { @@ -67,4 +72,101 @@ class StrictSettingsBinderTest { // then assertThat(settings.lease()).isEqualTo(Duration.ofSeconds(45)); } + + /** Settings whose field name has a hyphen in property form. */ + public record TunedSettings(Duration lease, Integer keyVersion) {} + + @Test + @DisplayName("하이픈이 든 필드도 올바른 env 이름이면 바인딩된다") + void aCorrectlySpelledHyphenatedEnvironmentVariableBinds() { + // given + MockEnvironment environment = withSystemEnvironment(Map.of("SAMPLE_SHARED_KEY_VERSION", "2")); + + // when + TunedSettings settings = StrictSettingsBinder.bind(environment, PREFIX, TunedSettings.class); + + // then + assertThat(settings.keyVersion()).isEqualTo(2); + } + + @Test + @DisplayName("prefix 아래 오타 env는 그 이름으로 거부된다") + void aMisspelledEnvironmentVariableIsRefusedByName() { + // given + MockEnvironment environment = + withSystemEnvironment( + Map.of("SAMPLE_SHARED_KEY_VERSION", "2", "SAMPLE_SHARED_KEY_VERSOIN", "3")); + + // when + Throwable thrown = + catchThrowable(() -> StrictSettingsBinder.bind(environment, PREFIX, TunedSettings.class)); + + // then + assertThat(thrown) + .isInstanceOf(CapabilityStartupValidationException.class) + .hasMessageContaining("SAMPLE_SHARED_KEY_VERSOIN") + .hasMessageNotContaining("SAMPLE_SHARED_KEY_VERSION,"); + } + + @Test + @DisplayName("설정이 placeholder로 읽는 env는 필드 이름과 달라도 오타가 아니다") + void aVariableASettingReadsThroughAPlaceholderIsNotATypo() { + // given + MockEnvironment environment = + withSystemEnvironment(Map.of("SAMPLE_SHARED_LEASE_SECONDS", "45s")) + .withProperty(PREFIX + ".lease", "${SAMPLE_SHARED_LEASE_SECONDS:30s}"); + + // when + TunedSettings settings = StrictSettingsBinder.bind(environment, PREFIX, TunedSettings.class); + + // then + assertThat(settings.lease()).isEqualTo(Duration.ofSeconds(45)); + } + + @Test + @DisplayName("다른 모듈이 가진 하위 트리 전체는 그 모듈에 맡긴다") + void aSubtreeAnotherModuleOwnsIsLeftToThatModule() { + // given + MockEnvironment environment = + withSystemEnvironment(Map.of("SAMPLE_SHARED_PLATFORM_MAX_BYTES", "10")) + .withProperty(PREFIX + ".lease", "30s") + .withProperty(PREFIX + ".platform.enabled", "true"); + + // when + LifecycleSettings settings = + StrictSettingsBinder.bindExcept( + environment, PREFIX, LifecycleSettings.class, Set.of("platform")); + + // then + assertThat(settings).isEqualTo(new LifecycleSettings(Duration.ofSeconds(30))); + } + + /** Settings with a hyphenated list, the shape a filtered environment view loses. */ + public record ListSettings(List allowedHosts) {} + + @Test + @DisplayName("다른 모듈 키를 빼고 바인딩해도 env의 하이픈 list 원소는 바인딩된다") + void aHyphenatedListFromTheEnvironmentBindsWhenForeignKeysAreExcluded() { + // given + MockEnvironment environment = + withSystemEnvironment(Map.of("SAMPLE_SHARED_ALLOWED_HOSTS_0", "payment.test")); + + // when + ListSettings settings = + StrictSettingsBinder.bindExcept( + environment, PREFIX, ListSettings.class, Set.of("platform")); + + // then + assertThat(settings.allowedHosts()).containsExactly("payment.test"); + } + + private static MockEnvironment withSystemEnvironment(Map variables) { + MockEnvironment environment = new MockEnvironment(); + environment + .getPropertySources() + .addFirst( + new SystemEnvironmentPropertySource( + StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, variables)); + return environment; + } } diff --git a/src/app-bootstrap/README.md b/src/app-bootstrap/README.md index 29ffbcc5..1720500b 100644 --- a/src/app-bootstrap/README.md +++ b/src/app-bootstrap/README.md @@ -59,7 +59,7 @@ WebSocket, gRPC, 파일 서버, 알림)는 `build.gradle`에 주석 처리된 `r ### AuthenticationModeCompositionConfig -`ca-skeleton.security.auth-mode`의 기본값은 `jwt`이며 `jwt|redis-session` 중 정확히 하나만 허용한다. +`app.security.auth-mode`의 기본값은 `jwt`이며 `jwt|redis-session` 중 정확히 하나만 허용한다. JWT mode는 `jwtDecoder`가 있어야 하고 Redis session repository/filter가 있으면 기동을 거부한다. Redis session mode는 반대로 `jwtDecoder`를 거부하고 `redisVersionedSessionRepository`와 `springSessionRepositoryFilter`가 모두 있어야 한다. 이 검증은 bean name만 확인하므로 bootstrap이 @@ -94,7 +94,7 @@ README의 "startup" 절에 있다. 없게 된다. ### SecretSourceStrategy -- **enum 값 하나가 곧 백엔드 하나라는 확장 규약을 못 박는다.** `ca-skeleton.secret-source.strategy`로 +- **enum 값 하나가 곧 백엔드 하나라는 확장 규약을 못 박는다.** `app.secret-source.strategy`로 바인딩되며 `ENVIRONMENT`만 기본 제공한다. 미래 백엔드(VAULT, AWS_SECRETS_MANAGER, GCP_SECRET_MANAGER)는 주석으로만 남겨 두어, 추가 절차가 "enum 값 + `SecretSource` 구현 + factory case"임을 코드에서 바로 읽히게 했다(rate-limit algorithm enum 패턴과 동일). @@ -148,6 +148,8 @@ README의 "startup" 절에 있다. 비밀번호·HMAC 등)은 이 상수에 없다. 소유 모듈이 `RequiredProductionSecrets` 빈으로 "지금 선택된 역할이 요구하는 시크릿"을 알려 주고(Redis는 `cache-redis`의 `RedisProductionSecrets`), 이 가드는 그 이름들이 백엔드에서 풀리는지만 본다. 레지스트리에서는 그 행들이 `required_when`을 가진다. + 관계형 DB 비밀번호(`APP_DATASOURCE_PASSWORD`)도 같다: persistence-jpa가 켜져 있는 동안 + `JpaStartupAutoConfiguration`이 기여하고, 이 가드는 그 모듈의 스위치를 읽지 않는다(P22-new-1). - **prod 판정은 대소문자 무시다.** `SPRING_PROFILES_ACTIVE=PROD` 같은 배포 오타도 prod 가드를 발동시켜야 하므로 `equalsIgnoreCase`로 비교한다(`Environment#matchesProfiles`는 대소문자를 구분해 "PROD"를 통과시킨다). @@ -363,14 +365,14 @@ relay 조립(`OutboxRelayAutoConfiguration`, 스케줄러·metrics·leader token 핵심 결정이다. ### BootstrapSettings -- **`appName`은 비어 있으면 시작을 실패시킨다(fail-fast).** `ca-skeleton.bootstrap.*` 바인딩이며, +- **`appName`은 비어 있으면 시작을 실패시킨다(fail-fast).** `app.bootstrap.*` 바인딩이며, 앱 이름은 운영자가 직접 제공해야 하고 합리적인 기본값이 존재하지 않으므로, 비어 있거나 blank 면 `@NotBlank`로 막는다(Spring Boot 가 `BindValidationException`을 띄우고 컨텍스트 기동을 거부). 다른 settings 의 "warn-and-default"와 달리 여기서 fail-fast 를 택한 이유는, 잘못된 앱 이름으로 조용히 기동되는 것보다 즉시 멈추는 편이 안전하기 때문이다. ### LoggingSettings -- **모든 항목이 "warn-and-default" 정책이다.** `ca-skeleton.logging.*` 바인딩(원천은 .env). 잘못된 +- **모든 항목이 "warn-and-default" 정책이다.** `app.logging.*` 바인딩(원천은 .env). 잘못된 값은 경고 로그를 남기고 안전한 기본값으로 진행할 뿐 시작을 실패시키지 않는다. - **fail-fast 대신 warn-and-default 를 택한 이유.** Logback 은 이 record 가 바인딩되기 전에 자기 초기화 단계에서 `` 바인딩으로 이미 같은 값들을 자체 기본값과 함께 소비했다. 따라서 diff --git a/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/fileserver/FileserverCompositionIntegrationTest.java b/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/fileserver/FileserverCompositionIntegrationTest.java index 0944f6e0..e9b8aa7a 100644 --- a/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/fileserver/FileserverCompositionIntegrationTest.java +++ b/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/fileserver/FileserverCompositionIntegrationTest.java @@ -128,9 +128,8 @@ import tools.jackson.databind.ObjectMapper; "app.fileserver-platform.quota.hard-high-water=1.0", // The fileserver's tiers grant their permissions, as security.yml ships them. This // environment loads no configuration file, so the mapping is restated rather than read. - "ca-skeleton.authz.role-permissions[ROLE_FILE_READ]=file:read", - "ca-skeleton.authz.role-permissions[ROLE_FILE_WRITE]=file:upload,file:delete,file:copy," - + "file:move" + "app.authz.role-permissions[ROLE_FILE_READ]=file:read", + "app.authz.role-permissions[ROLE_FILE_WRITE]=file:upload,file:delete,file:copy," + "file:move" }) @AutoConfigureMockMvc(addFilters = false) class FileserverCompositionIntegrationTest { diff --git a/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/idempotency/PostgreSqlIdempotencyProviderIntegrationTest.java b/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/idempotency/PostgreSqlIdempotencyProviderIntegrationTest.java index 99da1951..358a1124 100644 --- a/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/idempotency/PostgreSqlIdempotencyProviderIntegrationTest.java +++ b/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/idempotency/PostgreSqlIdempotencyProviderIntegrationTest.java @@ -111,7 +111,7 @@ class PostgreSqlIdempotencyProviderIntegrationTest { IdempotencyAutoConfiguration.class)) .withUserConfiguration(Class.forName(POSTGRESQL_STORE_CONFIG)) .withPropertyValues( - "ca-skeleton.capabilities.idempotency.provider=postgresql", + "app.capabilities.idempotency.provider=postgresql", "spring.datasource.url=" + PG.getJdbcUrl(), "spring.datasource.username=" + PG.getUsername(), "spring.datasource.password=" + PG.getPassword(), diff --git a/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/objectstorage/ObjectStorageCompositionIntegrationTest.java b/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/objectstorage/ObjectStorageCompositionIntegrationTest.java index a325b700..23a1f01b 100644 --- a/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/objectstorage/ObjectStorageCompositionIntegrationTest.java +++ b/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/objectstorage/ObjectStorageCompositionIntegrationTest.java @@ -52,7 +52,7 @@ import org.springframework.test.context.DynamicPropertySource; classes = ObjectStorageCompositionIntegrationTest.ObjectStorageRuntime.class, properties = { "spring.config.name=object-storage-composition", - "ca-skeleton.persistence-jpa.enabled=false", + "app.persistence-jpa.enabled=false", "spring.main.banner-mode=off", // The lane also selects Fileserver, which is on when present; this test is not about it. "app.fileserver-platform.enabled=false", diff --git a/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/operation/DurableOperationCompositionIntegrationTest.java b/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/operation/DurableOperationCompositionIntegrationTest.java index cb93b24f..54c39409 100644 --- a/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/operation/DurableOperationCompositionIntegrationTest.java +++ b/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/operation/DurableOperationCompositionIntegrationTest.java @@ -62,10 +62,10 @@ import org.testcontainers.postgresql.PostgreSQLContainer; "spring.flyway.enabled=false", "spring.jpa.open-in-view=false", "spring.jpa.hibernate.ddl-auto=none", - "ca-skeleton.outbox.enabled=true", + "app.outbox.enabled=true", "app.fileserver-platform.enabled=false", "app.object-storage.enabled=false", - "ca-skeleton.authz.role-permissions.operation-submit=operation:submit,operation:cancel" + "app.authz.role-permissions.operation-submit=operation:submit,operation:cancel" }) @AutoConfigureMockMvc(addFilters = false) class DurableOperationCompositionIntegrationTest { diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/async/AsyncExecutorSettings.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/async/AsyncExecutorSettings.java index 7375072c..83d46fe3 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/async/AsyncExecutorSettings.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/async/AsyncExecutorSettings.java @@ -5,7 +5,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; /** - * Async executor pool sizing knobs, bound from {@code ca-skeleton.async.executor.*}. Rejects {@code + * Async executor pool sizing knobs, bound from {@code app.async.executor.*}. Rejects {@code * Integer.MAX_VALUE} as a queue capacity so the queue stays bounded. See README for the design * rationale. * @@ -14,7 +14,7 @@ import org.springframework.validation.annotation.Validated; * @param queueCapacity bounded backlog depth (1 ≤ capacity < {@code Integer.MAX_VALUE}) */ @Validated -@ConfigurationProperties(prefix = "ca-skeleton.async.executor") +@ConfigurationProperties(prefix = "app.async.executor") public record AsyncExecutorSettings(Integer coreSize, Integer maxSize, Integer queueCapacity) { private static final int DEFAULT_CORE_SIZE = 10; @@ -26,7 +26,7 @@ public record AsyncExecutorSettings(Integer coreSize, Integer maxSize, Integer q coreSize = DEFAULT_CORE_SIZE; } else if (coreSize < 1) { throw StartupFailures.envValidation( - "APP_ASYNC_EXECUTOR_CORE_SIZE (ca-skeleton.async.executor.core-size) must be >= 1 " + "APP_ASYNC_EXECUTOR_CORE_SIZE (app.async.executor.core-size) must be >= 1 " + "(positive_int), was " + coreSize); } @@ -34,12 +34,12 @@ public record AsyncExecutorSettings(Integer coreSize, Integer maxSize, Integer q queueCapacity = DEFAULT_QUEUE_CAPACITY; } else if (queueCapacity < 1) { throw StartupFailures.envValidation( - "APP_ASYNC_EXECUTOR_QUEUE_CAPACITY (ca-skeleton.async.executor.queue-capacity) must be >= 1 " + "APP_ASYNC_EXECUTOR_QUEUE_CAPACITY (app.async.executor.queue-capacity) must be >= 1 " + "(positive_int_bounded), was " + queueCapacity); } else if (queueCapacity == Integer.MAX_VALUE) { throw StartupFailures.envValidation( - "APP_ASYNC_EXECUTOR_QUEUE_CAPACITY (ca-skeleton.async.executor.queue-capacity) must be bounded " + "APP_ASYNC_EXECUTOR_QUEUE_CAPACITY (app.async.executor.queue-capacity) must be bounded " + "(< Integer.MAX_VALUE) — an unbounded queue makes max-size unreachable and is " + "forbidden (D7, positive_int_bounded)"); } @@ -47,14 +47,14 @@ public record AsyncExecutorSettings(Integer coreSize, Integer maxSize, Integer q maxSize = DEFAULT_MAX_SIZE; } else if (maxSize < 1) { throw StartupFailures.envValidation( - "APP_ASYNC_EXECUTOR_MAX_SIZE (ca-skeleton.async.executor.max-size) must be >= 1 " + "APP_ASYNC_EXECUTOR_MAX_SIZE (app.async.executor.max-size) must be >= 1 " + "(positive_int_ge_core), was " + maxSize); } // cross-field invariant: max must not be below core. if (maxSize < coreSize) { throw StartupFailures.envValidation( - "APP_ASYNC_EXECUTOR_MAX_SIZE (ca-skeleton.async.executor.max-size=" + "APP_ASYNC_EXECUTOR_MAX_SIZE (app.async.executor.max-size=" + maxSize + ") must be >= APP_ASYNC_EXECUTOR_CORE_SIZE (core-size=" + coreSize diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/operation/DurableOperationConfig.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/operation/DurableOperationConfig.java index 82c8f571..e1fbcc43 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/operation/DurableOperationConfig.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/operation/DurableOperationConfig.java @@ -22,8 +22,8 @@ import org.springframework.context.annotation.Import; *

Application composition, like the outbox relay: it builds use cases from ports, which a driven * adapter must not do. It names no module type, only ports, and turns itself on from what the * selected modules provide — an operation store and an outbox to announce submissions through, both - * of which the JPA module contributes (the outbox with {@code ca-skeleton.outbox.enabled}). - * Removing that module's build line removes the endpoints with it. + * of which the JPA module contributes (the outbox with {@code app.outbox.enabled}). Removing that + * module's build line removes the endpoints with it. * *

The use cases are beans rather than objects built inside the controller so that the method * security advisor proxies them: {@code @RequiresPermission} on submit and cancel is enforced by diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceSettings.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceSettings.java index 861ee367..6630bd0f 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceSettings.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceSettings.java @@ -3,12 +3,12 @@ package dev.caskeleton.bootstrap.runtime; import org.springframework.boot.context.properties.ConfigurationProperties; /** - * Secret backend selection, bound from {@code ca-skeleton.secret-source.strategy}. See README for - * the design rationale. + * Secret backend selection, bound from {@code app.secret-source.strategy}. See README for the + * design rationale. * * @param strategy the secret backend; {@code null} → {@code ENVIRONMENT} */ -@ConfigurationProperties(prefix = "ca-skeleton.secret-source") +@ConfigurationProperties(prefix = "app.secret-source") public record SecretSourceSettings(SecretSourceStrategy strategy) { public SecretSourceSettings { diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceStrategy.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceStrategy.java index 4fda31a8..c2c8d55c 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceStrategy.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceStrategy.java @@ -1,8 +1,8 @@ package dev.caskeleton.bootstrap.runtime; /** - * Selectable secret backend, bound from {@code ca-skeleton.secret-source.strategy}. {@link - * #ENVIRONMENT} is the shipped default. See README for the design rationale. + * Selectable secret backend, bound from {@code app.secret-source.strategy}. {@link #ENVIRONMENT} is + * the shipped default. See README for the design rationale. */ public enum SecretSourceStrategy { ENVIRONMENT diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidator.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidator.java index b8db585a..b7d3c374 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidator.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidator.java @@ -24,24 +24,15 @@ public class SecretSourceValidator implements SmartInitializingSingleton { /** * Secret keys that must be injected under the {@code prod} profile whatever the deployment - * selected. {@code SecretsClassificationRegistryTest} asserts this list matches the registry 1:1. - * A capability's own secrets are not listed here: the module that owns them contributes them - * ({@link RequiredProductionSecrets}) for the roles the deployment selected, and the registry - * marks them {@code required_when}. See README for the design rationale. + * selected. The relational credential is not one of them: persistence-jpa contributes it while it + * is on, and this guard no longer reads that module's switch (P22-new-1). {@code + * SecretsClassificationRegistryTest} asserts this list matches the registry 1:1. A capability's + * own secrets are not listed here: the module that owns them contributes them ({@link + * RequiredProductionSecrets}) for the roles the deployment selected, and the registry marks them + * {@code required_when}. See README for the design rationale. */ public static final List REQUIRED_PROD_SECRETS = - List.of("APP_DATASOURCE_PASSWORD", "APP_PRIVACY_PSEUDONYMIZATION_SALT"); - - /** - * The relational credential, required only while relational persistence is on. The switch is set - * by the persistence-jpa module's shipped defaults, so a composition without the module — the - * default one — owes no database password, the same way a deployment without Redis owes no Redis - * credential. - */ - private static final String DATASOURCE_PASSWORD = "APP_DATASOURCE_PASSWORD"; - - private static final String RELATIONAL_PERSISTENCE_PROPERTY = - "ca-skeleton.persistence-jpa.enabled"; + List.of("APP_PRIVACY_PSEUDONYMIZATION_SALT"); private final ConfigurableEnvironment environment; private final SecretSourcePort secretSource; @@ -91,13 +82,7 @@ public class SecretSourceValidator implements SmartInitializingSingleton { } private void collectMissingSecretViolations(StartupValidationContext validation) { - Set required = new LinkedHashSet<>(); - for (String key : REQUIRED_PROD_SECRETS) { - if (DATASOURCE_PASSWORD.equals(key) && !isRelationalPersistenceOn()) { - continue; - } - required.add(key); - } + Set required = new LinkedHashSet<>(REQUIRED_PROD_SECRETS); // Each module names the secrets its selected capabilities need. This guard does not know which // capabilities a module has or how they are selected — it only checks the names resolve. contributed.forEach(module -> required.addAll(module.requiredSecrets(environment))); @@ -107,9 +92,4 @@ public class SecretSourceValidator implements SmartInitializingSingleton { } } } - - private boolean isRelationalPersistenceOn() { - return Boolean.parseBoolean( - environment.getProperty(RELATIONAL_PERSISTENCE_PROPERTY, "false").trim()); - } } diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/security/AuthenticationModeSettings.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/security/AuthenticationModeSettings.java index b0ca3548..c02ea829 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/security/AuthenticationModeSettings.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/security/AuthenticationModeSettings.java @@ -5,7 +5,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.bind.ConstructorBinding; /** Composition-root authority for the exclusive application authentication mode. */ -@ConfigurationProperties(prefix = "ca-skeleton.security") +@ConfigurationProperties(prefix = "app.security") public record AuthenticationModeSettings(AuthenticationMode authMode) { @ConstructorBinding diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/BootstrapSettings.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/BootstrapSettings.java index c478995c..13dc4498 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/BootstrapSettings.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/BootstrapSettings.java @@ -5,13 +5,12 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; /** - * Bootstrap-scope settings bound from {@code ca-skeleton.bootstrap.*}. {@code appName} is fail-fast + * Bootstrap-scope settings bound from {@code app.bootstrap.*}. {@code appName} is fail-fast * (@NotBlank): no sensible default, so a blank value must stop startup rather than warn-and-default * like the other settings. See README for the design rationale. */ @Validated -@ConfigurationProperties(prefix = "ca-skeleton.bootstrap") +@ConfigurationProperties(prefix = "app.bootstrap") public record BootstrapSettings( - @NotBlank( - message = "APP_NAME (ca-skeleton.bootstrap.app-name) is required and must not be blank") + @NotBlank(message = "APP_NAME (app.bootstrap.app-name) is required and must not be blank") String appName) {} diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/LoggingSettings.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/LoggingSettings.java index 28428963..a023ffcc 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/LoggingSettings.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/LoggingSettings.java @@ -5,11 +5,11 @@ import java.time.ZoneId; import org.springframework.boot.context.properties.ConfigurationProperties; /** - * Logging settings bound from {@code ca-skeleton.logging.*}. Every knob is "warn-and-default": a - * bad value logs a warning and proceeds with a safe fallback rather than failing startup. See - * README for the design rationale. + * Logging settings bound from {@code app.logging.*}. Every knob is "warn-and-default": a bad value + * logs a warning and proceeds with a safe fallback rather than failing startup. See README for the + * design rationale. */ -@ConfigurationProperties(prefix = "ca-skeleton.logging") +@ConfigurationProperties(prefix = "app.logging") public record LoggingSettings(File file, Async async, Json json) { public record File( diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/RuntimeSafetySettings.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/RuntimeSafetySettings.java index 1116837a..04bd9744 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/RuntimeSafetySettings.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/settings/RuntimeSafetySettings.java @@ -3,11 +3,11 @@ package dev.caskeleton.bootstrap.settings; import org.springframework.boot.context.properties.ConfigurationProperties; /** - * Operational runtime settings bound from {@code ca-skeleton.runtime.*}. + * Operational runtime settings bound from {@code app.runtime.*}. * *

Only implemented controls belong here. Internal error-detail exposure and HTTP body logging * have no runtime implementation and therefore no reserved configuration switch. {@code * migration-on-startup} is read by the JPA module that runs the migration, not here. */ -@ConfigurationProperties(prefix = "ca-skeleton.runtime") +@ConfigurationProperties(prefix = "app.runtime") public record RuntimeSafetySettings(boolean multiInstanceEnabled) {} diff --git a/src/app-bootstrap/src/main/resources/application-dev.yml b/src/app-bootstrap/src/main/resources/application-dev.yml index 9545a3b6..3f1268e5 100644 --- a/src/app-bootstrap/src/main/resources/application-dev.yml +++ b/src/app-bootstrap/src/main/resources/application-dev.yml @@ -17,6 +17,6 @@ spring: # to H2 cannot silently carry a migration expectation with it. enabled: true -ca-skeleton: +app: persistence: vendor: postgresql diff --git a/src/app-bootstrap/src/main/resources/application-local.yml b/src/app-bootstrap/src/main/resources/application-local.yml index bbc68e2e..14061d34 100644 --- a/src/app-bootstrap/src/main/resources/application-local.yml +++ b/src/app-bootstrap/src/main/resources/application-local.yml @@ -4,7 +4,7 @@ # This file is a complete standalone configuration, not a patch. application.yml resolves ~70 # values from ${APP_*} placeholders that carry no inline default, so a launcher that does not # inject src/.env dies during property binding — and because logback-spring.xml reads the same -# unresolved ca-skeleton.logging.* values, the logging system fails first and swallows the console +# unresolved app.logging.* values, the logging system fails first and swallows the console # output that would have said so. The observable symptom is a process that exits 1 having printed # nothing. # @@ -148,7 +148,7 @@ logging: org.springframework.web: INFO org.hibernate.SQL: WARN -ca-skeleton: +app: persistence: # PostgreSQL, like dev and prod. The claim SQL, SQLState rows and timeout guards differ per # vendor even though the ports do not, so a local run on H2 exercised different code from the one diff --git a/src/app-bootstrap/src/main/resources/application-prod.yml b/src/app-bootstrap/src/main/resources/application-prod.yml index abc999e5..58c856b9 100644 --- a/src/app-bootstrap/src/main/resources/application-prod.yml +++ b/src/app-bootstrap/src/main/resources/application-prod.yml @@ -23,7 +23,7 @@ spring: flyway: enabled: true -ca-skeleton: +app: persistence: vendor: postgresql diff --git a/src/app-bootstrap/src/main/resources/config/observability.yml b/src/app-bootstrap/src/main/resources/config/observability.yml index dff13705..15ca1726 100644 --- a/src/app-bootstrap/src/main/resources/config/observability.yml +++ b/src/app-bootstrap/src/main/resources/config/observability.yml @@ -113,7 +113,7 @@ logging: # Module-scoped knobs. Each block is bound into a *Settings @ConfigurationProperties # record in the corresponding module, which is where allowed-value validation lives. -ca-skeleton: +app: logging: file: # true | false (wraps console + adds rolling JSON file appender) diff --git a/src/app-bootstrap/src/main/resources/config/runtime.yml b/src/app-bootstrap/src/main/resources/config/runtime.yml index 5f8e3718..b8db71f2 100644 --- a/src/app-bootstrap/src/main/resources/config/runtime.yml +++ b/src/app-bootstrap/src/main/resources/config/runtime.yml @@ -3,7 +3,7 @@ # # application.yml 이 spring.config.import 로 취합한다. 이 파일의 값은 application.yml 보다 # 낮고 application-{profile}.yml 보다도 낮으므로, 배포별 오버라이드는 그대로 우선한다. -ca-skeleton: +app: bootstrap: # required, non-blank — startup fails if blank (see BootstrapSettings) app-name: ${APP_NAME} @@ -19,7 +19,7 @@ ca-skeleton: async: # feature-background-job-async-contract D7 — @Async ThreadPoolTaskExecutor pool sizing. # Registry SSOT: docs/registries/env-keys.yaml (APP_ASYNC_EXECUTOR_* rows 1337-1377). - # Bound into AsyncExecutorSettings @ConfigurationProperties(prefix = "ca-skeleton.async.executor"). + # Bound into AsyncExecutorSettings @ConfigurationProperties(prefix = "app.async.executor"). # Bounded queue is mandatory (D7) — an unbounded queue makes max-size unreachable. executor: # int >= 1 (positive_int). Always-alive worker count. diff --git a/src/app-bootstrap/src/main/resources/config/security.yml b/src/app-bootstrap/src/main/resources/config/security.yml index f9cb2b7b..e08e190f 100644 --- a/src/app-bootstrap/src/main/resources/config/security.yml +++ b/src/app-bootstrap/src/main/resources/config/security.yml @@ -2,7 +2,7 @@ # # application.yml 이 spring.config.import 로 취합한다. 이 파일의 값은 application.yml 보다 # 낮고 application-{profile}.yml 보다도 낮으므로, 배포별 오버라이드는 그대로 우선한다. -ca-skeleton: +app: security: # jwt | redis-session; the bootstrap composition validator rejects mixed infrastructure. auth-mode: ${APP_SECURITY_AUTH_MODE:jwt} diff --git a/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/composition/BootstrapCapabilityReachabilitySystemTest.java b/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/composition/BootstrapCapabilityReachabilitySystemTest.java index bdd10bde..adce9ed6 100644 --- a/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/composition/BootstrapCapabilityReachabilitySystemTest.java +++ b/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/composition/BootstrapCapabilityReachabilitySystemTest.java @@ -42,7 +42,7 @@ class BootstrapCapabilityReachabilitySystemTest { void tracingRootIsReachableFromTheShippedCompositionWhenEnabled() { try (ConfigurableApplicationContext context = ShippedCompositionHarness.shippedComposition("local") - .run(ShippedCompositionHarness.allOffExcept("--ca-skeleton.tracing.enabled=true"))) { + .run(ShippedCompositionHarness.allOffExcept("--app.tracing.enabled=true"))) { assertThat(context.getBeansOfType(Tracer.class)).hasSize(1); } } diff --git a/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/composition/ShippedCompositionHarness.java b/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/composition/ShippedCompositionHarness.java index 0c72f679..bccd67a4 100644 --- a/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/composition/ShippedCompositionHarness.java +++ b/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/composition/ShippedCompositionHarness.java @@ -49,11 +49,11 @@ public final class ShippedCompositionHarness { // checked against. return new String[] { "--spring.application.name=ca-skeleton-test", - "--ca-skeleton.bootstrap.app-name=ca-skeleton-test", + "--app.bootstrap.app-name=ca-skeleton-test", "--spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8081/realms/ca-skeleton", - "--ca-skeleton.security.issuer-uri=http://localhost:8081/realms/ca-skeleton", + "--app.security.issuer-uri=http://localhost:8081/realms/ca-skeleton", "--spring.security.oauth2.resourceserver.jwt.audiences=ca-skeleton-api", - "--ca-skeleton.security.audience=ca-skeleton-api" + "--app.security.audience=ca-skeleton-api" }; } @@ -90,9 +90,9 @@ public final class ShippedCompositionHarness { */ public static String[] allOffArguments() { return new String[] { - "--ca-skeleton.runtime.multi-instance-enabled=false", - "--ca-skeleton.capabilities.idempotency.provider=disabled", - "--ca-skeleton.tracing.enabled=false" + "--app.runtime.multi-instance-enabled=false", + "--app.capabilities.idempotency.provider=disabled", + "--app.tracing.enabled=false" }; } diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/async/AsyncExecutorConfigTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/async/AsyncExecutorConfigTest.java index 4c5b98f0..109c66cc 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/async/AsyncExecutorConfigTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/async/AsyncExecutorConfigTest.java @@ -47,9 +47,9 @@ class AsyncExecutorConfigTest { void executorHonoursOverriddenSizing() { runner .withPropertyValues( - "ca-skeleton.async.executor.core-size=2", - "ca-skeleton.async.executor.max-size=4", - "ca-skeleton.async.executor.queue-capacity=8") + "app.async.executor.core-size=2", + "app.async.executor.max-size=4", + "app.async.executor.queue-capacity=8") .run( context -> { ThreadPoolTaskExecutor executor = diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/async/AsyncExecutorSettingsTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/async/AsyncExecutorSettingsTest.java index 0ed588d3..4b2414d3 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/async/AsyncExecutorSettingsTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/async/AsyncExecutorSettingsTest.java @@ -35,11 +35,11 @@ class AsyncExecutorSettingsTest { ConfigurationPropertySource source = new MapConfigurationPropertySource( Map.of( - "ca-skeleton.async.executor.core-size", "4", - "ca-skeleton.async.executor.max-size", "16", - "ca-skeleton.async.executor.queue-capacity", "64")); + "app.async.executor.core-size", "4", + "app.async.executor.max-size", "16", + "app.async.executor.queue-capacity", "64")); AsyncExecutorSettings settings = - new Binder(source).bind("ca-skeleton.async.executor", AsyncExecutorSettings.class).get(); + new Binder(source).bind("app.async.executor", AsyncExecutorSettings.class).get(); assertThat(settings.coreSize()).isEqualTo(4); assertThat(settings.maxSize()).isEqualTo(16); assertThat(settings.queueCapacity()).isEqualTo(64); diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/jpa/LocalJpaVendorParityTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/jpa/LocalJpaVendorParityTest.java index b63f2240..8023e196 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/jpa/LocalJpaVendorParityTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/jpa/LocalJpaVendorParityTest.java @@ -38,10 +38,7 @@ class LocalJpaVendorParityTest { * What must be identical: the vendor, who owns the schema, and what Hibernate is allowed to do. */ private static final List VENDOR_SEMANTICS = - List.of( - "ca-skeleton.persistence.vendor", - "spring.flyway.enabled", - "spring.jpa.hibernate.ddl-auto"); + List.of("app.persistence.vendor", "spring.flyway.enabled", "spring.jpa.hibernate.ddl-auto"); /** What is allowed to differ: where the database is and who connects to it. */ private static final List ADDRESS_AND_CREDENTIAL = @@ -68,7 +65,7 @@ class LocalJpaVendorParityTest { void localResolvesTheShippedVendor() throws IOException { MockEnvironment local = profile("application-local.yml"); - assertThat(local.getProperty("ca-skeleton.persistence.vendor")).isEqualTo("postgresql"); + assertThat(local.getProperty("app.persistence.vendor")).isEqualTo("postgresql"); assertThat(local.getProperty("spring.flyway.enabled")).isEqualTo("true"); assertThat(local.getProperty("spring.jpa.hibernate.ddl-auto")) .as("create-drop is what made two mapping/migration disagreements undiscoverable locally") diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ActuatorSecurityHttpTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ActuatorSecurityHttpTest.java index edc4d703..7e35217a 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ActuatorSecurityHttpTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ActuatorSecurityHttpTest.java @@ -46,7 +46,7 @@ import org.springframework.test.web.servlet.MockMvc; "spring.config.location=optional:classpath:actuator-security-slice-no-config.yml", // The test classpath carries persistence-jpa, which is on while present; this slice excludes // the data layer, so it switches the module off too. - "ca-skeleton.persistence-jpa.enabled=false", + "app.persistence-jpa.enabled=false", "management.endpoints.web.exposure.include=health,prometheus,info", "management.endpoints.web.exposure.exclude=env,configprops,heapdump,threaddump,shutdown", "management.endpoint.health.show-details=never" diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ConfigurationNamespaceContractTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ConfigurationNamespaceContractTest.java index 76684723..ee37dee0 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ConfigurationNamespaceContractTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ConfigurationNamespaceContractTest.java @@ -6,9 +6,10 @@ import dev.caskeleton.bootstrap.contract.support.ShippedConfiguration; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.LinkedHashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.TreeMap; import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -17,39 +18,22 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; /** - * The configuration namespaces this application owns, pinned (BOOT-001). + * The one configuration namespace this application owns, pinned (BOOT-001, owner decision 16). * - *

The shipped configuration grew three application-owned roots — {@code ca-skeleton}, {@code - * app} and {@code backend} — and nothing recorded why, so "where do I set this?" had three answers - * and a reader had to know which. Two capabilities were registered under both of the first two. + *

The shipped configuration used to grow three application-owned roots — {@code ca-skeleton}, + * {@code app} and {@code backend} — and "where do I set this?" had three answers. They are one root + * now: {@code app}. * - *

Why this pins the split instead of removing it

+ *

The environment variable names did not change with it. Every {@code APP_*} variable keeps its + * name; what moved is the property tree the variable feeds. A variable reaches its property either + * through an explicit {@code ${APP_...}} placeholder or, for trees bound straight from the + * environment such as {@code app.httpclient.clients[N].*}, through relaxed binding — and under one + * {@code app} root the two routes spell the same name. * - *

The obvious fix — rename everything to one root — is wrong for at least one of the trees, and - * the reason is worth stating because it is not visible from the YAML. - * - *

{@code ca-skeleton.*} keys are populated from {@code APP_*} environment variables through - * explicit {@code ${...}} placeholders, so the property name and the variable name are independent: - * renaming the property changes nothing an operator types. {@code app.httpclient.*} is different. - * Its list-valued settings are bound straight from the environment by relaxed binding, which is why - * {@code HttpClientEnvironmentKeys} exists at all and why it derives its templates from {@code - * APP_HTTPCLIENT_}. Renaming that prefix to {@code ca-skeleton.httpclient} would rename every - * {@code APP_HTTPCLIENT_*} variable to {@code CA_SKELETON_HTTPCLIENT_*} — breaking the repository's - * documented convention that application-owned environment uses the {@code APP_} prefix, and every - * deployment that sets one. - * - *

{@code app.messaging.*} is out of reach for a second reason: it belongs to the vendored {@code - * messaging:*} platform, which by design depends on no type of this application and owns its own - * configuration contract. - * - *

So the roots stay, and what changes is that they can no longer grow quietly. A fourth root, or - * a new prefix under an existing one, fails here and has to be argued for. - * - *

Since capabilities became modules a service selects (2026-09-25), the default composition - * declares only {@code ca-skeleton} of the three. {@code app} and {@code backend} arrive with the - * capability modules that own them — {@code app.redis}, {@code app.messaging}, {@code - * app.httpclient}, {@code app.fileserver-platform}, {@code backend.graphql} — so they stay allowed - * here: uncommenting one capability line must not turn this contract red. + *

Vendored platforms keep their own subtree under the same root: {@code app.messaging.*} belongs + * to the {@code messaging:*} platform, and gRPC's settings sit in {@code app.grpc.server} and + * {@code app.grpc.platform} side by side, never one at the shared parent — two strict binders on a + * shared parent would each refuse the other's keys. */ class ConfigurationNamespaceContractTest { @@ -62,87 +46,105 @@ class ConfigurationNamespaceContractTest { * module adds its own {@code info.capabilities.} entry for the Compose smoke lanes to read. */ private static final Set ALLOWED_ROOTS = - Set.of( - "spring", - "management", - "server", - "logging", - "springdoc", - "info", - "ca-skeleton", - "app", - "backend"); + Set.of("spring", "management", "server", "logging", "springdoc", "info", "app"); + + /** The application-owned root every settings prefix sits under. */ + private static final String APPLICATION_ROOT = "app."; /** - * Every {@code @ConfigurationProperties} prefix and {@code PREFIX} constant this leaf declares. + * Every {@code @ConfigurationProperties} prefix and {@code PREFIX} constant app-bootstrap + * declares. * *

Listed exhaustively rather than matched by pattern. A pattern would accept a new prefix on * the day it is written, which is the moment the decision is actually being made. */ - private static final Set DECLARED_PREFIXES = + private static final Set BOOTSTRAP_PREFIXES = new TreeSet<>( List.of( - "ca-skeleton.async.executor", - "ca-skeleton.bootstrap", - "ca-skeleton.logging", - "ca-skeleton.runtime", - "ca-skeleton.secret-source", - "ca-skeleton.security")); + "app.async.executor", + "app.bootstrap", + "app.logging", + "app.runtime", + "app.secret-source", + "app.security")); private static final Pattern PREFIX_ANNOTATION = Pattern.compile("@ConfigurationProperties\\(\\s*(?:prefix\\s*=\\s*)?\"([^\"]+)\""); private static final Pattern PREFIX_CONSTANT = - Pattern.compile("String PREFIX\\s*=\\s*\"([^\"]+)\""); + Pattern.compile("String PREFIX\\s*=\\s*\"([a-z][a-z0-9.-]*)\""); private static final Pattern ROOT_KEY = Pattern.compile("(?m)^([a-zA-Z][A-Za-z0-9_-]*):\\s*$"); @Test - @DisplayName("the shipped configuration declares no root beyond the recorded ones") + @DisplayName("배포되는 설정은 기록된 root 밖의 root를 선언하지 않는다") void shippedConfigurationDeclaresOnlyRecordedRoots() { - Set roots = new TreeSet<>(); + // given Matcher root = ROOT_KEY.matcher(ShippedConfiguration.text()); + + // when + Set roots = new TreeSet<>(); while (root.find()) { roots.add(root.group(1)); } + // then assertThat(roots) .as( - "a fourth application-owned root would give 'where do I set this?' another answer. " - + "Add it to ALLOWED_ROOTS only with the reason written down — see this class's " - + "Javadoc for why the existing three are not simply merged (BOOT-001).") - .isSubsetOf(ALLOWED_ROOTS); - assertThat(roots) - .as("the scan must actually reach the shipped roots, or this check passes vacuously") - .contains("ca-skeleton", "spring"); + "an application-owned root other than app gives 'where do I set this?' a second " + + "answer (owner decision 16)") + .isSubsetOf(ALLOWED_ROOTS) + .contains("app", "spring"); } @Test - @DisplayName("every declared settings prefix is one this contract records") - void everyDeclaredPrefixIsRecorded() throws IOException { - Set found = new LinkedHashSet<>(); - Path main = repositoryRoot().resolve("src/app-bootstrap/src/main/java"); - try (Stream sources = Files.walk(main)) { - for (Path source : sources.filter(p -> p.toString().endsWith(".java")).toList()) { + @DisplayName("app-bootstrap이 선언한 설정 prefix는 모두 이 계약에 기록돼 있다") + void everyBootstrapPrefixIsRecorded() throws IOException { + // when + Map found = declaredPrefixes(repositoryRoot().resolve("src/app-bootstrap")); + + // then + assertThat(found.keySet()) + .as("a settings prefix that is not recorded here is a namespace decision nobody reviewed") + .isNotEmpty() + .isSubsetOf(BOOTSTRAP_PREFIXES); + } + + @Test + @DisplayName("모든 leaf의 설정 prefix는 app 아래에 있다") + void everyLeafPrefixSitsUnderTheApplicationRoot() throws IOException { + // when + Map found = declaredPrefixes(repositoryRoot().resolve("src")); + + // then + assertThat(found) + .as("the scan must reach the leaves' settings prefixes") + .hasSizeGreaterThan(10); + assertThat(found) + .as("every settings prefix sits under app (owner decision 16); offenders and their files") + .allSatisfy((prefix, file) -> assertThat(prefix).startsWith(APPLICATION_ROOT)); + } + + private static Map declaredPrefixes(Path under) throws IOException { + Map found = new TreeMap<>(); + try (Stream sources = Files.walk(under)) { + List mainSources = + sources + .filter(path -> path.toString().endsWith(".java")) + .filter(path -> path.toString().contains("/src/main/java/")) + .filter(path -> !path.toString().contains("/build/")) + .toList(); + for (Path source : mainSources) { String text = Files.readString(source); for (Pattern pattern : List.of(PREFIX_ANNOTATION, PREFIX_CONSTANT)) { Matcher matcher = pattern.matcher(text); while (matcher.find()) { - found.add(matcher.group(1)); + found.put(matcher.group(1), source); } } } } - - assertThat(found) - .as("the scan must find the leaf's settings prefixes, or this check passes vacuously") - .isNotEmpty(); - assertThat(found) - .as( - "a settings prefix that is not recorded here is a namespace decision nobody reviewed. " - + "Record it, and prefer ca-skeleton.* unless the keys bind directly from the " - + "environment — see this class's Javadoc (BOOT-001).") - .isSubsetOf(DECLARED_PREFIXES); + return found; } private static Path repositoryRoot() { diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ProfileSeparationContractTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ProfileSeparationContractTest.java index 3be9a777..407d8447 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ProfileSeparationContractTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ProfileSeparationContractTest.java @@ -124,7 +124,7 @@ class ProfileSeparationContractTest { } private static String vendorOf(Map configuration) { - Map persistence = child(child(configuration, "ca-skeleton"), "persistence"); + Map persistence = child(child(configuration, "app"), "persistence"); Object vendor = persistence == null ? null : persistence.get(VENDOR_KEY); return vendor == null ? null : vendor.toString(); } @@ -191,8 +191,8 @@ class ProfileSeparationContractTest { * The local profile must not need src/.env. Only {@code ./gradlew :app-bootstrap:bootRun} injects * that file; an IDE Run/Debug, {@code java -jar} and a bare container do not, and an unresolved * {@code ${APP_*}} placeholder fails property binding. The failure is worse than it sounds: - * logback-spring.xml reads the same unresolved {@code ca-skeleton.logging.*} values, so the - * logging system dies first and the process exits having printed nothing at all. + * logback-spring.xml reads the same unresolved {@code app.logging.*} values, so the logging + * system dies first and the process exits having printed nothing at all. */ @Test void localProfileAnswersEveryRequiredPlaceholder() throws IOException { diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/StructuredLogFieldContractTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/StructuredLogFieldContractTest.java index 0bac8e01..46a0b0f9 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/StructuredLogFieldContractTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/StructuredLogFieldContractTest.java @@ -77,7 +77,7 @@ class StructuredLogFieldContractTest { .as("Logback initializes before dotenv-backed application.yml placeholders are reliable") .doesNotContain("source=\"spring.application.name\"") .doesNotContain("source=\"spring.profiles.active\"") - .doesNotContain("source=\"ca-skeleton.logging."); + .doesNotContain("source=\"app.logging."); assertThat(logback) .contains("source=\"APP_NAME\"") .contains("source=\"SPRING_PROFILES_ACTIVE\"") diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/TracingActivationContextTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/TracingActivationContextTest.java index 1d8350ee..9dc1fbb1 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/TracingActivationContextTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/TracingActivationContextTest.java @@ -39,11 +39,11 @@ import org.springframework.context.annotation.Import; "spring.config.location=optional:classpath:tracing-activation-test-no-config.yml", // The test classpath carries persistence-jpa, which is on while present; this slice excludes // the data layer, so it switches the module off too. - "ca-skeleton.persistence-jpa.enabled=false", + "app.persistence-jpa.enabled=false", // blank exporter endpoint = export off (무해) - "ca-skeleton.tracing.enabled=true", - "ca-skeleton.tracing.sample-rate=", - "ca-skeleton.tracing.exporter.otlp-endpoint=", + "app.tracing.enabled=true", + "app.tracing.sample-rate=", + "app.tracing.exporter.otlp-endpoint=", // Spring Boot management.tracing: enable for this slice "management.tracing.enabled=true", "spring.application.name=tracing-test" diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/messaging/MessagingAuthorityContractTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/messaging/MessagingAuthorityContractTest.java index 29736385..a981da95 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/messaging/MessagingAuthorityContractTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/messaging/MessagingAuthorityContractTest.java @@ -43,6 +43,10 @@ class MessagingAuthorityContractTest { private static final Pattern MESSAGING_PREFIX_CONSTANT = Pattern.compile("@ConfigurationProperties\\(prefix = MessagingSettings\\.PREFIX\\)"); + /** A strictly bound owner names its tree in a constant rather than an annotation. */ + private static final Pattern STRICT_BINDER_PREFIX = + Pattern.compile("String PREFIX\\s*=\\s*\"app\\.messaging\""); + private static final List MESSAGING_SOURCES = loadSources("adapter/outbound/messaging", "messaging", "app-bootstrap"); private static final List CORE_SOURCES = @@ -56,7 +60,8 @@ class MessagingAuthorityContractTest { .filter( source -> MESSAGING_PREFIX.matcher(source.text()).find() - || MESSAGING_PREFIX_CONSTANT.matcher(source.text()).find()) + || MESSAGING_PREFIX_CONSTANT.matcher(source.text()).find() + || STRICT_BINDER_PREFIX.matcher(source.text()).find()) .map(ProductionSource::path) .toList(); diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/support/ShippedConfiguration.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/support/ShippedConfiguration.java index bbfe85a2..f8658439 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/support/ShippedConfiguration.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/support/ShippedConfiguration.java @@ -129,8 +129,8 @@ public final class ShippedConfiguration { * The shipped configuration as one merged tree. * *

Merged recursively: module-owned files share second-level keys with the application's own - * ({@code ca-skeleton.capabilities.idempotency} holds the provider here and the Redis store's - * tuning in {@code cache-redis}), and a later file only adds or replaces leaves. + * ({@code app.capabilities.idempotency} holds the provider here and the Redis store's tuning in + * {@code cache-redis}), and a later file only adds or replaces leaves. * * @return root key to its merged subtree */ diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidatorTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidatorTest.java index c3fcd230..b435b223 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidatorTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidatorTest.java @@ -106,7 +106,6 @@ class SecretSourceValidatorTest { void prodProfileWithMissingRequiredSecretFailsStartup() { runner .withInitializer(ctx -> ctx.getEnvironment().setActiveProfiles("prod")) - .withPropertyValues("ca-skeleton.persistence-jpa.enabled=true") .run( context -> { assertThat(context).hasFailed(); @@ -116,7 +115,7 @@ class SecretSourceValidatorTest { e -> assertThat(e.errorCode()) .isEqualTo(StartupErrorCode.STARTUP_VALIDATION_FAILED)) - .hasStackTraceContaining("APP_DATASOURCE_PASSWORD"); + .hasStackTraceContaining("APP_PRIVACY_PSEUDONYMIZATION_SALT"); }); } @@ -125,7 +124,7 @@ class SecretSourceValidatorTest { runner .withInitializer(ctx -> ctx.getEnvironment().setActiveProfiles("prod")) .withPropertyValues(allRequiredSecretsPresent()) - .withPropertyValues("APP_DATASOURCE_PASSWORD=", "ca-skeleton.persistence-jpa.enabled=true") + .withPropertyValues("APP_PRIVACY_PSEUDONYMIZATION_SALT=") .run( context -> { assertThat(context).hasFailed(); @@ -135,19 +134,19 @@ class SecretSourceValidatorTest { e -> assertThat(e.errorCode()) .isEqualTo(StartupErrorCode.STARTUP_VALIDATION_FAILED)) - .hasStackTraceContaining("APP_DATASOURCE_PASSWORD"); + .hasStackTraceContaining("APP_PRIVACY_PSEUDONYMIZATION_SALT"); }); } @Test - void prodProfileWithoutRelationalPersistenceDoesNotRequireADatabasePassword() { - // The switch is set by the persistence-jpa module's shipped defaults; absent means the module - // is - // not in this composition, and a composition with no database owes no database password. + @DisplayName("guard는 persistence-jpa 스위치를 읽지 않는다: 모듈이 기여하지 않으면 DB 비밀번호를 요구하지 않는다") + void theGuardAloneDoesNotRequireADatabasePassword() { + // persistence-jpa contributes APP_DATASOURCE_PASSWORD while it is on (P22-new-1); the guard + // reads no module switch, so a composition without the module owes no database password. runner .withInitializer(ctx -> ctx.getEnvironment().setActiveProfiles("prod")) .withPropertyValues(allRequiredSecretsPresent()) - .withPropertyValues("APP_DATASOURCE_PASSWORD=") + .withPropertyValues("APP_DATASOURCE_PASSWORD=", "app.persistence-jpa.enabled=true") .run(context -> assertThat(context).hasNotFailed()); } diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/StartupSafetyValidatorTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/StartupSafetyValidatorTest.java index 71bbca30..d00b0130 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/StartupSafetyValidatorTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/StartupSafetyValidatorTest.java @@ -28,7 +28,7 @@ class StartupSafetyValidatorTest { @Test void multiInstanceEnabledWithMissingDistributedLockProviderFailsStartup() { runner - .withPropertyValues("ca-skeleton.runtime.multi-instance-enabled=true") + .withPropertyValues("app.runtime.multi-instance-enabled=true") .run( context -> { assertThat(context).hasFailed(); @@ -43,7 +43,7 @@ class StartupSafetyValidatorTest { @Test void multiInstanceEnabledWithTypedDistributedLockProviderStartsCleanly() { runner - .withPropertyValues("ca-skeleton.runtime.multi-instance-enabled=true") + .withPropertyValues("app.runtime.multi-instance-enabled=true") .withUserConfiguration(DistributedLockBean.class) .run(context -> assertThat(context).hasNotFailed()); } @@ -51,7 +51,7 @@ class StartupSafetyValidatorTest { @Test void multiInstanceEnabledRejectsANameOnlyPlaceholder() { runner - .withPropertyValues("ca-skeleton.runtime.multi-instance-enabled=true") + .withPropertyValues("app.runtime.multi-instance-enabled=true") .withUserConfiguration(WrongTypeDistributedLockBean.class) .run( context -> { diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/AuthenticationModeCompositionConfigTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/AuthenticationModeCompositionConfigTest.java index 1acec031..bba492f7 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/AuthenticationModeCompositionConfigTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/AuthenticationModeCompositionConfigTest.java @@ -15,13 +15,13 @@ class AuthenticationModeCompositionConfigTest { void jwtModeRequiresOnlyJwtInfrastructure() { runner .withBean("jwtDecoder", Object.class, Object::new) - .withPropertyValues("ca-skeleton.security.auth-mode=jwt") + .withPropertyValues("app.security.auth-mode=jwt") .run(context -> assertThat(context).hasNotFailed()); runner .withBean("jwtDecoder", Object.class, Object::new) .withBean("redisVersionedSessionRepository", Object.class, Object::new) - .withPropertyValues("ca-skeleton.security.auth-mode=jwt") + .withPropertyValues("app.security.auth-mode=jwt") .run( context -> { assertThat(context).hasFailed(); @@ -39,13 +39,13 @@ class AuthenticationModeCompositionConfigTest { runner .withBean("redisVersionedSessionRepository", Object.class, Object::new) .withBean("springSessionRepositoryFilter", Object.class, Object::new) - .withPropertyValues("ca-skeleton.security.auth-mode=redis-session") + .withPropertyValues("app.security.auth-mode=redis-session") .run(context -> assertThat(context).hasNotFailed()); runner .withBean("jwtDecoder", Object.class, Object::new) .withBean("redisVersionedSessionRepository", Object.class, Object::new) - .withPropertyValues("ca-skeleton.security.auth-mode=redis-session") + .withPropertyValues("app.security.auth-mode=redis-session") .run( context -> { assertThat(context).hasFailed(); diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/PublicHealthPathAgreementTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/PublicHealthPathAgreementTest.java index 81daa94b..0ca7c394 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/PublicHealthPathAgreementTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/PublicHealthPathAgreementTest.java @@ -36,8 +36,8 @@ class PublicHealthPathAgreementTest { new String[] { "application.yml", "application-local.yml", "application-dev.yml", "application-prod.yml" }) { - String basePath = resolved(resource, "ca-skeleton.presentation.api-base-path"); - String publicPaths = resolved(resource, "ca-skeleton.security.public-paths"); + String basePath = resolved(resource, "app.presentation.api-base-path"); + String publicPaths = resolved(resource, "app.security.public-paths"); if (basePath == null || publicPaths == null) { continue; } @@ -59,10 +59,9 @@ class PublicHealthPathAgreementTest { environment.getPropertySources().addLast(source); } - assertThat(environment.getProperty("ca-skeleton.security.public-paths")) + assertThat(environment.getProperty("app.security.public-paths")) .as("this is what a deployment that sets nothing gets, which is the case that broke") - .isEqualTo( - environment.getProperty("ca-skeleton.presentation.api-base-path") + "/healthcheck"); + .isEqualTo(environment.getProperty("app.presentation.api-base-path") + "/healthcheck"); } /** The value a profile ships, with placeholders resolved against the shipped defaults. */ diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/PublicPathSnapshotTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/PublicPathSnapshotTest.java index 225113be..18790a38 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/PublicPathSnapshotTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/security/PublicPathSnapshotTest.java @@ -36,7 +36,7 @@ class PublicPathSnapshotTest { private static final String HEADER = """ # feature-security-operational-baseline D5 — deny-by-default public path snapshot. - # SSOT: ca-skeleton.security.public-paths default in app-bootstrap/src/main/resources/config/security.yml + # SSOT: app.security.public-paths default in app-bootstrap/src/main/resources/config/security.yml # -> SecurityConfig permitAll(); anyRequest authenticated. An operator's own SECURITY_PUBLIC_PATHS # overrides it at run time and is outside this snapshot. # Update only after review with: ./gradlew verifyPublicPathSnapshot -PapprovePublicPathChange diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/settings/BootstrapSettingsTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/settings/BootstrapSettingsTest.java index 3fe3fe56..b2f992bc 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/settings/BootstrapSettingsTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/settings/BootstrapSettingsTest.java @@ -19,7 +19,7 @@ class BootstrapSettingsTest { @Test void appNameValidBinds() { runner - .withPropertyValues("ca-skeleton.bootstrap.app-name=ca-skeleton") + .withPropertyValues("app.bootstrap.app-name=ca-skeleton") .run( context -> { assertThat(context).hasNotFailed(); @@ -31,7 +31,7 @@ class BootstrapSettingsTest { @Test void appNameBlankFailsStartup() { runner - .withPropertyValues("ca-skeleton.bootstrap.app-name=") + .withPropertyValues("app.bootstrap.app-name=") .run( context -> { assertThat(context).hasFailed(); diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/settings/LoggingSettingsTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/settings/LoggingSettingsTest.java index 5fc4c1a0..e234e848 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/settings/LoggingSettingsTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/settings/LoggingSettingsTest.java @@ -59,12 +59,12 @@ class LoggingSettingsTest { void badTimezoneWarnsAndFallsBack() { runner .withPropertyValues( - "ca-skeleton.logging.json.timezone=Mars/Olympus_Mons", - "ca-skeleton.logging.json.timestamp-pattern=yyyy-MM-dd'T'HH:mm:ss.SSSXXX", - "ca-skeleton.logging.json.include-caller-data=false", - "ca-skeleton.logging.json.logger-name-length=0", - "ca-skeleton.logging.async.enabled=false", - "ca-skeleton.logging.file.enabled=false") + "app.logging.json.timezone=Mars/Olympus_Mons", + "app.logging.json.timestamp-pattern=yyyy-MM-dd'T'HH:mm:ss.SSSXXX", + "app.logging.json.include-caller-data=false", + "app.logging.json.logger-name-length=0", + "app.logging.async.enabled=false", + "app.logging.file.enabled=false") .run( context -> { assertThat(context).hasNotFailed(); @@ -81,14 +81,14 @@ class LoggingSettingsTest { void badAsyncQueueSizeWarnsAndFallsBack() { runner .withPropertyValues( - "ca-skeleton.logging.async.enabled=true", - "ca-skeleton.logging.async.queue-size=-1", - "ca-skeleton.logging.async.discarding-threshold=20", - "ca-skeleton.logging.file.enabled=false", - "ca-skeleton.logging.json.timezone=UTC", - "ca-skeleton.logging.json.timestamp-pattern=yyyy-MM-dd'T'HH:mm:ss.SSSXXX", - "ca-skeleton.logging.json.include-caller-data=false", - "ca-skeleton.logging.json.logger-name-length=0") + "app.logging.async.enabled=true", + "app.logging.async.queue-size=-1", + "app.logging.async.discarding-threshold=20", + "app.logging.file.enabled=false", + "app.logging.json.timezone=UTC", + "app.logging.json.timestamp-pattern=yyyy-MM-dd'T'HH:mm:ss.SSSXXX", + "app.logging.json.include-caller-data=false", + "app.logging.json.logger-name-length=0") .run( context -> { assertThat(context).hasNotFailed(); @@ -102,14 +102,14 @@ class LoggingSettingsTest { void validValuesNoWarning() { runner .withPropertyValues( - "ca-skeleton.logging.async.enabled=true", - "ca-skeleton.logging.async.queue-size=1024", - "ca-skeleton.logging.async.discarding-threshold=10", - "ca-skeleton.logging.file.enabled=false", - "ca-skeleton.logging.json.timezone=Asia/Seoul", - "ca-skeleton.logging.json.timestamp-pattern=yyyy-MM-dd'T'HH:mm:ss.SSSXXX", - "ca-skeleton.logging.json.include-caller-data=false", - "ca-skeleton.logging.json.logger-name-length=0") + "app.logging.async.enabled=true", + "app.logging.async.queue-size=1024", + "app.logging.async.discarding-threshold=10", + "app.logging.file.enabled=false", + "app.logging.json.timezone=Asia/Seoul", + "app.logging.json.timestamp-pattern=yyyy-MM-dd'T'HH:mm:ss.SSSXXX", + "app.logging.json.include-caller-data=false", + "app.logging.json.logger-name-length=0") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/app-bootstrap/src/test/resources/application-test.yml b/src/app-bootstrap/src/test/resources/application-test.yml index 827bb807..bc1f9586 100644 --- a/src/app-bootstrap/src/test/resources/application-test.yml +++ b/src/app-bootstrap/src/test/resources/application-test.yml @@ -102,7 +102,7 @@ logging: org.springframework.web: WARN org.hibernate.SQL: WARN -ca-skeleton: +app: bootstrap: app-name: ca-skeleton-test runtime: @@ -112,9 +112,6 @@ ca-skeleton: api-base-path: "" rate-limit: enabled: false - limit: 100 - window: 1s - algorithm: fixed-window security: issuer-uri: http://localhost:8081/realms/ca-skeleton-test audience: ca-skeleton-test diff --git a/src/application-core/CLAUDE.md b/src/application-core/CLAUDE.md index 74abf48b..97136749 100644 --- a/src/application-core/CLAUDE.md +++ b/src/application-core/CLAUDE.md @@ -161,7 +161,7 @@ generation; the V1 `IdempotencyScope`/`tryBegin` API is gone. principal + client key + operation code, computed before the executor sees it. The raw `Idempotency-Key` never reaches this layer or the store. - **Store**: `IdempotencyStorePort`, contributed by exactly one provider selected with - `ca-skeleton.capabilities.idempotency.provider` (`redis` → `cache-redis`, `postgresql` → + `app.capabilities.idempotency.provider` (`redis` → `cache-redis`, `postgresql` → `persistence-jpa`; default `disabled`). In-memory prod storage is forbidden. - **Executor**: built once by `composition:idempotency` `IdempotencyAutoConfiguration` from `IdempotencySettings` (processing lease 30s, replay TTL `APP_IDEMPOTENCY_TTL` 24h ≤72h, diff --git a/src/application-core/README.md b/src/application-core/README.md index e1b11796..c2213f46 100644 --- a/src/application-core/README.md +++ b/src/application-core/README.md @@ -244,7 +244,7 @@ application 계층이 claim·replay·복구 **정책** 을 소유하고, 저장 - 상태: `CLAIMED` / `EXECUTING` / `COMPLETED` / `FAILED_RETRYABLE` / `ABANDONED`(`IdempotencyState`). - 구현은 provider 하나만 붙는다: `redis`(`adapter:outbound:cache-redis` `RedisIdempotencyStoreAdapter`) 또는 `postgresql`(`adapter:outbound:persistence-jpa` - `PostgreSqlIdempotencyStore`). `ca-skeleton.capabilities.idempotency.provider` 로 고르고 + `PostgreSqlIdempotencyStore`). `app.capabilities.idempotency.provider` 로 고르고 기본값은 `disabled` 다. store 가 정확히 하나가 아니면 기동을 거부한다. - **in-memory 프로덕션 구현 금지**. 테스트용 `InMemoryIdempotencyStore` 는 testFixtures 에만 있다. diff --git a/src/composition/idempotency/README.md b/src/composition/idempotency/README.md index e16f4f53..50a362e9 100644 --- a/src/composition/idempotency/README.md +++ b/src/composition/idempotency/README.md @@ -18,7 +18,7 @@ composition:idempotency ``` - 저장소는 포트(`IdempotencyStorePort`)다. Redis는 `adapter:outbound:cache-redis`, PostgreSQL은 - `adapter:outbound:persistence-jpa`가 `ca-skeleton.capabilities.idempotency.provider`에 따라 하나를 + `adapter:outbound:persistence-jpa`가 `app.capabilities.idempotency.provider`에 따라 하나를 기여한다. 선택한 provider의 저장소가 정확히 하나가 아니면(0개: 모듈이 없거나 꺼짐, 2개: 다른 곳이 하나 더 등록) 기동이 개수와 함께 실패한다. - 켜기와 끄기: 모듈이 있어도 `provider=disabled`(기본)면 아무것도 바인딩하거나 만들지 않는다. @@ -66,7 +66,7 @@ executor, 설정 기본값이 함께 빠진다(그때 KEYED use case는 executor `disabled` 나 `redis` 를 쓴다. ### IdempotencySettings -- `ca-skeleton.capabilities.idempotency` 에 바인딩되는 유일한 설정 record 다(값은 +- `app.capabilities.idempotency` 에 바인딩되는 유일한 설정 record 다(값은 `config/module-defaults/idempotency.yml`). | 키 | env | 기본값 | 상한 | diff --git a/src/composition/idempotency/src/main/java/dev/caskeleton/composition/idempotency/IdempotencyAutoConfiguration.java b/src/composition/idempotency/src/main/java/dev/caskeleton/composition/idempotency/IdempotencyAutoConfiguration.java index abf9a85d..1a26e96f 100644 --- a/src/composition/idempotency/src/main/java/dev/caskeleton/composition/idempotency/IdempotencyAutoConfiguration.java +++ b/src/composition/idempotency/src/main/java/dev/caskeleton/composition/idempotency/IdempotencyAutoConfiguration.java @@ -1,5 +1,6 @@ package dev.caskeleton.composition.idempotency; +import dev.caskeleton.adapter.outbound.support.CapabilitySelectors; import dev.caskeleton.adapter.outbound.support.startup.StartupFailures; import dev.caskeleton.application.idempotency.IdempotencyExecutor; import dev.caskeleton.application.idempotency.IdempotencyStorePort; @@ -16,11 +17,11 @@ import org.springframework.core.env.Environment; * *

Providers contribute only an {@link IdempotencyStorePort}: Redis from {@code * adapter:outbound:cache-redis}, PostgreSQL from {@code adapter:outbound:persistence-jpa}, each - * conditional on {@code ca-skeleton.capabilities.idempotency.provider}. The lifecycle policy — - * lease, replay TTL, retention, codec id, policy revision — is the same whichever store holds the - * records, so it lives in one {@link IdempotencySettings} record and the executor is built here - * from it. Every composition root that serves idempotent requests takes this module rather than a - * copy of it: the application and the sample build the same executor from the same checks. + * conditional on {@code app.capabilities.idempotency.provider}. The lifecycle policy — lease, + * replay TTL, retention, codec id, policy revision — is the same whichever store holds the records, + * so it lives in one {@link IdempotencySettings} record and the executor is built here from it. + * Every composition root that serves idempotent requests takes this module rather than a copy of + * it: the application and the sample build the same executor from the same checks. * *

A selected provider must yield exactly one store. None means the provider's module is not on * the runtime classpath or its switch is off; two means something else registered one (a scan-found @@ -33,7 +34,9 @@ import org.springframework.core.env.Environment; */ @AutoConfiguration @ConditionalOnExpression( - "!'${ca-skeleton.capabilities.idempotency.provider:disabled}'.trim()" + "!'${" + + CapabilitySelectors.IDEMPOTENCY_PROVIDER + + ":disabled}'.trim()" + ".equalsIgnoreCase('disabled')") public class IdempotencyAutoConfiguration { @@ -48,7 +51,8 @@ public class IdempotencyAutoConfiguration { List found = stores.orderedStream().toList(); if (found.size() != 1) { throw StartupFailures.requiredAdapterDisabled( - "ca-skeleton.capabilities.idempotency.provider=" + CapabilitySelectors.IDEMPOTENCY_PROVIDER + + "=" + settings.provider().name().toLowerCase(Locale.ROOT) + " needs exactly one IdempotencyStorePort, but found " + found.size() diff --git a/src/composition/idempotency/src/main/java/dev/caskeleton/composition/idempotency/IdempotencySettings.java b/src/composition/idempotency/src/main/java/dev/caskeleton/composition/idempotency/IdempotencySettings.java index d4de570c..bbe746b1 100644 --- a/src/composition/idempotency/src/main/java/dev/caskeleton/composition/idempotency/IdempotencySettings.java +++ b/src/composition/idempotency/src/main/java/dev/caskeleton/composition/idempotency/IdempotencySettings.java @@ -7,10 +7,9 @@ import java.util.Set; import org.springframework.core.env.Environment; /** - * The one settings record for request idempotency, bound at {@code - * ca-skeleton.capabilities.idempotency}. The executor is built from it once, whichever provider - * supplies the store. Every value is checked here, so a bad value fails startup rather than the - * first request. + * The one settings record for request idempotency, bound at {@code app.capabilities.idempotency}. + * The executor is built from it once, whichever provider supplies the store. Every value is checked + * here, so a bad value fails startup rather than the first request. * *

The Redis store reads its own two knobs ({@code key-version}, {@code command-timeout}) under * the same prefix; they are store tuning, not lifecycle policy, so they are not repeated here. The @@ -34,7 +33,7 @@ public record IdempotencySettings( Integer policyRevision, Duration reaperInterval) { - static final String PREFIX = "ca-skeleton.capabilities.idempotency"; + static final String PREFIX = "app.capabilities.idempotency"; /** Keys under the prefix that the Redis store binds for itself. */ static final Set STORE_OWNED_KEYS = Set.of("key-version", "command-timeout"); diff --git a/src/composition/idempotency/src/main/resources/config/module-defaults/idempotency.yml b/src/composition/idempotency/src/main/resources/config/module-defaults/idempotency.yml index 553c42b1..1a4a1b19 100644 --- a/src/composition/idempotency/src/main/resources/config/module-defaults/idempotency.yml +++ b/src/composition/idempotency/src/main/resources/config/module-defaults/idempotency.yml @@ -5,7 +5,7 @@ # adapter:outbound:support 의 ModuleDefaultsEnvironmentPostProcessor 가 읽는다. 우선순위는 가장 낮아서 # application*.yml, 환경 변수, 시스템 속성이 항상 이긴다. 이 모듈을 빌드에서 빼면 이 파일도 함께 # 빠진다. -ca-skeleton: +app: capabilities: idempotency: # disabled | redis | postgresql. Exactly one store; the executor is built once over it from diff --git a/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencyAutoConfigurationTest.java b/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencyAutoConfigurationTest.java index 8ec4b8ca..22b751cd 100644 --- a/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencyAutoConfigurationTest.java +++ b/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencyAutoConfigurationTest.java @@ -37,12 +37,12 @@ class IdempotencyAutoConfigurationTest { .withBean(JdbcOperations.class, () -> org.mockito.Mockito.mock(JdbcOperations.class)) .withBean(Clock.class, Clock::systemUTC) // The schema stream talks to a real database; its own integration test covers it. - .withPropertyValues("ca-skeleton.runtime.migration-on-startup=false"); + .withPropertyValues("app.runtime.migration-on-startup=false"); @Test void disabledComposesNoExecutorEvenWithAStorePresent() { runner - .withPropertyValues("ca-skeleton.capabilities.idempotency.provider=disabled") + .withPropertyValues("app.capabilities.idempotency.provider=disabled") .withBean(IdempotencyStorePort.class, InMemoryIdempotencyStore::new) .run( context -> @@ -52,7 +52,7 @@ class IdempotencyAutoConfigurationTest { @Test void redisComposesOneExecutorOverTheRedisStoreAlone() { runner - .withPropertyValues("ca-skeleton.capabilities.idempotency.provider=redis") + .withPropertyValues("app.capabilities.idempotency.provider=redis") .withBean(IdempotencyStorePort.class, InMemoryIdempotencyStore::new) .run( context -> @@ -66,7 +66,7 @@ class IdempotencyAutoConfigurationTest { @Test void postgresqlComposesOneExecutorOverThePersistenceJpaStore() { runner - .withPropertyValues("ca-skeleton.capabilities.idempotency.provider=postgresql") + .withPropertyValues("app.capabilities.idempotency.provider=postgresql") .run( context -> assertThat(context) @@ -81,7 +81,7 @@ class IdempotencyAutoConfigurationTest { @DisplayName("a selected provider whose module contributed no store fails startup with the count") void selectedProviderWithoutAStoreFailsStartup() { runner - .withPropertyValues("ca-skeleton.capabilities.idempotency.provider=redis") + .withPropertyValues("app.capabilities.idempotency.provider=redis") .run( context -> assertThat(context) @@ -96,7 +96,7 @@ class IdempotencyAutoConfigurationTest { @DisplayName("a second store beside the selected one fails startup with the count") void secondStoreBesideTheSelectedOneFailsStartup() { runner - .withPropertyValues("ca-skeleton.capabilities.idempotency.provider=postgresql") + .withPropertyValues("app.capabilities.idempotency.provider=postgresql") .withBean("strayStore", IdempotencyStorePort.class, InMemoryIdempotencyStore::new) .run( context -> diff --git a/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencyModuleDefaultsTest.java b/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencyModuleDefaultsTest.java index ef3679e9..b0faa4bb 100644 --- a/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencyModuleDefaultsTest.java +++ b/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencyModuleDefaultsTest.java @@ -28,7 +28,7 @@ class IdempotencyModuleDefaultsTest { StandardEnvironment environment = processed(Map.of()); // then - assertThat(environment.getProperty("ca-skeleton.capabilities.idempotency.provider")) + assertThat(environment.getProperty("app.capabilities.idempotency.provider")) .isEqualTo("disabled"); } @@ -38,7 +38,7 @@ class IdempotencyModuleDefaultsTest { StandardEnvironment environment = processed(Map.of("APP_IDEMPOTENCY_PROVIDER", "postgresql")); // then - assertThat(environment.getProperty("ca-skeleton.capabilities.idempotency.provider")) + assertThat(environment.getProperty("app.capabilities.idempotency.provider")) .isEqualTo("postgresql"); } diff --git a/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencySettingsTest.java b/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencySettingsTest.java index 770dc6ff..37903827 100644 --- a/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencySettingsTest.java +++ b/src/composition/idempotency/src/test/java/dev/caskeleton/composition/idempotency/IdempotencySettingsTest.java @@ -15,7 +15,7 @@ import org.springframework.mock.env.MockEnvironment; class IdempotencySettingsTest { - private static final String PREFIX = "ca-skeleton.capabilities.idempotency."; + private static final String PREFIX = "app.capabilities.idempotency."; @Test void absentLifecycleKeysBindToTheDocumentedDefaults() { @@ -80,7 +80,7 @@ class IdempotencySettingsTest { // then assertThat(thrown) .isInstanceOf(BindException.class) - .hasStackTraceContaining("ca-skeleton.capabilities.idempotency.provider"); + .hasStackTraceContaining("app.capabilities.idempotency.provider"); } /** @@ -148,7 +148,7 @@ class IdempotencySettingsTest { .isInstanceOfSatisfying( StartupFailureException.class, e -> assertThat(e.errorCode()).isEqualTo(StartupErrorCode.STARTUP_VALIDATION_FAILED)) - .hasMessageContaining("ca-skeleton.capabilities.idempotency." + message); + .hasMessageContaining("app.capabilities.idempotency." + message); } @ParameterizedTest @@ -166,7 +166,7 @@ class IdempotencySettingsTest { .isInstanceOfSatisfying( StartupFailureException.class, e -> assertThat(e.errorCode()).isEqualTo(StartupErrorCode.STARTUP_VALIDATION_FAILED)) - .hasMessageContaining("ca-skeleton.capabilities.idempotency." + message); + .hasMessageContaining("app.capabilities.idempotency." + message); } @Test @@ -183,7 +183,6 @@ class IdempotencySettingsTest { .isInstanceOfSatisfying( StartupFailureException.class, e -> assertThat(e.errorCode()).isEqualTo(StartupErrorCode.STARTUP_VALIDATION_FAILED)) - .hasMessageContaining( - "ca-skeleton.capabilities.idempotency.policy-revision must be positive"); + .hasMessageContaining("app.capabilities.idempotency.policy-revision must be positive"); } } diff --git a/src/composition/notification-platform/README.md b/src/composition/notification-platform/README.md index 36a1f840..54bee102 100644 --- a/src/composition/notification-platform/README.md +++ b/src/composition/notification-platform/README.md @@ -44,7 +44,7 @@ runtimeOnly project(':composition:notification-platform') // 알림 (저 ## 켜기와 끄기 -모듈이 있으면 켜진다. `ca-skeleton.notification.platform.enabled`(`APP_NOTIFICATION_PLATFORM_ENABLED`, +모듈이 있으면 켜진다. `app.notification.platform.enabled`(`APP_NOTIFICATION_PLATFORM_ENABLED`, 기본 `true`)를 `false`로 줄 때만 꺼지고, 그때는 아무것도 바인딩하지 않는다. 켜진 상태에서는 아래 "항상" 키가 없으면 기동이 거부된다. diff --git a/src/composition/notification-platform/src/main/java/dev/caskeleton/composition/notification/NotificationApplicationCompositionAutoConfiguration.java b/src/composition/notification-platform/src/main/java/dev/caskeleton/composition/notification/NotificationApplicationCompositionAutoConfiguration.java index 98a3d765..bfb43440 100644 --- a/src/composition/notification-platform/src/main/java/dev/caskeleton/composition/notification/NotificationApplicationCompositionAutoConfiguration.java +++ b/src/composition/notification-platform/src/main/java/dev/caskeleton/composition/notification/NotificationApplicationCompositionAutoConfiguration.java @@ -15,7 +15,7 @@ import org.springframework.context.annotation.Import; afterName = "dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationPlatformAutoConfiguration") @ConditionalOnProperty( - prefix = "ca-skeleton.notification.platform", + prefix = "app.notification.platform", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/composition/notification-platform/src/main/java/dev/caskeleton/composition/notification/NotificationSubmissionConfiguration.java b/src/composition/notification-platform/src/main/java/dev/caskeleton/composition/notification/NotificationSubmissionConfiguration.java index f7debb0a..fa56a576 100644 --- a/src/composition/notification-platform/src/main/java/dev/caskeleton/composition/notification/NotificationSubmissionConfiguration.java +++ b/src/composition/notification-platform/src/main/java/dev/caskeleton/composition/notification/NotificationSubmissionConfiguration.java @@ -88,7 +88,7 @@ class NotificationSubmissionConfiguration { PlanFingerprint fingerprints, TransactionPort transactions, Clock clock, - @Value("${ca-skeleton.notification.platform.default-locale:ko-KR}") String defaultLocale) { + @Value("${app.notification.platform.default-locale:ko-KR}") String defaultLocale) { return new AcceptNotificationApplicationUseCase( submit, contactPoints, diff --git a/src/composition/notification-platform/src/main/resources/config/module-defaults/notification.yml b/src/composition/notification-platform/src/main/resources/config/module-defaults/notification.yml index 3e2e94b2..e1c6534b 100644 --- a/src/composition/notification-platform/src/main/resources/config/module-defaults/notification.yml +++ b/src/composition/notification-platform/src/main/resources/config/module-defaults/notification.yml @@ -18,9 +18,9 @@ info: capabilities: notification: - enabled: ${ca-skeleton.notification.platform.enabled:true} + enabled: ${app.notification.platform.enabled:true} -ca-skeleton: +app: notification: platform: # The capability switch. False binds nothing at all. @@ -133,7 +133,7 @@ ca-skeleton: # to set one gets a traceable bounce rather than mail apparently from an address it does not # own. sender-identity: ${APP_NOTIFICATION_PLATFORM_SMTP_SENDER_IDENTITY:no-reply@example.invalid} - max-concurrency: ${APP_NOTIFICATION_PLATFORM_SMTP_DISPATCH_CONCURRENCY:4} + dispatch-concurrency: ${APP_NOTIFICATION_PLATFORM_SMTP_DISPATCH_CONCURRENCY:4} # ---- Key material ------------------------------------------------------- # Seven purposes, seven keys, each base64 of at least 32 bytes and each distinct from every # other. The platform decodes them at startup and refuses to boot if one is blank, short or @@ -176,12 +176,10 @@ ca-skeleton: # none. See docs/notification/at-rest-threat-model.md for the rotation sequence. historical-keys: {} -app: - notification: # R0 compatibility provider gates. These booleans are the properties the provider # configurations actually consume; the removed provider-id selectors were never read. # This is the R0 legacy seam. The delivery platform is the separate - # ca-skeleton.notification.platform tree below. + # app.notification.platform tree above. slack-webhook: enabled: ${APP_NOTIFICATION_SLACK_WEBHOOK_ENABLED:false} google-email: diff --git a/src/composition/notification-platform/src/test/java/dev/caskeleton/composition/notification/NotificationApplicationCompositionAutoConfigurationTest.java b/src/composition/notification-platform/src/test/java/dev/caskeleton/composition/notification/NotificationApplicationCompositionAutoConfigurationTest.java index 0da71a2c..8196ca72 100644 --- a/src/composition/notification-platform/src/test/java/dev/caskeleton/composition/notification/NotificationApplicationCompositionAutoConfigurationTest.java +++ b/src/composition/notification-platform/src/test/java/dev/caskeleton/composition/notification/NotificationApplicationCompositionAutoConfigurationTest.java @@ -27,7 +27,7 @@ class NotificationApplicationCompositionAutoConfigurationTest { new ApplicationContextRunner() .withConfiguration( AutoConfigurations.of(NotificationApplicationCompositionAutoConfiguration.class)) - .withPropertyValues("ca-skeleton.notification.platform.enabled=false") + .withPropertyValues("app.notification.platform.enabled=false") .run( context -> assertThat(context) diff --git a/src/composition/notification-platform/src/test/java/dev/caskeleton/composition/notification/NotificationModuleDefaultsTest.java b/src/composition/notification-platform/src/test/java/dev/caskeleton/composition/notification/NotificationModuleDefaultsTest.java index 65f34aaf..e5b2b358 100644 --- a/src/composition/notification-platform/src/test/java/dev/caskeleton/composition/notification/NotificationModuleDefaultsTest.java +++ b/src/composition/notification-platform/src/test/java/dev/caskeleton/composition/notification/NotificationModuleDefaultsTest.java @@ -18,10 +18,8 @@ class NotificationModuleDefaultsTest { void theShippedDefaultsTurnThePlatformOnWhileTheModuleIsPresent() { StandardEnvironment environment = processed(Map.of()); - assertThat(environment.getProperty("ca-skeleton.notification.platform.enabled")) - .isEqualTo("true"); - assertThat(environment.getProperty("ca-skeleton.notification.platform.mode")) - .isEqualTo("SERVING"); + assertThat(environment.getProperty("app.notification.platform.enabled")).isEqualTo("true"); + assertThat(environment.getProperty("app.notification.platform.mode")).isEqualTo("SERVING"); } @Test @@ -29,24 +27,22 @@ class NotificationModuleDefaultsTest { StandardEnvironment environment = processed(Map.of("APP_NOTIFICATION_PLATFORM_ENABLED", "false")); - assertThat(environment.getProperty("ca-skeleton.notification.platform.enabled")) - .isEqualTo("false"); + assertThat(environment.getProperty("app.notification.platform.enabled")).isEqualTo("false"); } @Test void aDeploymentValueOutranksTheShippedDefault() { StandardEnvironment environment = - processed(Map.of("ca-skeleton.notification.platform.mode", "INGEST_ONLY")); + processed(Map.of("app.notification.platform.mode", "INGEST_ONLY")); - assertThat(environment.getProperty("ca-skeleton.notification.platform.mode")) - .isEqualTo("INGEST_ONLY"); + assertThat(environment.getProperty("app.notification.platform.mode")).isEqualTo("INGEST_ONLY"); } @Test void bothNotificationTreesShipInTheOneFile() { StandardEnvironment environment = processed(Map.of()); - assertThat(environment.getProperty("ca-skeleton.notification.platform.dispatch.lease-duration")) + assertThat(environment.getProperty("app.notification.platform.dispatch.lease-duration")) .isEqualTo("2m"); assertThat(environment.getProperty("app.notification.slack-webhook.enabled")) .isEqualTo("false"); diff --git a/src/composition/outbox-relay/README.md b/src/composition/outbox-relay/README.md index 1e7d97a5..db52e264 100644 --- a/src/composition/outbox-relay/README.md +++ b/src/composition/outbox-relay/README.md @@ -12,8 +12,8 @@ use case는 `OutboxAppendPort`로 append만 하고, relay가 나머지를 한다 ``` composition:outbox-relay - └─ OutboxRelayAutoConfiguration ca-skeleton.outbox.enabled=true + OutboxStorePort 가 있을 때만 - ├─ OutboxSettings ca-skeleton.outbox.* strict 바인딩(오타는 기동 실패) + └─ OutboxRelayAutoConfiguration app.outbox.enabled=true + OutboxStorePort 가 있을 때만 + ├─ OutboxSettings app.outbox.* strict 바인딩(오타는 기동 실패) ├─ OutboxRelayScheduler relay-enabled=true + OutboxMessagePublishPort 가 있을 때만, │ PublishPendingOutboxEventsUseCase 를 fixed-delay 로 구동 ├─ OutboxMetrics outbox.pending.size / outbox.publisher.lag / published.total @@ -27,7 +27,7 @@ composition:outbox-relay 둔다(대역 publisher로 DEAD까지 소진하지 않는다). - persistence-jpa 안이 아니라 여기 있는 이유: driven adapter는 use case를 만들거나 부르지 않는다 (ArchUnit `PERSISTENCE_DOES_NOT_DEPEND_ON_APPLICATION_SERVICES`). -- 설정 기본값: `ca-skeleton.outbox.*`의 기본값은 store를 가진 persistence-jpa가 +- 설정 기본값: `app.outbox.*`의 기본값은 store를 가진 persistence-jpa가 `config/module-defaults/persistence-jpa.yml`로 싣는다(store와 reaper도 `enabled`, `reaper-interval`, `published-retention`을 읽는다). 키의 선언과 검증은 이 모듈의 `OutboxSettings` 하나다. @@ -51,7 +51,7 @@ runtimeOnly project(':composition:outbox-relay') // outbox relay | 항상 | persistence-jpa 줄과 그 연결 env, `APP_OUTBOX_ENABLED=true` | | relay를 돌릴 때 | `APP_OUTBOX_RELAY_ENABLED=true`, 그리고 발행 capability(`adapter:outbound:messaging-kafka` 줄과 `APP_MESSAGING_PRODUCER_ID`, `APP_MESSAGING_KAFKA_BROKERS`) | -poll 주기·batch 크기·in-flight timeout·보존 기간은 env 키 없이 `ca-skeleton.outbox.*` 기본값으로 +poll 주기·batch 크기·in-flight timeout·보존 기간은 env 키 없이 `app.outbox.*` 기본값으로 동작한다. ## 설계 결정 참조 (app-bootstrap에서 옮김) @@ -72,7 +72,7 @@ poll 주기·batch 크기·in-flight timeout·보존 기간은 env 키 없이 `c 감싼다. 그런데 use case 가 `final` 클래스라 프록시 생성 자체가 실패하고, 설령 된다 해도 스케줄러 스레드에는 `Authentication`이 없어 매 릴레이 틱이 fail-closed 로 거부된다. 그래서 빈으로 올리지 않고, `outbox:relay` 권한 확인은 스케줄러 컨텍스트에서 관례로 둔다. -- **`outboxRelayScheduler` 빈은 `ca-skeleton.outbox.relay-enabled=true`일 때만 만든다(기본 +- **`outboxRelayScheduler` 빈은 `app.outbox.relay-enabled=true`일 때만 만든다(기본 false).** 키가 없으면 꺼진 것으로 본다. 모듈 기본값(`persistence-jpa.yml`의 `${APP_OUTBOX_RELAY_ENABLED:false}`), `@ConditionalOnProperty`, `OutboxSettings`의 null 기본값이 모두 false로 같다. @@ -133,5 +133,5 @@ poll 주기·batch 크기·in-flight timeout·보존 기간은 env 키 없이 `c `PT5M`, `PT10M`, `P7D`)을 채운다. - **`reaper-interval`과 `published-retention`은 `adapter-persistence`의 `OutboxReaper`도 property 문자열로 읽는다.** 두 모듈이 같은 키를 공유하지만, 이 settings record 가 일곱 값 전체를 선언 - 하는 단일 지점(single place) 역할을 한다. strict 바인딩이라 prefix 아래 모르는 키는 기동 실패다. 기본값 yml(`ca-skeleton.outbox.*`)은 store를 가진 + 하는 단일 지점(single place) 역할을 한다. strict 바인딩이라 prefix 아래 모르는 키는 기동 실패다. 기본값 yml(`app.outbox.*`)은 store를 가진 persistence-jpa 모듈이 `config/module-defaults/persistence-jpa.yml`로 가져온다. diff --git a/src/composition/outbox-relay/build.gradle b/src/composition/outbox-relay/build.gradle index c051a819..5c227e88 100644 --- a/src/composition/outbox-relay/build.gradle +++ b/src/composition/outbox-relay/build.gradle @@ -9,7 +9,7 @@ plugins { // // It builds the relay use case over the outbox store and the publish port and drives it on a // timer, with its metrics. It names no module: the store (persistence-jpa, with -// ca-skeleton.outbox.enabled) and the publish port (the messaging bridge) are ports, and the relay +// app.outbox.enabled) and the publish port (the messaging bridge) are ports, and the relay // assembles nothing until both exist. It lives here rather than in persistence-jpa because a // driven adapter must not construct or call a use case. // diff --git a/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxRelayAutoConfiguration.java b/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxRelayAutoConfiguration.java index a78b53cd..6242b001 100644 --- a/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxRelayAutoConfiguration.java +++ b/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxRelayAutoConfiguration.java @@ -29,10 +29,10 @@ import org.springframework.scheduling.annotation.EnableScheduling; * PERSISTENCE_DOES_NOT_DEPEND_ON_APPLICATION_SERVICES}). It names no module type, only ports, and * turns itself on from what the selected modules provide. * - *

{@code ca-skeleton.outbox.enabled} is the capability switch; {@code relay-enabled} only - * decides whether the scheduler runs. The store port exists only while the persistence-jpa module - * is selected and its outbox is on, so this configuration waits for it: removing that module's - * build line removes the relay with it. + *

{@code app.outbox.enabled} is the capability switch; {@code relay-enabled} only decides + * whether the scheduler runs. The store port exists only while the persistence-jpa module is + * selected and its outbox is on, so this configuration waits for it: removing that module's build + * line removes the relay with it. * *

The scheduler additionally needs somewhere to publish. It is created only when an {@link * OutboxMessagePublishPort} bean exists — the messaging bridge contributes one — so a deployment @@ -45,7 +45,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; "dev.caskeleton.adapter.outbound.persistence.autoconfigure.PersistenceJpaAutoConfiguration", "dev.caskeleton.adapter.outbound.messaging.autoconfigure.MessagingBridgeRootAutoConfiguration" }) -@ConditionalOnProperty(prefix = "ca-skeleton.outbox", name = "enabled", havingValue = "true") +@ConditionalOnProperty(prefix = "app.outbox", name = "enabled", havingValue = "true") @ConditionalOnBean(OutboxStorePort.class) // The relay is @Scheduled. It must switch scheduling on itself rather than rely on another // capability (the PostgreSQL idempotency provider also does), or the relay runs only by accident. @@ -60,7 +60,7 @@ public class OutboxRelayAutoConfiguration { /** Relay use case is assembled manually here (not a bean) from {@link OutboxSettings} values. */ @Bean - @ConditionalOnProperty(name = "ca-skeleton.outbox.relay-enabled", havingValue = "true") + @ConditionalOnProperty(name = "app.outbox.relay-enabled", havingValue = "true") @ConditionalOnBean(OutboxMessagePublishPort.class) public OutboxRelayScheduler outboxRelayScheduler( OutboxStorePort store, diff --git a/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxRelayScheduler.java b/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxRelayScheduler.java index 1a4c58c6..315a29a7 100644 --- a/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxRelayScheduler.java +++ b/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxRelayScheduler.java @@ -33,7 +33,7 @@ public class OutboxRelayScheduler { * Unexpected exceptions are caught (not propagated) so the scheduler thread stays alive for the * next tick. */ - @Scheduled(fixedDelayString = "${ca-skeleton.outbox.poll-interval:PT5S}") + @Scheduled(fixedDelayString = "${app.outbox.poll-interval:PT5S}") public void relay() { try { OutboxRelayResult result = relayUseCase.handle(PublishPendingOutboxEventsCommand.INSTANCE); diff --git a/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxSettings.java b/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxSettings.java index d438286e..5b4ff293 100644 --- a/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxSettings.java +++ b/src/composition/outbox-relay/src/main/java/dev/caskeleton/composition/outbox/OutboxSettings.java @@ -6,9 +6,9 @@ import java.time.Duration; import org.springframework.core.env.Environment; /** - * The outbox capability's settings, bound strictly from {@code ca-skeleton.outbox.*}: every key - * under the prefix is one of these, so a misspelt one fails startup instead of leaving a default in - * force. The persistence module reads {@code enabled}, {@code reaper-interval} and {@code + * The outbox capability's settings, bound strictly from {@code app.outbox.*}: every key under the + * prefix is one of these, so a misspelt one fails startup instead of leaving a default in force. + * The persistence module reads {@code enabled}, {@code reaper-interval} and {@code * published-retention} too — the store and its reaper — but the keys are declared and validated * once, here. * @@ -30,7 +30,7 @@ public record OutboxSettings( Duration reaperInterval, Duration publishedRetention) { - static final String PREFIX = "ca-skeleton.outbox"; + static final String PREFIX = "app.outbox"; public OutboxSettings { if (enabled == null) { diff --git a/src/composition/outbox-relay/src/test/java/dev/caskeleton/composition/outbox/OutboxRelayAutoConfigurationTest.java b/src/composition/outbox-relay/src/test/java/dev/caskeleton/composition/outbox/OutboxRelayAutoConfigurationTest.java index 0ed99bc4..9ad94203 100644 --- a/src/composition/outbox-relay/src/test/java/dev/caskeleton/composition/outbox/OutboxRelayAutoConfigurationTest.java +++ b/src/composition/outbox-relay/src/test/java/dev/caskeleton/composition/outbox/OutboxRelayAutoConfigurationTest.java @@ -41,12 +41,10 @@ class OutboxRelayAutoConfigurationTest { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(OutboxRelayAutoConfiguration.class)) .withBean(OutboxStorePort.class, OutboxRelayAutoConfigurationTest::unusedStore) - .withPropertyValues("ca-skeleton.outbox.enabled=true", "ca-skeleton.outbox.batch-sise=500") + .withPropertyValues("app.outbox.enabled=true", "app.outbox.batch-sise=500") .run( context -> - assertThat(context) - .getFailure() - .hasStackTraceContaining("ca-skeleton.outbox.batch-sise")); + assertThat(context).getFailure().hasStackTraceContaining("app.outbox.batch-sise")); } @Test @@ -57,9 +55,9 @@ class OutboxRelayAutoConfigurationTest { .withConfiguration(AutoConfigurations.of(OutboxRelayAutoConfiguration.class)) .withBean(OutboxStorePort.class, OutboxRelayAutoConfigurationTest::unusedStore) .withPropertyValues( - "ca-skeleton.outbox.enabled=true", - "ca-skeleton.outbox.relay-enabled=false", - "ca-skeleton.capabilities.idempotency.provider=disabled"); + "app.outbox.enabled=true", + "app.outbox.relay-enabled=false", + "app.capabilities.idempotency.provider=disabled"); // when & then runner.run( @@ -77,8 +75,7 @@ class OutboxRelayAutoConfigurationTest { .withBean(OutboxRelayFailureReportPort.class, () -> report -> {}) .withBean(TransactionPort.class, () -> mock(TransactionPort.class)) .withBean(Clock.class, Clock::systemUTC) - .withPropertyValues( - "ca-skeleton.outbox.enabled=true", "ca-skeleton.outbox.relay-enabled=true"); + .withPropertyValues("app.outbox.enabled=true", "app.outbox.relay-enabled=true"); // No publish port: PENDING rows stay PENDING rather than being failed to DEAD. relayOn.run(context -> assertThat(context).doesNotHaveBean(OutboxRelayScheduler.class)); @@ -96,7 +93,7 @@ class OutboxRelayAutoConfigurationTest { .withBean(TransactionPort.class, () -> mock(TransactionPort.class)) .withBean(Clock.class, Clock::systemUTC) .withBean(OutboxMessagePublishPort.class, () -> mock(OutboxMessagePublishPort.class)) - .withPropertyValues("ca-skeleton.outbox.enabled=true") + .withPropertyValues("app.outbox.enabled=true") .run( context -> assertThat(context) @@ -108,7 +105,7 @@ class OutboxRelayAutoConfigurationTest { void withoutTheRelationalStoreTheOutboxAssemblesNothing() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(OutboxRelayAutoConfiguration.class)) - .withPropertyValues("ca-skeleton.outbox.enabled=true") + .withPropertyValues("app.outbox.enabled=true") .run(context -> assertThat(context).doesNotHaveBean(OutboxMetrics.class)); } diff --git a/src/composition/outbox-relay/src/test/java/dev/caskeleton/composition/outbox/OutboxSettingsTest.java b/src/composition/outbox-relay/src/test/java/dev/caskeleton/composition/outbox/OutboxSettingsTest.java index 07dede80..2a90ed07 100644 --- a/src/composition/outbox-relay/src/test/java/dev/caskeleton/composition/outbox/OutboxSettingsTest.java +++ b/src/composition/outbox-relay/src/test/java/dev/caskeleton/composition/outbox/OutboxSettingsTest.java @@ -37,13 +37,13 @@ class OutboxSettingsTest { // given MockEnvironment environment = new MockEnvironment() - .withProperty("ca-skeleton.outbox.enabled", "true") - .withProperty("ca-skeleton.outbox.relay-enabled", "true") - .withProperty("ca-skeleton.outbox.poll-interval", "10s") - .withProperty("ca-skeleton.outbox.batch-size", "50") - .withProperty("ca-skeleton.outbox.in-flight-timeout", "2m") - .withProperty("ca-skeleton.outbox.reaper-interval", "1h") - .withProperty("ca-skeleton.outbox.published-retention", "14d"); + .withProperty("app.outbox.enabled", "true") + .withProperty("app.outbox.relay-enabled", "true") + .withProperty("app.outbox.poll-interval", "10s") + .withProperty("app.outbox.batch-size", "50") + .withProperty("app.outbox.in-flight-timeout", "2m") + .withProperty("app.outbox.reaper-interval", "1h") + .withProperty("app.outbox.published-retention", "14d"); // when OutboxSettings settings = OutboxSettings.bind(environment); @@ -73,7 +73,7 @@ class OutboxSettingsTest { .isInstanceOfSatisfying( StartupFailureException.class, e -> assertThat(e.errorCode()).isEqualTo(StartupErrorCode.STARTUP_VALIDATION_FAILED)) - .hasMessageContaining("ca-skeleton.outbox." + message); + .hasMessageContaining("app.outbox." + message); } @ParameterizedTest @@ -97,6 +97,6 @@ class OutboxSettingsTest { .isInstanceOfSatisfying( StartupFailureException.class, e -> assertThat(e.errorCode()).isEqualTo(StartupErrorCode.STARTUP_VALIDATION_FAILED)) - .hasMessageContaining("ca-skeleton.outbox." + message); + .hasMessageContaining("app.outbox." + message); } } diff --git a/src/composition/service-runtime/README.md b/src/composition/service-runtime/README.md index 8c87931b..fbfec221 100644 --- a/src/composition/service-runtime/README.md +++ b/src/composition/service-runtime/README.md @@ -22,7 +22,7 @@ composition:service-runtime - 모두 이 모듈의 `AutoConfiguration.imports`로 등록된다(sampling bridge는 `spring.factories`의 `EnvironmentPostProcessor`). 구성 루트의 component scan에 기대지 않는다. -- 설정 키는 옮기지 않았다: `ca-skeleton.tracing.*`, `ca-skeleton.privacy.*`. 값은 각 구성 루트의 `application.yml`/`config/observability.yml`에 있다. +- 설정 키는 옮기지 않았다: `app.tracing.*`, `app.privacy.*`. 값은 각 구성 루트의 `application.yml`/`config/observability.yml`에 있다. - actuator chain은 servlet 웹 애플리케이션에서만 만들어지고, 구성 루트가 같은 이름 `actuatorSecurityFilterChain`의 bean을 두면 물러난다. sample-portfolio는 공개 데모라 그렇게 모든 요청을 허용하는 자기 chain을 둔다. @@ -81,7 +81,7 @@ runtimeOnly project(':composition:service-runtime') 등록되었는지" 검사할 수 있게 하는 bootstrap 내부 전용 장치다. #### TracingSettings -- **`ca-skeleton.tracing.*` 바인딩 `@ConfigurationProperties` record.** 세 env 키가 들어온다: +- **`app.tracing.*` 바인딩 `@ConfigurationProperties` record.** 세 env 키가 들어온다: `APP_TRACING_ENABLED` → `enabled`, `APP_TRACING_SAMPLE_RATE` → `sampleRate`, `OTEL_EXPORTER_OTLP_ENDPOINT` → `exporter.otlpEndpoint`. - **`sampleRate`가 blank 이면 숫자 검증을 건너뛴다.** blank 는 "값이 잘못됐다"가 아니라 "프로파일별 @@ -119,7 +119,7 @@ runtimeOnly project(':composition:service-runtime') 단일화(브리지)하는 `EnvironmentPostProcessor`다.** 이를 통해 "프로파일별 기본값 + env override"라는 우리 규약을 Spring Boot 의 기본 샘플링 메커니즘에 그대로 연결한다. - **브리지 우선순위.** (1) 사용자가 `management.tracing.sampling.probability`를 이미 명시했으면 - 덮어쓰지 않고 그대로 둔다, (2) `ca-skeleton.tracing.sample-rate`가 non-blank 면 그 값 사용, (3) + 덮어쓰지 않고 그대로 둔다, (2) `app.tracing.sample-rate`가 non-blank 면 그 값 사용, (3) blank 면 `TracingSampleRateResolver.defaultRateForProfile(...)`로 active profile 기본값 적용. - **`META-INF/spring.factories`에 `org.springframework.boot.EnvironmentPostProcessor` 키로 등록된다.** `EnvironmentPostProcessor`는 ApplicationContext 가 생성되기 전에 실행되므로 일반 빈이 아니라 @@ -211,7 +211,7 @@ runtimeOnly project(':composition:service-runtime') #### PrivacySettings - **보안/감사 로그에서 `user_principal`을 가명화하는 데 쓰는 HMAC salt 를 보관한다.** - `ca-skeleton.privacy.*` 바인딩(원천 `APP_PRIVACY_PSEUDONYMIZATION_SALT`). 알고리즘은 HMAC-SHA-256 + `app.privacy.*` 바인딩(원천 `APP_PRIVACY_PSEUDONYMIZATION_SALT`). 알고리즘은 HMAC-SHA-256 + 90일 회전 salt 이고, 이 salt 는 `secret`-tier 값이라 prod 에서는 반드시 secret manager 에서 공급되어야 한다. - **검증은 `LoggingSettings`와 일관되게 "warn-and-default"다.** blank salt 는 경고를 남기고, 명확히 diff --git a/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/logging/PrivacySettings.java b/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/logging/PrivacySettings.java index 9f286563..ce705bd2 100644 --- a/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/logging/PrivacySettings.java +++ b/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/logging/PrivacySettings.java @@ -1,18 +1,20 @@ package dev.caskeleton.composition.runtime.logging; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import dev.caskeleton.adapter.outbound.support.startup.RuntimeWarnings; import java.nio.charset.StandardCharsets; -import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.core.env.Environment; /** - * Privacy settings bound from {@code ca-skeleton.privacy.*}. Holds the HMAC salt used to - * pseudonymize {@code user_principal} in security/audit logs. A blank salt is "warn-and-default": - * it logs a warning and falls back to a dev sentinel so local/test runs never fail to start. See - * README for the design rationale. + * Privacy settings bound from {@code app.privacy.*}. Holds the HMAC salt used to pseudonymize + * {@code user_principal} in security/audit logs. A blank salt is "warn-and-default": it logs a + * warning and falls back to a dev sentinel so local/test runs never fail to start. See README for + * the design rationale. */ -@ConfigurationProperties(prefix = "ca-skeleton.privacy") public record PrivacySettings(String pseudonymizationSalt) { + static final String PREFIX = "app.privacy"; + /** Dev/local fallback salt — the {@code __LOCAL_DEV_} prefix is the prod-unsafe sentinel. */ static final String DEV_SENTINEL_SALT = "__LOCAL_DEV_pseudonymization_salt"; @@ -27,6 +29,16 @@ public record PrivacySettings(String pseudonymizationSalt) { } } + /** + * Binds {@link #PREFIX} strictly. + * + * @param environment the environment to bind from + * @return the bound settings + */ + static PrivacySettings bind(Environment environment) { + return StrictSettingsBinder.bind(environment, PREFIX, PrivacySettings.class); + } + public byte[] saltBytes() { return pseudonymizationSalt.getBytes(StandardCharsets.UTF_8); } diff --git a/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/logging/PseudonymizationConfig.java b/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/logging/PseudonymizationConfig.java index 397e8f69..45856030 100644 --- a/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/logging/PseudonymizationConfig.java +++ b/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/logging/PseudonymizationConfig.java @@ -4,8 +4,8 @@ import dev.caskeleton.adapter.outbound.identifier.HmacUserPrincipalPseudonymizer import dev.caskeleton.application.observability.UserPrincipalPseudonymizerPort; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.core.env.Environment; /** * Composition-root wiring for {@code user_principal} pseudonymization. @@ -13,9 +13,13 @@ import org.springframework.context.annotation.Bean; * README for the design rationale. */ @AutoConfiguration -@EnableConfigurationProperties(PrivacySettings.class) public class PseudonymizationConfig { + @Bean + PrivacySettings privacySettings(Environment environment) { + return PrivacySettings.bind(environment); + } + @Bean @ConditionalOnMissingBean UserPrincipalPseudonymizerPort userPrincipalPseudonymizer(PrivacySettings privacySettings) { diff --git a/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingConfig.java b/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingConfig.java index 21551dc0..1e59ee93 100644 --- a/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingConfig.java +++ b/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingConfig.java @@ -16,15 +16,24 @@ import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.core.env.Environment; /** Composition-root wiring for distributed tracing. See README for the design rationale. */ @AutoConfiguration -@EnableConfigurationProperties(TracingSettings.class) public class TracingConfig { + /** + * The tracing settings, bound strictly. Static: this configuration takes them in its constructor. + * + * @param environment the environment to bind from + * @return the bound settings + */ + @Bean + static TracingSettings tracingSettings(Environment environment) { + return TracingSettings.bind(environment); + } + private final TracingSettings properties; private final Environment environment; private final ObjectProvider meterRegistryProvider; @@ -58,7 +67,7 @@ public class TracingConfig { @Bean @ConditionalOnMissingBean(Tracer.class) @ConditionalOnProperty( - prefix = "ca-skeleton.tracing", + prefix = "app.tracing", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingSamplingEnvironmentPostProcessor.java b/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingSamplingEnvironmentPostProcessor.java index 70914075..1baafb7e 100644 --- a/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingSamplingEnvironmentPostProcessor.java +++ b/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingSamplingEnvironmentPostProcessor.java @@ -18,7 +18,7 @@ import org.springframework.core.env.MapPropertySource; public class TracingSamplingEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { private static final String NATIVE_KEY = "management.tracing.sampling.probability"; - private static final String CA_SAMPLE_RATE_KEY = "ca-skeleton.tracing.sample-rate"; + private static final String CA_SAMPLE_RATE_KEY = "app.tracing.sample-rate"; private final TracingSampleRateResolver resolver = new TracingSampleRateResolver(); diff --git a/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingSettings.java b/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingSettings.java index 848e564e..dd8cedb9 100644 --- a/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingSettings.java +++ b/src/composition/service-runtime/src/main/java/dev/caskeleton/composition/runtime/tracing/TracingSettings.java @@ -1,18 +1,28 @@ package dev.caskeleton.composition.runtime.tracing; +import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import dev.caskeleton.adapter.outbound.support.startup.StartupFailures; import java.net.URI; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.validation.annotation.Validated; +import org.springframework.core.env.Environment; /** - * Tracing settings bound from {@code ca-skeleton.tracing.*}. A blank {@code sampleRate} means - * "defer to the per-profile default". See README for the design rationale. + * Tracing settings bound from {@code app.tracing.*}. A blank {@code sampleRate} means "defer to the + * per-profile default". See README for the design rationale. */ -@ConfigurationProperties(prefix = "ca-skeleton.tracing") -@Validated public record TracingSettings(boolean enabled, String sampleRate, Exporter exporter) { + static final String PREFIX = "app.tracing"; + + /** + * Binds {@link #PREFIX} strictly. + * + * @param environment the environment to bind from + * @return the bound settings + */ + static TracingSettings bind(Environment environment) { + return StrictSettingsBinder.bind(environment, PREFIX, TracingSettings.class); + } + /** Nested properties for the OTLP exporter endpoint. */ public record Exporter(String otlpEndpoint) { diff --git a/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/ServiceRuntimeRegistrationTest.java b/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/ServiceRuntimeRegistrationTest.java index 0cddb364..64c7fcc9 100644 --- a/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/ServiceRuntimeRegistrationTest.java +++ b/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/ServiceRuntimeRegistrationTest.java @@ -15,7 +15,10 @@ import dev.caskeleton.shared.tracing.SpanErrorRecorder; import java.io.IOException; import java.util.List; import java.util.Properties; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.context.annotation.ImportCandidates; @@ -72,13 +75,33 @@ class ServiceRuntimeRegistrationTest { assertThat(order).isEqualTo(StartupOrder.TRACING_SAMPLING); } + @ParameterizedTest + @ValueSource(strings = {"app.privacy.pseudonymisation-salt=typo", "app.tracing.sample-rat=0.5"}) + @DisplayName("app.privacy·app.tracing 아래 오타 키는 기동을 실패시킨다") + void aMisspelledRuntimeKeyFailsStartup(String misspelled) { + // given + ApplicationContextRunner runner = + new ApplicationContextRunner() + .withConfiguration(AutoConfigurations.of(ROOTS.toArray(Class[]::new))) + .withPropertyValues("app.privacy.pseudonymization-salt=test-salt", misspelled); + + // when + runner.run( + context -> { + // then + assertThat(context).hasFailed(); + assertThat(context.getStartupFailure()) + .hasStackTraceContaining(misspelled.substring(0, misspelled.indexOf('='))); + }); + } + @Test void aNonWebContextGetsTheRuntimeBeansWithoutAnActuatorChain() { // given ApplicationContextRunner runner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(ROOTS.toArray(Class[]::new))) - .withPropertyValues("ca-skeleton.privacy.pseudonymization-salt=test-salt"); + .withPropertyValues("app.privacy.pseudonymization-salt=test-salt"); // when runner.run( diff --git a/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/logging/PrivacySettingsTest.java b/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/logging/PrivacySettingsTest.java index c42a3fe1..1992a332 100644 --- a/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/logging/PrivacySettingsTest.java +++ b/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/logging/PrivacySettingsTest.java @@ -11,9 +11,10 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.slf4j.LoggerFactory; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.runner.ApplicationContextRunner; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; class PrivacySettingsTest { @@ -51,7 +52,7 @@ class PrivacySettingsTest { @Test void blankSaltWarnsAndFallsBackToDevSentinel() { runner - .withPropertyValues("ca-skeleton.privacy.pseudonymization-salt=") + .withPropertyValues("app.privacy.pseudonymization-salt=") .run( context -> { assertThat(context).hasNotFailed(); @@ -70,7 +71,7 @@ class PrivacySettingsTest { @Test void realSaltIsUsedAndExposedAsUtf8Bytes() { runner - .withPropertyValues("ca-skeleton.privacy.pseudonymization-salt=prod-salt-9f") + .withPropertyValues("app.privacy.pseudonymization-salt=prod-salt-9f") .run( context -> { assertThat(context).hasNotFailed(); @@ -86,6 +87,11 @@ class PrivacySettingsTest { } @Configuration - @EnableConfigurationProperties(PrivacySettings.class) - static class EnableProperties {} + static class EnableProperties { + + @Bean + PrivacySettings settings(Environment environment) { + return PrivacySettings.bind(environment); + } + } } diff --git a/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/logging/PseudonymizationConfigTest.java b/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/logging/PseudonymizationConfigTest.java index 01596d55..0a59cdc0 100644 --- a/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/logging/PseudonymizationConfigTest.java +++ b/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/logging/PseudonymizationConfigTest.java @@ -21,7 +21,7 @@ class PseudonymizationConfigTest { @Test void wiresAnHmacPseudonymizerThatRedactsThePrincipal() { runner - .withPropertyValues("ca-skeleton.privacy.pseudonymization-salt=unit-salt-7c") + .withPropertyValues("app.privacy.pseudonymization-salt=unit-salt-7c") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/tracing/TracingSamplingEnvironmentPostProcessorTest.java b/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/tracing/TracingSamplingEnvironmentPostProcessorTest.java index cca8d78d..5b3cfcda 100644 --- a/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/tracing/TracingSamplingEnvironmentPostProcessorTest.java +++ b/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/tracing/TracingSamplingEnvironmentPostProcessorTest.java @@ -39,7 +39,7 @@ class TracingSamplingEnvironmentPostProcessorTest { void explicitRateWins() { MockEnvironment env = new MockEnvironment(); env.setActiveProfiles("prod"); - env.setProperty("ca-skeleton.tracing.sample-rate", "0.25"); + env.setProperty("app.tracing.sample-rate", "0.25"); epp.postProcessEnvironment(env, new SpringApplication()); diff --git a/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/tracing/TracingSettingsTest.java b/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/tracing/TracingSettingsTest.java index 37258d2d..f09006ef 100644 --- a/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/tracing/TracingSettingsTest.java +++ b/src/composition/service-runtime/src/test/java/dev/caskeleton/composition/runtime/tracing/TracingSettingsTest.java @@ -7,9 +7,10 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import dev.caskeleton.adapter.outbound.support.startup.StartupErrorCode; import dev.caskeleton.adapter.outbound.support.startup.StartupFailureException; import org.junit.jupiter.api.Test; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.runner.ApplicationContextRunner; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; /** * Settings binding + validation tests for {@link TracingSettings} @@ -28,9 +29,9 @@ class TracingSettingsTest { void validSampleRateIsBoundAndParseable() { runner .withPropertyValues( - "ca-skeleton.tracing.enabled=true", - "ca-skeleton.tracing.sample-rate=0.5", - "ca-skeleton.tracing.exporter.otlp-endpoint=") + "app.tracing.enabled=true", + "app.tracing.sample-rate=0.5", + "app.tracing.exporter.otlp-endpoint=") .run( ctx -> { assertThat(ctx).hasNotFailed(); @@ -44,9 +45,9 @@ class TracingSettingsTest { void sampleRateZeroIsValidBoundary() { runner .withPropertyValues( - "ca-skeleton.tracing.enabled=false", - "ca-skeleton.tracing.sample-rate=0.0", - "ca-skeleton.tracing.exporter.otlp-endpoint=") + "app.tracing.enabled=false", + "app.tracing.sample-rate=0.0", + "app.tracing.exporter.otlp-endpoint=") .run( ctx -> { assertThat(ctx).hasNotFailed(); @@ -58,9 +59,9 @@ class TracingSettingsTest { void sampleRateOneIsValidBoundary() { runner .withPropertyValues( - "ca-skeleton.tracing.enabled=true", - "ca-skeleton.tracing.sample-rate=1.0", - "ca-skeleton.tracing.exporter.otlp-endpoint=") + "app.tracing.enabled=true", + "app.tracing.sample-rate=1.0", + "app.tracing.exporter.otlp-endpoint=") .run( ctx -> { assertThat(ctx).hasNotFailed(); @@ -73,9 +74,9 @@ class TracingSettingsTest { // required_test: tracing-contract:exporter-endpoint-resolvable (sampleRate sub-case) runner .withPropertyValues( - "ca-skeleton.tracing.enabled=true", - "ca-skeleton.tracing.sample-rate=1.5", - "ca-skeleton.tracing.exporter.otlp-endpoint=") + "app.tracing.enabled=true", + "app.tracing.sample-rate=1.5", + "app.tracing.exporter.otlp-endpoint=") .run(ctx -> assertThat(ctx).hasFailed()); } @@ -83,9 +84,9 @@ class TracingSettingsTest { void invalidSampleRateNonNumericFailsStartup() { runner .withPropertyValues( - "ca-skeleton.tracing.enabled=true", - "ca-skeleton.tracing.sample-rate=not-a-number", - "ca-skeleton.tracing.exporter.otlp-endpoint=") + "app.tracing.enabled=true", + "app.tracing.sample-rate=not-a-number", + "app.tracing.exporter.otlp-endpoint=") .run(ctx -> assertThat(ctx).hasFailed()); } @@ -93,9 +94,9 @@ class TracingSettingsTest { void negativeSampleRateFailsStartup() { runner .withPropertyValues( - "ca-skeleton.tracing.enabled=true", - "ca-skeleton.tracing.sample-rate=-0.1", - "ca-skeleton.tracing.exporter.otlp-endpoint=") + "app.tracing.enabled=true", + "app.tracing.sample-rate=-0.1", + "app.tracing.exporter.otlp-endpoint=") .run(ctx -> assertThat(ctx).hasFailed()); } @@ -107,9 +108,9 @@ class TracingSettingsTest { // required_test: tracing-contract:exporter-endpoint-resolvable (empty = exporter off) runner .withPropertyValues( - "ca-skeleton.tracing.enabled=true", - "ca-skeleton.tracing.sample-rate=1.0", - "ca-skeleton.tracing.exporter.otlp-endpoint=") + "app.tracing.enabled=true", + "app.tracing.sample-rate=1.0", + "app.tracing.exporter.otlp-endpoint=") .run( ctx -> { assertThat(ctx).hasNotFailed(); @@ -122,9 +123,9 @@ class TracingSettingsTest { // required_test: tracing-contract:exporter-endpoint-resolvable (valid URL) runner .withPropertyValues( - "ca-skeleton.tracing.enabled=true", - "ca-skeleton.tracing.sample-rate=1.0", - "ca-skeleton.tracing.exporter.otlp-endpoint=http://otel-collector:4317") + "app.tracing.enabled=true", + "app.tracing.sample-rate=1.0", + "app.tracing.exporter.otlp-endpoint=http://otel-collector:4317") .run( ctx -> { assertThat(ctx).hasNotFailed(); @@ -138,9 +139,9 @@ class TracingSettingsTest { // required_test: tracing-contract:exporter-endpoint-resolvable (malformed URL) runner .withPropertyValues( - "ca-skeleton.tracing.enabled=true", - "ca-skeleton.tracing.sample-rate=1.0", - "ca-skeleton.tracing.exporter.otlp-endpoint=not a valid url$$") + "app.tracing.enabled=true", + "app.tracing.sample-rate=1.0", + "app.tracing.exporter.otlp-endpoint=not a valid url$$") .run(ctx -> assertThat(ctx).hasFailed()); } @@ -149,9 +150,9 @@ class TracingSettingsTest { // url_or_empty: URI.create throws on illegal characters (spaces) runner .withPropertyValues( - "ca-skeleton.tracing.enabled=true", - "ca-skeleton.tracing.sample-rate=1.0", - "ca-skeleton.tracing.exporter.otlp-endpoint=not valid url") + "app.tracing.enabled=true", + "app.tracing.sample-rate=1.0", + "app.tracing.exporter.otlp-endpoint=not valid url") .run(ctx -> assertThat(ctx).hasFailed()); } @@ -159,9 +160,9 @@ class TracingSettingsTest { void enabledFlagIsBoundCorrectly() { runner .withPropertyValues( - "ca-skeleton.tracing.enabled=false", - "ca-skeleton.tracing.sample-rate=1.0", - "ca-skeleton.tracing.exporter.otlp-endpoint=") + "app.tracing.enabled=false", + "app.tracing.sample-rate=1.0", + "app.tracing.exporter.otlp-endpoint=") .run( ctx -> { assertThat(ctx).hasNotFailed(); @@ -209,6 +210,11 @@ class TracingSettingsTest { } @Configuration - @EnableConfigurationProperties(TracingSettings.class) - static class EnableProperties {} + static class EnableProperties { + + @Bean + TracingSettings settings(Environment environment) { + return TracingSettings.bind(environment); + } + } } diff --git a/src/grpc-advanced/CLAUDE.md b/src/grpc-advanced/CLAUDE.md index cf3a6d7f..3955a52f 100644 --- a/src/grpc-advanced/CLAUDE.md +++ b/src/grpc-advanced/CLAUDE.md @@ -31,7 +31,7 @@ capability마다 별도 flag를 갖는다. 하나의 "advanced" 스위치로 묶 | `WATCH` | X (추적만) | — | | `DISABLED` | X | — | -property key는 `ca-skeleton.grpc.advanced..enabled`이고 전부 기본 off다. +property key는 `app.grpc.advanced..enabled`이고 전부 기본 off다. `GrpcAdvancedModuleGuard`가 세 조건(flag 미설정 / grade가 시작 불가 / production 승인 없음)을 구분해서 거부하며, 세 경우의 조치가 다르므로 메시지도 다르다. diff --git a/src/grpc-advanced/grpc-advanced/build.gradle b/src/grpc-advanced/grpc-advanced/build.gradle index eaf898d9..c4b9a188 100644 --- a/src/grpc-advanced/grpc-advanced/build.gradle +++ b/src/grpc-advanced/grpc-advanced/build.gradle @@ -6,7 +6,7 @@ plugins { // The capabilities the Stable platform deliberately excludes, each behind its own capability flag: // -// bootstrap capability grades, the `ca-skeleton.grpc.advanced.*` feature-flag contract, the +// bootstrap capability grades, the `app.grpc.advanced.*` feature-flag contract, the // module guard that refuses an unflagged capability, the per-capability promotion // gate // edition Protobuf Edition 2024 opt-in lane and Edition 2026 watch lane diff --git a/src/grpc-advanced/grpc-advanced/src/main/java/dev/caskeleton/grpc/advanced/bootstrap/GrpcAdvancedCapability.java b/src/grpc-advanced/grpc-advanced/src/main/java/dev/caskeleton/grpc/advanced/bootstrap/GrpcAdvancedCapability.java index b679f14e..12e8fb65 100644 --- a/src/grpc-advanced/grpc-advanced/src/main/java/dev/caskeleton/grpc/advanced/bootstrap/GrpcAdvancedCapability.java +++ b/src/grpc-advanced/grpc-advanced/src/main/java/dev/caskeleton/grpc/advanced/bootstrap/GrpcAdvancedCapability.java @@ -48,14 +48,14 @@ public enum GrpcAdvancedCapability { this.defaultGrade = defaultGrade; } - /** The property suffix under {@code ca-skeleton.grpc.advanced}. */ + /** The property suffix under {@code app.grpc.advanced}. */ public String flagName() { return flagName; } /** The full property key that enables this capability. */ public String propertyKey() { - return "ca-skeleton.grpc.advanced." + flagName + ".enabled"; + return "app.grpc.advanced." + flagName + ".enabled"; } /** How ready this capability is today. */ diff --git a/src/grpc-advanced/grpc-advanced/src/test/java/dev/caskeleton/grpc/advanced/bootstrap/GrpcAdvancedModuleGuardTest.java b/src/grpc-advanced/grpc-advanced/src/test/java/dev/caskeleton/grpc/advanced/bootstrap/GrpcAdvancedModuleGuardTest.java index dcaae0e1..32268e93 100644 --- a/src/grpc-advanced/grpc-advanced/src/test/java/dev/caskeleton/grpc/advanced/bootstrap/GrpcAdvancedModuleGuardTest.java +++ b/src/grpc-advanced/grpc-advanced/src/test/java/dev/caskeleton/grpc/advanced/bootstrap/GrpcAdvancedModuleGuardTest.java @@ -23,8 +23,7 @@ class GrpcAdvancedModuleGuardTest { @Test @DisplayName("each capability has its own flag, not a shared one") void eachCapabilityHasItsOwnFlag() { - assertThat(GrpcAdvancedCapability.XDS.propertyKey()) - .isEqualTo("ca-skeleton.grpc.advanced.xds.enabled"); + assertThat(GrpcAdvancedCapability.XDS.propertyKey()).isEqualTo("app.grpc.advanced.xds.enabled"); assertThat(GrpcAdvancedCapability.GRPC_WEB.propertyKey()) .isNotEqualTo(GrpcAdvancedCapability.XDS.propertyKey()); @@ -43,7 +42,7 @@ class GrpcAdvancedModuleGuardTest { GrpcAdvancedModuleGuard.require( GrpcAdvancedFeatureFlags.forDevelopment(), GrpcAdvancedCapability.REACTOR)) .isInstanceOf(GrpcAdvancedCapabilityDisabledException.class) - .hasMessageContaining("ca-skeleton.grpc.advanced.reactor.enabled=true"); + .hasMessageContaining("app.grpc.advanced.reactor.enabled=true"); } @Test diff --git a/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfiguration.java b/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfiguration.java index 5e17459d..85169398 100644 --- a/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfiguration.java +++ b/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfiguration.java @@ -33,7 +33,7 @@ import org.springframework.context.annotation.Bean; */ @AutoConfiguration @ConditionalOnProperty( - prefix = "ca-skeleton.grpc.platform", + prefix = "app.grpc.platform", name = "enabled", havingValue = "true", matchIfMissing = false) diff --git a/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformProperties.java b/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformProperties.java index 92c5be0a..c480573d 100644 --- a/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformProperties.java +++ b/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformProperties.java @@ -6,7 +6,7 @@ import dev.caskeleton.grpc.server.GrpcServerTransport; import org.springframework.boot.context.properties.ConfigurationProperties; /** - * The gRPC platform's typed configuration, bound from {@code ca-skeleton.grpc.platform.*}. + * The gRPC platform's typed configuration, bound from {@code app.grpc.platform.*}. * *

Off by default, like every other optional capability in this repository. A platform that * starts because its jar is on the classpath is a platform that opens a port on a deployment nobody @@ -16,7 +16,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * leaving a setting at its default — which is how a deployment ends up with production reflection * enabled because somebody wrote {@code reflection-mode} under the wrong prefix. */ -@ConfigurationProperties(prefix = "ca-skeleton.grpc.platform", ignoreUnknownFields = false) +@ConfigurationProperties(prefix = "app.grpc.platform", ignoreUnknownFields = false) public class GrpcPlatformProperties { /** Whether the platform is assembled at all. */ diff --git a/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidator.java b/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidator.java index f4024f9e..1f1a4dec 100644 --- a/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidator.java +++ b/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidator.java @@ -82,7 +82,7 @@ public final class GrpcPlatformStartupValidator { } if (properties.getEnvironment() == null) { violations.add( - "ca-skeleton.grpc.platform.environment is not set; the TLS and reflection floors depend on" + "app.grpc.platform.environment is not set; the TLS and reflection floors depend on" + " it, so it is refused rather than assumed LOCAL"); return; } diff --git a/src/grpc/grpc-spring-boot-starter/src/test/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfigurationContextTest.java b/src/grpc/grpc-spring-boot-starter/src/test/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfigurationContextTest.java index e328acdd..6957096b 100644 --- a/src/grpc/grpc-spring-boot-starter/src/test/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfigurationContextTest.java +++ b/src/grpc/grpc-spring-boot-starter/src/test/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfigurationContextTest.java @@ -17,11 +17,11 @@ class GrpcPlatformAutoConfigurationContextTest { () -> start( Map.of( - "ca-skeleton.grpc.platform.enabled", "true", - "ca-skeleton.grpc.platform.environment", "PROD", - "ca-skeleton.grpc.platform.transport", "NETTY_SHADED", - "ca-skeleton.grpc.platform.tls-enabled", "true", - "ca-skeleton.grpc.platform.trust-all-certificates", "true"))) + "app.grpc.platform.enabled", "true", + "app.grpc.platform.environment", "PROD", + "app.grpc.platform.transport", "NETTY_SHADED", + "app.grpc.platform.tls-enabled", "true", + "app.grpc.platform.trust-all-certificates", "true"))) .isInstanceOf(GrpcPlatformConfigurationException.class) .hasMessageContaining("trust-all is enabled in PROD") .hasMessageContaining("providing none"); @@ -35,15 +35,15 @@ class GrpcPlatformAutoConfigurationContextTest { () -> start( Map.of( - "ca-skeleton.grpc.platform.enabled", "true", - "ca-skeleton.grpc.platform.transport", "NETTY_SHADED", - "ca-skeleton.grpc.platform.tls-enabled", "false", - "ca-skeleton.grpc.platform.reflection-mode", "ENABLED"))); + "app.grpc.platform.enabled", "true", + "app.grpc.platform.transport", "NETTY_SHADED", + "app.grpc.platform.tls-enabled", "false", + "app.grpc.platform.reflection-mode", "ENABLED"))); // then assertThat(failure) .isInstanceOf(GrpcPlatformConfigurationException.class) - .hasMessageContaining("ca-skeleton.grpc.platform.environment is not set"); + .hasMessageContaining("app.grpc.platform.environment is not set"); } @Test @@ -51,11 +51,11 @@ class GrpcPlatformAutoConfigurationContextTest { try (AnnotationConfigApplicationContext context = start( Map.of( - "ca-skeleton.grpc.platform.enabled", "true", - "ca-skeleton.grpc.platform.environment", "LOCAL", - "ca-skeleton.grpc.platform.transport", "NETTY_SHADED", - "ca-skeleton.grpc.platform.executor-queue-capacity", "32", - "ca-skeleton.grpc.platform.executor-max-pool-size", "4"))) { + "app.grpc.platform.enabled", "true", + "app.grpc.platform.environment", "LOCAL", + "app.grpc.platform.transport", "NETTY_SHADED", + "app.grpc.platform.executor-queue-capacity", "32", + "app.grpc.platform.executor-max-pool-size", "4"))) { assertThat(context.getBean(GrpcPlatformProperties.class).isEnabled()).isTrue(); assertThat( context.getBeansOfType( @@ -69,9 +69,9 @@ class GrpcPlatformAutoConfigurationContextTest { try (AnnotationConfigApplicationContext context = start( Map.of( - "ca-skeleton.grpc.platform.enabled", "true", - "ca-skeleton.grpc.platform.environment", "LOCAL", - "ca-skeleton.grpc.platform.transport", "NETTY"))) { + "app.grpc.platform.enabled", "true", + "app.grpc.platform.environment", "LOCAL", + "app.grpc.platform.transport", "NETTY"))) { assertThat(context.getBean(dev.caskeleton.grpc.server.GrpcServerProfile.class).transport()) .isEqualTo(dev.caskeleton.grpc.server.GrpcServerTransport.NETTY); } diff --git a/src/sample-portfolio/README.md b/src/sample-portfolio/README.md index 31304453..aedf9f78 100644 --- a/src/sample-portfolio/README.md +++ b/src/sample-portfolio/README.md @@ -411,7 +411,7 @@ curl -X POST localhost:8080/work-logs -H 'Content-Type: application/json' -d '{ URL에 접근해야 하고, 그 자리는 `SamplePublicAccessSecurityConfig`가 채운다. 에러 envelope·필터· health·rate limit은 `WebAdapterAutoConfiguration`으로 프로덕션과 같게 들어온다. - 데이터 계층을 빼고 뜨는 테스트 슬라이스(`DataSourceAutoConfiguration` 제외)는 - `ca-skeleton.persistence-jpa.enabled=false`도 함께 준다. 모듈은 classpath에 있으면 켜지기 때문이다. + `app.persistence-jpa.enabled=false`도 함께 준다. 모듈은 classpath에 있으면 켜지기 때문이다. ### SamplePostgreSqlPersistenceConfig — 샘플 전용 두 번째 마이그레이션 스트림 - 샘플 스키마(`db/sample-migration`)를 별도 history 테이블(`flyway_sample_schema_history`)로 @@ -426,7 +426,7 @@ curl -X POST localhost:8080/work-logs -H 'Content-Type: application/json' -d '{ `MicrometerSpanErrorRecorder`), metrics 계약 filter(`MetricsContractConfig`), domain context propagator(`DomainContextConfig`), user principal 가명화(`PseudonymizationConfig`/`PrivacySettings`), actuator 보안 chain(`ManagementSecurityConfig`)을 app-bootstrap과 같은 모듈에서 받습니다. - 설정 키(`ca-skeleton.tracing.*`, `ca-skeleton.privacy.*`)는 그대로입니다. + 설정 키(`app.tracing.*`, `app.privacy.*`)는 그대로입니다. - 샘플 레이트 기본값은 공용 런타임 어휘(`RuntimeEnvironment`)를 따릅니다: `prod=0.01`, 그 밖은 1.0. 샘플 복사본에만 있던 `staging=0.10` 분기는 삭제했습니다 — `staging` 프로파일은 이 템플릿에 없습니다. - **SampleManagementSecurityConfig**: 샘플의 actuator chain은 복사본이 아니라 샘플만의 결정입니다 @@ -435,7 +435,7 @@ curl -X POST localhost:8080/work-logs -H 'Content-Type: application/json' -d '{ 읽기 전용으로 둡니다(`SampleActuatorLoggersAccessTest`). ### 그 밖의 부트스트랩 구성 -- **멱등성 executor**: 샘플은 `ca-skeleton.capabilities.idempotency.provider=postgresql` +- **멱등성 executor**: 샘플은 `app.capabilities.idempotency.provider=postgresql` 로 `persistence-jpa` 의 PostgreSQL store 를 고르고, executor 는 app-bootstrap 과 같은 `composition:idempotency` 모듈이 만듭니다(`runtimeOnly` 한 줄). 예전의 샘플 복사본 `SampleIdempotencyConfig`(상한 검증 없이 `Binder`로 읽고 store 를 하나로 가정)는 삭제됐고, diff --git a/src/sample-portfolio/src/integrationTest/java/dev/caskeleton/sample/portfolio/bootstrap/idempotency/SampleIdempotencyReplayIntegrationTest.java b/src/sample-portfolio/src/integrationTest/java/dev/caskeleton/sample/portfolio/bootstrap/idempotency/SampleIdempotencyReplayIntegrationTest.java index dfebda4e..29b811df 100644 --- a/src/sample-portfolio/src/integrationTest/java/dev/caskeleton/sample/portfolio/bootstrap/idempotency/SampleIdempotencyReplayIntegrationTest.java +++ b/src/sample-portfolio/src/integrationTest/java/dev/caskeleton/sample/portfolio/bootstrap/idempotency/SampleIdempotencyReplayIntegrationTest.java @@ -113,7 +113,7 @@ class SampleIdempotencyReplayIntegrationTest { .withUserConfiguration(Class.forName(POSTGRESQL_STORE_CONFIG), SampleSchedulingConfig.class) .withPropertyValues( // The sample's shipped default. - "ca-skeleton.capabilities.idempotency.provider=postgresql", + "app.capabilities.idempotency.provider=postgresql", "spring.datasource.url=" + POSTGRES.getJdbcUrl(), "spring.datasource.username=" + POSTGRES.getUsername(), "spring.datasource.password=" + POSTGRES.getPassword(), diff --git a/src/sample-portfolio/src/main/resources/application.yml b/src/sample-portfolio/src/main/resources/application.yml index 3b9de0a6..8b3404e7 100644 --- a/src/sample-portfolio/src/main/resources/application.yml +++ b/src/sample-portfolio/src/main/resources/application.yml @@ -58,7 +58,7 @@ spring: format_sql: ${APP_DATASOURCE_FORMAT_SQL:false} # spring.security.oauth2.resourceserver.jwt is intentionally absent. # The custom JwtDecoderConfig (adapter-web) builds its JwtDecoder from - # ca-skeleton.security.issuer-uri via SecuritySettings — not from Spring Boot's + # app.security.issuer-uri via SecuritySettings — not from Spring Boot's # OAuth2ResourceServer auto-config. Declaring issuer-uri here would activate # OAuth2SecurityFilterChainConfiguration, which requires HttpSecurity and therefore # SecurityAutoConfiguration — breaking narrow @WebMvcTest slices that exclude Security. @@ -142,10 +142,10 @@ logging: org.hibernate.SQL: ${APP_LOG_LEVEL_SQL:WARN} # --------------------------------------------------------------------------- -# ca-skeleton module-scoped settings. +# Application-owned settings (app.*). # These are bound by @ConfigurationProperties in the respective modules. # --------------------------------------------------------------------------- -ca-skeleton: +app: capabilities: cache: bindings: @@ -240,10 +240,9 @@ ca-skeleton: reaper-interval: PT10M published-retention: P7D -# --------------------------------------------------------------------------- -# Optional integration adapter toggles (all disabled for lean demo). -# --------------------------------------------------------------------------- -app: + # ------------------------------------------------------------------------- + # Optional integration adapter toggles (all disabled for lean demo). + # ------------------------------------------------------------------------- poster-image: api: # `publication` turns on the canonical upload endpoints; anything else leaves them off. diff --git a/src/sample-portfolio/src/systemTest/resources/application-test.yml b/src/sample-portfolio/src/systemTest/resources/application-test.yml index 1926a080..faaef3e2 100644 --- a/src/sample-portfolio/src/systemTest/resources/application-test.yml +++ b/src/sample-portfolio/src/systemTest/resources/application-test.yml @@ -103,7 +103,7 @@ logging: org.springframework.web: WARN org.hibernate.SQL: WARN -ca-skeleton: +app: capabilities: idempotency: provider: postgresql @@ -118,9 +118,6 @@ ca-skeleton: api-base-path: /api rate-limit: enabled: false - limit: 100 - window: 1s - algorithm: fixed-window security: issuer-uri: http://localhost:8081/realms/sample-test audience: sample-test @@ -169,7 +166,6 @@ ca-skeleton: reaper-interval: PT10M published-retention: P7D -app: poster-image: api: mode: disabled diff --git a/src/sample-portfolio/src/test/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/versioning/VersioningPrefixTest.java b/src/sample-portfolio/src/test/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/versioning/VersioningPrefixTest.java index e8cb2dfe..fd6eaa82 100644 --- a/src/sample-portfolio/src/test/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/versioning/VersioningPrefixTest.java +++ b/src/sample-portfolio/src/test/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/versioning/VersioningPrefixTest.java @@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController; @AutoConfigureMockMvc(addFilters = false) @Import({PresentationWebConfig.class, VersioningPrefixTest.VersionedProbeController.class}) @EnableConfigurationProperties(PresentationSettings.class) -@TestPropertySource(properties = "ca-skeleton.presentation.api-base-path=/v1") +@TestPropertySource(properties = "app.presentation.api-base-path=/v1") class VersioningPrefixTest { @Autowired MockMvc mvc; diff --git a/src/sample-portfolio/src/test/java/dev/caskeleton/sample/portfolio/bootstrap/security/SamplePublicAccessSecurityConfigTest.java b/src/sample-portfolio/src/test/java/dev/caskeleton/sample/portfolio/bootstrap/security/SamplePublicAccessSecurityConfigTest.java index e6cf50b7..de7d751a 100644 --- a/src/sample-portfolio/src/test/java/dev/caskeleton/sample/portfolio/bootstrap/security/SamplePublicAccessSecurityConfigTest.java +++ b/src/sample-portfolio/src/test/java/dev/caskeleton/sample/portfolio/bootstrap/security/SamplePublicAccessSecurityConfigTest.java @@ -49,9 +49,9 @@ import org.springframework.test.web.servlet.ResultActions; @SpringBootTest( classes = SamplePublicAccessSecurityConfigTest.TestBootstrap.class, properties = { - "ca-skeleton.persistence-jpa.enabled=false", + "app.persistence-jpa.enabled=false", // The PostgreSQL idempotency store needs the relational module this test leaves off. - "ca-skeleton.capabilities.idempotency.provider=disabled" + "app.capabilities.idempotency.provider=disabled" }) @AutoConfigureMockMvc class SamplePublicAccessSecurityConfigTest { diff --git a/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/contract/OpenApiDriftContractTest.java b/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/contract/OpenApiDriftContractTest.java index 5edbed62..993d1921 100644 --- a/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/contract/OpenApiDriftContractTest.java +++ b/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/contract/OpenApiDriftContractTest.java @@ -64,8 +64,8 @@ import org.springframework.test.context.bean.override.mockito.MockitoBean; // The app excludes the data layer; persistence-jpa is on while present, so it is switched off. properties = { "management.server.port=0", - "ca-skeleton.persistence-jpa.enabled=false", - "ca-skeleton.capabilities.idempotency.provider=disabled" + "app.persistence-jpa.enabled=false", + "app.capabilities.idempotency.provider=disabled" }) @AutoConfigureTestRestTemplate class OpenApiDriftContractTest { diff --git a/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/date/DateHeaderContractTest.java b/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/date/DateHeaderContractTest.java index e60b92be..b6367ddb 100644 --- a/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/date/DateHeaderContractTest.java +++ b/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/date/DateHeaderContractTest.java @@ -36,8 +36,8 @@ import org.springframework.web.bind.annotation.RestController; // The app excludes the data layer; persistence-jpa is on while present, so it is switched off. properties = { "management.server.port=0", - "ca-skeleton.persistence-jpa.enabled=false", - "ca-skeleton.capabilities.idempotency.provider=disabled" + "app.persistence-jpa.enabled=false", + "app.capabilities.idempotency.provider=disabled" }) @AutoConfigureTestRestTemplate class DateHeaderContractTest { diff --git a/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/filter/VirtualThreadMdcE2ETest.java b/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/filter/VirtualThreadMdcE2ETest.java index 57eaf1ff..8440a8c1 100644 --- a/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/filter/VirtualThreadMdcE2ETest.java +++ b/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/filter/VirtualThreadMdcE2ETest.java @@ -64,8 +64,8 @@ import org.springframework.web.bind.annotation.RestController; "spring.jackson.deserialization.fail-on-unknown-properties=true", "management.server.port=0", // The app excludes the data layer; persistence-jpa is on while present, so it is off here. - "ca-skeleton.persistence-jpa.enabled=false", - "ca-skeleton.capabilities.idempotency.provider=disabled" + "app.persistence-jpa.enabled=false", + "app.capabilities.idempotency.provider=disabled" }) @AutoConfigureTestRestTemplate class VirtualThreadMdcE2ETest { diff --git a/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/openapi/OpenApiSnapshotTest.java b/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/openapi/OpenApiSnapshotTest.java index 95fb392d..7ea15eba 100644 --- a/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/openapi/OpenApiSnapshotTest.java +++ b/src/sample-portfolio/src/webSystemTest/java/dev/caskeleton/sample/portfolio/adapter/inbound/web/openapi/OpenApiSnapshotTest.java @@ -46,8 +46,8 @@ import tools.jackson.databind.ObjectMapper; // The app excludes the data layer; persistence-jpa is on while present, so it is switched off. properties = { "management.server.port=0", - "ca-skeleton.persistence-jpa.enabled=false", - "ca-skeleton.capabilities.idempotency.provider=disabled" + "app.persistence-jpa.enabled=false", + "app.capabilities.idempotency.provider=disabled" }) @AutoConfigureTestRestTemplate class OpenApiSnapshotTest {