review-followup Wave 3 라운드 1(P16): 빌드 게이트 정리 — JPA evidence manifest 폐기, build-tools 제거, API surface를 leaf check로
- 결정 4: JPA evidence·qualification manifest 폐기 → persistence-jpa 테스트, build-tools included build 비움(verifyEnvKeys는 app-bootstrap 태스크, 구현은 build-logic `ca.config-contract`), gRPC release gate 삭제 - 결정 20: API surface 검사를 leaf `check`로, JPA adopter 검사를 `ca.api-surface`로 합침(구현 하나) - 레인 단계 정리(문서 대조 레인은 `mainStage()`), integrationCheck가 입력 없는 레인을 이름과 함께 제외 → 로컬 통과(NEW-16) - release workflow 통합, releaseCheck는 tag 전용, build-logic 비핵심 플러그인 정리, sample을 ArchUnit 대상에 - 보류 4행(B3 변경 모듈만 실행, C 이미지 서명, messaging 카드 검증 이동 2행 — 결정 필요), 남음 2행(O3-5 나머지) - 통합: P17이 옮긴 gRPC release gate 사본 삭제, `grpc-proto-buf`를 release-gate needs에(P17-new-3) 검증: ./gradlew ci verifyDependencyLocks --warning-mode=fail 통과(685 task), mainCheck 통과(268 task), -p optional-platforms ci 통과, -p build-logic test 78건 통과(손상된 TestKit 캐시 삭제 후) 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
4fb7943b85
commit
0ed7bc8df7
@@ -110,7 +110,8 @@ sourceSets {
|
||||
|
||||
// Every capability a service can select — the commented runtimeOnly lines below — listed once.
|
||||
// Two consumers read it: the whole-repository ArchUnit import (spec §7: the architecture suite sees
|
||||
// every module, the shipped runtime only the selected ones) and the qualification artifact the
|
||||
// every module of this build and the sample, the shipped runtime only the selected ones; the
|
||||
// optional-platforms build is held by its own Gradle direction gate instead) and the qualification artifact the
|
||||
// Compose lanes boot (qualificationBootJar, below). Neither reaches `bootJar`, `test` or
|
||||
// `systemTest`, because a capability on a classpath is switched on there by its mere presence.
|
||||
// A new capability leaf is added here and as a commented line below; nowhere else.
|
||||
@@ -154,6 +155,14 @@ dependencies {
|
||||
// runtimeOnly project(':composition:notification-platform') // 알림 (persistence-jpa 줄도 함께 푼다)
|
||||
|
||||
capabilityProjects.each { architectureTestRuntimeOnly project(it) }
|
||||
// The sample is the reference adopters copy, so the whole-repository rules read it too (review
|
||||
// BUILD-중복-8). Architecture-test runtime only: no production configuration reaches it.
|
||||
//
|
||||
// What this import does NOT see: the optional-platforms build (`grpc:*`, `grpc-advanced:*`).
|
||||
// It is a separate Gradle build, so its classes cannot be on this classpath; its registered
|
||||
// leaves are held by the Gradle direction gate (`-p optional-platforms ci` runs
|
||||
// verifyCleanArchitectureDependencies), which is the whole of what the owner decided it needs.
|
||||
architectureTestRuntimeOnly project(':sample-portfolio')
|
||||
|
||||
// The capability integration lane selects Fileserver and object storage together, as a service
|
||||
// would, and turns off whichever one a test is not about.
|
||||
@@ -311,6 +320,33 @@ bootJar {
|
||||
mainClass = 'dev.caskeleton.bootstrap.CaSkeletonApplication'
|
||||
}
|
||||
|
||||
// The deployable artifact names the release and the commit it was built from in
|
||||
// META-INF/build-info.properties (review BUILD-O3-5: provenance through Spring Boot's build info
|
||||
// rather than a revision in every leaf's jar name). `time` is excluded so an unchanged commit still
|
||||
// produces an unchanged resource and cached tasks stay cached.
|
||||
springBoot {
|
||||
buildInfo {
|
||||
excludes = ['time']
|
||||
properties {
|
||||
additional = ['revision': rootProject.releaseProvenance.sourceRevision]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The deny-by-default public path baseline (docs/security/public-paths-snapshot.txt) is an approval
|
||||
// test beside the security configuration it pins, not a build-logic plugin (review BUILD-O3-5). The
|
||||
// root `verifyPublicPathSnapshot` names this lane; `-PapprovePublicPathChange` rewrites the baseline
|
||||
// after review instead of comparing it.
|
||||
strictTestLanes {
|
||||
lane('publicPathSnapshotTest') {
|
||||
tag = 'public-path-snapshot'
|
||||
description = 'Compares the shipped public path default with the reviewed baseline.'
|
||||
rejectSkipped = true
|
||||
mainStage()
|
||||
systemProperty 'publicpath.snapshot.write', project.hasProperty('approvePublicPathChange') ? 'true' : 'false'
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('stageDockerJar', Sync) {
|
||||
dependsOn tasks.named('bootJar')
|
||||
from(tasks.named('bootJar').flatMap { it.archiveFile })
|
||||
|
||||
@@ -20,6 +20,7 @@ com.github.ben-manes.caffeine:caffeine:3.2.4=annotationProcessor,architectureTes
|
||||
com.github.docker-java:docker-java-api:3.7.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.docker-java:docker-java-transport-zerodep:3.7.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.docker-java:docker-java-transport:3.7.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.f4b6a3:uuid-creator:6.1.1=architectureTestRuntimeClasspath
|
||||
com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.github.luben:zstd-jni:1.5.6-10=architectureTestRuntimeClasspath,qualificationRuntimeClasspath
|
||||
com.github.spotbugs:spotbugs-annotations:4.10.2=spotbugs
|
||||
|
||||
@@ -159,7 +159,7 @@ ca-skeleton:
|
||||
presentation:
|
||||
# Pinned even though application.yml has an inline default, because the default is /v1 and
|
||||
# src/.env says /api. Everything that names a URL in this repository — SECURITY_PUBLIC_PATHS,
|
||||
# the compose healthchecks, bootstrapSmoke, the README curl — assumes /api, so a launcher that
|
||||
# the compose healthchecks, scripts/bootstrap-local.sh, the README curl — assumes /api, so a launcher that
|
||||
# missed src/.env served /v1/healthcheck and answered 401 on the address the docs give.
|
||||
api-base-path: /api
|
||||
privacy:
|
||||
|
||||
+30
-20
@@ -11,6 +11,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.yaml.snakeyaml.LoaderOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
@@ -33,21 +34,26 @@ class DeveloperExperienceContractTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void bootstrapEntrypointIsOwnedByDeveloperBootstrapPlugin() throws IOException {
|
||||
String build = read("src/build.gradle");
|
||||
@DisplayName("로컬 기동 진입점은 네 단계를 순서대로 밟는 scripts/bootstrap-local.sh 하나다")
|
||||
void theLocalBootstrapEntrypointIsOneScriptWithFourOrderedStages() throws IOException {
|
||||
// given
|
||||
Path script = REPOSITORY_ROOT.resolve("scripts/bootstrap-local.sh");
|
||||
|
||||
// Registration and ordering are executable behavior and are covered by
|
||||
// DeveloperBootstrapPluginFunctionalTest. The repository contract only fixes ownership: the
|
||||
// root applies one Java convention and must not duplicate the bootstrap implementation in
|
||||
// Groovy.
|
||||
assertThat(build)
|
||||
.contains("id 'ca.developer-bootstrap'")
|
||||
.doesNotContain("tasks.register('bootstrapCompile')")
|
||||
.doesNotContain("tasks.register('bootstrapDockerPreflight')")
|
||||
.doesNotContain("tasks.register('bootstrapDependencies')")
|
||||
.doesNotContain("tasks.register('bootstrapMigrateAndStart')")
|
||||
.doesNotContain("tasks.register('bootstrapSmoke')")
|
||||
.doesNotContain("tasks.register('bootstrap')");
|
||||
// when
|
||||
String body = Files.readString(script);
|
||||
|
||||
// then
|
||||
// It replaced the build-logic ca.developer-bootstrap plugin (review BUILD-O3-5); starting
|
||||
// containers and probing a port is not a build rule. `set -e` is what makes the order a
|
||||
// contract: a stage runs only when the one before it succeeded.
|
||||
assertThat(Files.isExecutable(script)).isTrue();
|
||||
assertThat(body).contains("set -euo pipefail");
|
||||
assertThat(body.indexOf("bootstrap 1/4"))
|
||||
.isPositive()
|
||||
.isLessThan(body.indexOf("bootstrap 2/4"));
|
||||
assertThat(body.indexOf("bootstrap 2/4")).isLessThan(body.indexOf("bootstrap 3/4"));
|
||||
assertThat(body.indexOf("bootstrap 3/4")).isLessThan(body.indexOf("bootstrap 4/4"));
|
||||
assertThat(read("src/build.gradle")).doesNotContain("ca.developer-bootstrap");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -110,7 +116,7 @@ class DeveloperExperienceContractTest {
|
||||
String readme = read("README.md");
|
||||
|
||||
assertThat(readme)
|
||||
.contains("./gradlew bootstrap")
|
||||
.contains("scripts/bootstrap-local.sh")
|
||||
.contains("GET /api/healthcheck")
|
||||
.contains("## 퀵스타트")
|
||||
.contains("첫 실행 진입점은 하나입니다.");
|
||||
@@ -255,15 +261,19 @@ class DeveloperExperienceContractTest {
|
||||
void architectureWorkflowSelectorsUseTheArchitectureSourceSetTask() throws IOException {
|
||||
String staleSelector = ":app-bootstrap:test --tests 'dev.caskeleton.bootstrap.architecture.*'";
|
||||
|
||||
// The whole-repository architecture suite runs once per pull request, in ci-quality-gates.yml's
|
||||
// `:ci` (architectureCheck). The fileserver workflow's filtered second run was removed (review
|
||||
// BUILD-중복-6), and the release workflow runs only the tag-only releaseCheck.
|
||||
assertThat(read(".github/workflows/ci-quality-gates.yml"))
|
||||
.as("the pull-request gate is the one place the architecture suite runs")
|
||||
.contains("./gradlew :ci");
|
||||
assertThat(read(".github/workflows/fileserver-pr.yml"))
|
||||
.as(
|
||||
"the fileserver PR workflow must execute architecture tests through their source-set"
|
||||
+ " task")
|
||||
.contains(":app-bootstrap:architectureTest")
|
||||
.as("the fileserver PR workflow must not repeat the architecture suite")
|
||||
.doesNotContain(":app-bootstrap:architectureTest")
|
||||
.doesNotContain(staleSelector);
|
||||
|
||||
assertThat(read(".github/workflows/release.yml"))
|
||||
.as("the release workflow delegates repository architecture policy to releaseCheck")
|
||||
.as("the release workflow runs the tag-only checks through releaseCheck")
|
||||
.contains("./gradlew :releaseCheck")
|
||||
.doesNotContain(staleSelector);
|
||||
|
||||
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
package dev.caskeleton.bootstrap.security;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.catchThrowable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* The deny-by-default public path surface against its committed, reviewed baseline.
|
||||
*
|
||||
* <p>An approval test rather than the build-logic {@code ca.public-path-snapshot} plugin it
|
||||
* replaced (review 2026-09-24 BUILD-O3-5): the rule is about this composition root's shipped
|
||||
* security configuration, so it lives beside it. The repository comparison runs in the main-stage
|
||||
* lane {@code publicPathSnapshotTest} (root alias {@code verifyPublicPathSnapshot}); approving a
|
||||
* reviewed change is {@code ./gradlew verifyPublicPathSnapshot -PapprovePublicPathChange}, which
|
||||
* rewrites the baseline instead of comparing. The rendering cases run in {@code test}.
|
||||
*/
|
||||
class PublicPathSnapshotTest {
|
||||
|
||||
private static final Path SECURITY_CONFIGURATION =
|
||||
Path.of("src/main/resources/config/security.yml");
|
||||
private static final Path SNAPSHOT = Path.of("../../docs/security/public-paths-snapshot.txt");
|
||||
private static final Pattern BINDING = Pattern.compile("^\\s*public-paths:\\s*(\\S.*?)\\s*$");
|
||||
private static final Pattern DEFAULTED_PLACEHOLDER =
|
||||
Pattern.compile("\\$\\{[A-Za-z0-9_.]+:([^{}]*)}");
|
||||
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
|
||||
# -> 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
|
||||
""";
|
||||
|
||||
@Test
|
||||
@Tag("public-path-snapshot")
|
||||
@DisplayName("배포되는 public path 기본값이 검토된 기준선과 같다")
|
||||
void theShippedPublicPathDefaultMatchesTheReviewedBaseline() throws IOException {
|
||||
// given
|
||||
String rendered = render(Files.readAllLines(SECURITY_CONFIGURATION, StandardCharsets.UTF_8));
|
||||
if (Boolean.getBoolean("publicpath.snapshot.write")) {
|
||||
Files.writeString(SNAPSHOT, rendered, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
// when
|
||||
String committed =
|
||||
Files.isRegularFile(SNAPSHOT) ? Files.readString(SNAPSHOT, StandardCharsets.UTF_8) : "";
|
||||
|
||||
// then
|
||||
assertThat(committed)
|
||||
.as(
|
||||
"the deny-by-default public path surface changed, so a protected endpoint may now be"
|
||||
+ " public. Review it, then run ./gradlew verifyPublicPathSnapshot"
|
||||
+ " -PapprovePublicPathChange")
|
||||
.isEqualTo(rendered);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("중첩된 기본값 placeholder를 풀어 정렬된 경로 목록으로 만든다")
|
||||
void nestedDefaultedPlaceholdersUnwindToASortedPathList() {
|
||||
// given
|
||||
List<String> configuration =
|
||||
List.of(
|
||||
"ca-skeleton:",
|
||||
" security:",
|
||||
" public-paths: ${SECURITY_PUBLIC_PATHS:${API_BASE:/v1}/z,${API_BASE:/v1}/a}");
|
||||
|
||||
// when
|
||||
String rendered = render(configuration);
|
||||
|
||||
// then
|
||||
assertThat(rendered).isEqualTo(HEADER + "/v1/a\n/v1/z\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("기본값 없는 placeholder가 남으면 기준선을 만들지 않고 실패한다")
|
||||
void aPlaceholderWithoutADefaultCannotBeSnapshotted() {
|
||||
// given
|
||||
List<String> configuration = List.of(" public-paths: ${SECURITY_PUBLIC_PATHS}");
|
||||
|
||||
// when
|
||||
Throwable failure = catchThrowable(() -> render(configuration));
|
||||
|
||||
// then
|
||||
assertThat(failure)
|
||||
.isInstanceOf(IllegalStateException.class)
|
||||
.hasMessageContaining("still holds a placeholder with no default");
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("public-paths 바인딩이 정확히 하나가 아니면 실패한다")
|
||||
void aConfigurationWithoutExactlyOneBindingIsRefused() {
|
||||
// given
|
||||
List<String> configuration = List.of("ca-skeleton:", " security: {}");
|
||||
|
||||
// when
|
||||
Throwable failure = catchThrowable(() -> render(configuration));
|
||||
|
||||
// then
|
||||
assertThat(failure)
|
||||
.isInstanceOf(IllegalStateException.class)
|
||||
.hasMessageContaining("expected exactly one 'public-paths:' binding, found 0");
|
||||
}
|
||||
|
||||
private static String render(List<String> configuration) {
|
||||
List<String> bindings = new ArrayList<>();
|
||||
for (String line : configuration) {
|
||||
Matcher matcher = BINDING.matcher(line);
|
||||
if (matcher.matches()) {
|
||||
bindings.add(matcher.group(1));
|
||||
}
|
||||
}
|
||||
if (bindings.size() != 1) {
|
||||
throw new IllegalStateException(
|
||||
"expected exactly one 'public-paths:' binding, found "
|
||||
+ bindings.size()
|
||||
+ " — the snapshot cannot say which surface it pins");
|
||||
}
|
||||
String raw = bindings.getFirst();
|
||||
for (int depth = 0; depth < 16; depth++) {
|
||||
Matcher matcher = DEFAULTED_PLACEHOLDER.matcher(raw);
|
||||
if (!matcher.find()) {
|
||||
break;
|
||||
}
|
||||
raw = raw.substring(0, matcher.start()) + matcher.group(1) + raw.substring(matcher.end());
|
||||
}
|
||||
if (raw.contains("${")) {
|
||||
throw new IllegalStateException(
|
||||
"'public-paths' resolves to '"
|
||||
+ raw
|
||||
+ "', which still holds a placeholder with no default — the deployed surface is not"
|
||||
+ " determined by the repository");
|
||||
}
|
||||
List<String> paths =
|
||||
Pattern.compile(",")
|
||||
.splitAsStream(raw)
|
||||
.map(String::trim)
|
||||
.filter(value -> !value.isEmpty())
|
||||
.sorted()
|
||||
.toList();
|
||||
return HEADER + (paths.isEmpty() ? "" : String.join("\n", paths) + "\n");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user