review-followup Wave 3: 설정 prefix app.* 통일(P20), Wave 3 종료
- 결정 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) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8bbf1bf01d
commit
27f23add08
@@ -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 | 기본값 | 상한 |
|
||||
|
||||
+11
-7
@@ -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;
|
||||
*
|
||||
* <p>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.
|
||||
*
|
||||
* <p>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<IdempotencyStorePort> 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()
|
||||
|
||||
+4
-5
@@ -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.
|
||||
*
|
||||
* <p>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<String> STORE_OWNED_KEYS = Set.of("key-version", "command-timeout");
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+6
-6
@@ -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 ->
|
||||
|
||||
+2
-2
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
+5
-6
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user