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
@@ -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 가 바인딩되기 전에 자기
|
||||
초기화 단계에서 `<springProperty>` 바인딩으로 이미 같은 값들을 자체 기본값과 함께 소비했다. 따라서
|
||||
|
||||
+2
-3
@@ -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 {
|
||||
|
||||
+1
-1
@@ -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(),
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
+2
-2
@@ -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 {
|
||||
|
||||
+7
-7
@@ -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
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ import org.springframework.context.annotation.Import;
|
||||
* <p>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.
|
||||
*
|
||||
* <p>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
|
||||
|
||||
+3
-3
@@ -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 {
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+8
-28
@@ -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<String> 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<String> required = new LinkedHashSet<>();
|
||||
for (String key : REQUIRED_PROD_SECRETS) {
|
||||
if (DATASOURCE_PASSWORD.equals(key) && !isRelationalPersistenceOn()) {
|
||||
continue;
|
||||
}
|
||||
required.add(key);
|
||||
}
|
||||
Set<String> 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());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+3
-4
@@ -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) {}
|
||||
|
||||
+4
-4
@@ -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(
|
||||
|
||||
+2
-2
@@ -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.*}.
|
||||
*
|
||||
* <p>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) {}
|
||||
|
||||
@@ -17,6 +17,6 @@ spring:
|
||||
# to H2 cannot silently carry a migration expectation with it.
|
||||
enabled: true
|
||||
|
||||
ca-skeleton:
|
||||
app:
|
||||
persistence:
|
||||
vendor: postgresql
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -23,7 +23,7 @@ spring:
|
||||
flyway:
|
||||
enabled: true
|
||||
|
||||
ca-skeleton:
|
||||
app:
|
||||
persistence:
|
||||
vendor: postgresql
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -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"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -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 =
|
||||
|
||||
+4
-4
@@ -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);
|
||||
|
||||
+2
-5
@@ -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<String> 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<String> 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")
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
+78
-76
@@ -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).
|
||||
*
|
||||
* <p>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.
|
||||
* <p>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}.
|
||||
*
|
||||
* <h2>Why this pins the split instead of removing it</h2>
|
||||
* <p>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.
|
||||
*
|
||||
* <p>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.
|
||||
*
|
||||
* <p>{@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.
|
||||
*
|
||||
* <p>{@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.
|
||||
*
|
||||
* <p>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.
|
||||
*
|
||||
* <p>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.
|
||||
* <p>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.<name>} entry for the Compose smoke lanes to read.
|
||||
*/
|
||||
private static final Set<String> 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.
|
||||
*
|
||||
* <p>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<String> DECLARED_PREFIXES =
|
||||
private static final Set<String> 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<String> roots = new TreeSet<>();
|
||||
// given
|
||||
Matcher root = ROOT_KEY.matcher(ShippedConfiguration.text());
|
||||
|
||||
// when
|
||||
Set<String> 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<String> found = new LinkedHashSet<>();
|
||||
Path main = repositoryRoot().resolve("src/app-bootstrap/src/main/java");
|
||||
try (Stream<Path> 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<String, Path> 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<String, Path> 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<String, Path> declaredPrefixes(Path under) throws IOException {
|
||||
Map<String, Path> found = new TreeMap<>();
|
||||
try (Stream<Path> sources = Files.walk(under)) {
|
||||
List<Path> 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() {
|
||||
|
||||
+3
-3
@@ -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 {
|
||||
|
||||
+1
-1
@@ -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\"")
|
||||
|
||||
+4
-4
@@ -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"
|
||||
|
||||
+6
-1
@@ -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<ProductionSource> MESSAGING_SOURCES =
|
||||
loadSources("adapter/outbound/messaging", "messaging", "app-bootstrap");
|
||||
private static final List<ProductionSource> 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();
|
||||
|
||||
|
||||
+2
-2
@@ -129,8 +129,8 @@ public final class ShippedConfiguration {
|
||||
* The shipped configuration as one merged tree.
|
||||
*
|
||||
* <p>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
|
||||
*/
|
||||
|
||||
+8
-9
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -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 -> {
|
||||
|
||||
+4
-4
@@ -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();
|
||||
|
||||
+4
-5
@@ -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. */
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+2
-2
@@ -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();
|
||||
|
||||
+22
-22
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user