From cbfa776270a7b51ea5cc66a247998be0df1134cb Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 13 Nov 2026 06:34:32 +0900 Subject: [PATCH] =?UTF-8?q?build!:=20=EC=8B=9C=ED=97=98=20classpath=C2=B7?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EA=B3=A0=EC=A0=95=C2=B7=EC=B9=B4?= =?UTF-8?q?=ED=83=88=EB=A1=9C=EA=B7=B8=C2=B7API=20surface=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=EC=9D=84=20=EC=A0=95=EB=B3=B8=EB=8C=80=EB=A1=9C=20?= =?UTF-8?q?=EB=A7=9E=EC=B6=98=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: - ca.spring-library가 모든 spring leaf(30)의 testImplementation에 spring-boot-starter-webmvc-test를 넣어, MockMvc를 쓰지 않는 23 leaf가 Tomcat을 시험 classpath에 resolve하고 lock했다. - container-images.properties 머리말은 「digest로 고정」이라는데 postgres-17·18이 tag만이었다. 머리말은 「쓰는 lane만 다시 돈다」고 했지만 파일 전체가 모든 Test task의 입력이라 이미지 하나만 바꿔도 모든 lane이 다시 돈다. postgres-16-4는 아무도 읽지 않았다. - libs.versions.toml에 아무도 읽지 않는 칸이 있었다(라이브러리 9, 버전 4, 루트에 적용하지 않는 플러그인 4). - config/spotbugs/exclude.xml에 없는 클래스의 항목이 있었다(exclude-test.xml에 이미 있다). - notification의 API surface가 상대 경로로 application-notification 소스를 가리켰고, ApiSurface 플러그인은 없는 추가 root를 말없이 건너뛰어 승인 update가 줄어든 표면을 기록할 수 있었다. - verify-mongodb-platform.sh가 고르는 클래스가 없는 :app-bootstrap:test --tests '*CleanArchitectureTest'를 불러 늘 실패했고, 이미지 기록이 카탈로그와 다른 tag였다. 고친 것: - 규약은 spring-boot-starter-test만 준다. 시험이 실제로 쓰는 것을 leaf가 직접 선언한다. MockMvc를 쓰는 web·web-advanced·web-fileserver·web-notification· app-bootstrap은 webmvc-test starter, graphql은 TestRestTemplate의 spring-boot-resttestclient, durable-operation은 WebApplicationContextRunner의 spring-web, 시험이 JSON을 읽는 objectstorage·persistence-jpa·persistence-mongo· notification-platform은 jackson-databind, redis-runtime은 jackson-annotations (compileOnly, 본 코드와 같은 이유)다. 모든 Java source set을 한 빌드에서 컴파일해 빠진 곳이 없음을 확인하고 lockfile을 다시 만들었다(Tomcat·webmvc 시험 자동설정이 빠짐). graphql·persistence-mongo AGENTS의 허용·시험 목록을 같이 고쳤다. - postgres 17·18을 desktop runner에서 받은 digest로 고정했다(17.11, 18.6). 목록을 읽을 때 digest 없는 값을 GradleException으로 거절한다(ContainerImageCatalogTest). 머리말을 실제 캐시 동작으로 고쳤고 postgres-16-4를 지웠다. persistence-jpa release registry의 PostgreSQL tag는 아무도 읽지 않아 지우고, 이미지는 카탈로그가 정한다고 적었다. - 카탈로그의 미사용 칸을 지우고 머리말을 지금 쓰임에 맞췄다. - 죽은 spotbugs 항목을 지웠다. - notification은 project(':application-notification')로 root를 잡고, 없는 추가 root는 설정 단계에서 실패한다(ApiSurfaceConventionTest). - mongo 스크립트는 :app-bootstrap:architectureTest를 부르고, 이미지 기록은 카탈로그 mongo-8 값을 읽는다. - graphql build.gradle에 앞 커밋의 document-contract lane을 함께 둔다. 저장소 루트 (ca.repository.root)와 읽는 registry 파일은 그 lane만 받고, 시험은 그 속성으로만 루트를 읽는다(cwd에서 거슬러 찾지 않는다). 버린 대안: 이미지마다 쓰는 lane을 선언해 입력을 나누기 — lane 수십 개에 키 목록을 다시 적어야 하고 빠뜨리면 캐시가 거짓 통과한다. 검증: 아래 PR 본문(desktop resolveAndLockAll·build-logic test·모든 source set 컴파일· leaf check). BREAKING CHANGE: ca.spring-library가 시험 classpath에 spring-boot-starter-webmvc-test를 넣지 않는다. MockMvc·TestRestTemplate·Jackson을 그 starter로 받던 파생 leaf는 의존을 직접 선언해야 시험이 컴파일된다. 카탈로그의 digest 없는 이미지와 없는 API surface 추가 root는 설정 단계에서 실패한다. version catalog의 미사용 칸을 지웠다. 할 일은 docs/upgrade/2026-11-round9-build.md다. Refs: RR9-04-06, RR9-04-11, RR9-04-12, RR9-04-13, RR9-04-14, RR9-04-15, RR9-04-16 --- .../apisurface/ApiSurfacePlugin.java | 20 +++++-- .../SpringLibraryConventionPlugin.java | 11 ++-- .../java/JavaConventionsPlugin.java | 21 +++++++- .../apisurface/ApiSurfaceConventionTest.java | 21 ++++++++ .../java/ContainerImageCatalogTest.java | 50 +++++++++++++++++ config/spotbugs/exclude.xml | 10 ---- docs/upgrade/2026-11-round9-build.md | 25 +++++++++ gradle/container-images.properties | 18 +++---- gradle/libs.versions.toml | 54 +++++-------------- src/adapter/inbound/graphql/AGENTS.md | 9 +++- src/adapter/inbound/graphql/build.gradle | 21 ++++++++ src/adapter/inbound/graphql/gradle.lockfile | 3 -- ...aphQlDeploymentModeRegistryParityTest.java | 16 +++--- src/adapter/inbound/grpc/gradle.lockfile | 22 -------- src/adapter/inbound/messaging/gradle.lockfile | 27 ++-------- src/adapter/inbound/web-advanced/build.gradle | 3 ++ .../inbound/web-fileserver/build.gradle | 3 ++ .../inbound/web-notification/build.gradle | 3 ++ src/adapter/inbound/web/build.gradle | 3 ++ src/adapter/inbound/websocket/gradle.lockfile | 4 -- .../outbound/cache-redis/gradle.lockfile | 22 -------- .../outbound/fileserver/gradle.lockfile | 23 -------- .../outbound/httpclient/gradle.lockfile | 18 ------- .../outbound/identifier/gradle.lockfile | 23 -------- .../outbound/messaging-kafka/gradle.lockfile | 28 ++-------- .../outbound/messaging/gradle.lockfile | 18 ------- .../outbound/notification/build.gradle | 4 +- .../outbound/notification/gradle.lockfile | 18 ------- .../outbound/objectstorage/build.gradle | 2 + .../outbound/objectstorage/gradle.lockfile | 19 ------- .../persistence-fileserver/gradle.lockfile | 24 +-------- .../outbound/persistence-jpa/build.gradle | 2 + .../outbound/persistence-jpa/gradle.lockfile | 19 ------- .../release/release-registry.json | 12 +++-- .../outbound/persistence-mongo/AGENTS.md | 2 +- .../outbound/persistence-mongo/build.gradle | 2 + .../persistence-mongo/gradle.lockfile | 19 ------- .../persistence-notification/gradle.lockfile | 22 -------- .../outbound/redis-runtime/build.gradle | 3 ++ .../outbound/redis-runtime/gradle.lockfile | 24 +-------- .../outbound/redis-sdk/gradle.lockfile | 23 -------- src/adapter/outbound/support/gradle.lockfile | 22 -------- src/bootstrap/app/build.gradle | 3 ++ src/bootstrap/durable-operation/build.gradle | 3 ++ .../durable-operation/gradle.lockfile | 39 ++++++-------- .../fileserver-platform/gradle.lockfile | 39 ++++++-------- src/bootstrap/idempotency/gradle.lockfile | 24 +-------- .../notification-platform/build.gradle | 2 + .../notification-platform/gradle.lockfile | 33 +++++------- src/bootstrap/outbox-relay/gradle.lockfile | 22 -------- src/bootstrap/service-runtime/gradle.lockfile | 21 -------- 51 files changed, 298 insertions(+), 581 deletions(-) create mode 100644 build-logic/src/test/java/dev/caskeleton/buildlogic/java/ContainerImageCatalogTest.java create mode 100644 docs/upgrade/2026-11-round9-build.md diff --git a/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/ApiSurfacePlugin.java b/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/ApiSurfacePlugin.java index a022deaa..9f261c36 100644 --- a/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/ApiSurfacePlugin.java +++ b/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/ApiSurfacePlugin.java @@ -34,10 +34,22 @@ public final class ApiSurfacePlugin implements Plugin { if (extension.getSourceRoot() != null && !extension.getSourceRoot().isBlank()) { sourcePaths.add(extension.getSourceRoot()); } - extension.getAdditionalSourceRoots().stream() - .filter(path -> path != null && !path.isBlank()) - .forEach(sourcePaths::add); - List roots = sourcePaths.stream().map(project::file).toList(); + List additional = + extension.getAdditionalSourceRoots().stream() + .filter(path -> path != null && !path.isBlank()) + .map(project::file) + .toList(); + // A missing additional root used to be skipped without a word, so an approved update + // recorded a surface with a whole module's types gone (2026-11-12 review). + List missing = additional.stream().filter(root -> !root.isDirectory()).toList(); + if (!missing.isEmpty()) { + throw new GradleException( + project.getPath() + + " apiSurface.additionalSourceRoots names a folder that does not exist: " + + missing); + } + List roots = new ArrayList<>(sourcePaths.stream().map(project::file).toList()); + roots.addAll(additional); String verifyTaskName = "verify" + label + "ApiSurface"; String updateTaskName = "update" + label + "ApiSurface"; String approvalProperty = "approve" + label + "ApiSurfaceChange"; diff --git a/build-logic/src/main/java/dev/caskeleton/buildlogic/convention/SpringLibraryConventionPlugin.java b/build-logic/src/main/java/dev/caskeleton/buildlogic/convention/SpringLibraryConventionPlugin.java index f4757d60..46905c75 100644 --- a/build-logic/src/main/java/dev/caskeleton/buildlogic/convention/SpringLibraryConventionPlugin.java +++ b/build-logic/src/main/java/dev/caskeleton/buildlogic/convention/SpringLibraryConventionPlugin.java @@ -3,6 +3,14 @@ package dev.caskeleton.buildlogic.convention; import org.gradle.api.Plugin; import org.gradle.api.Project; +/** + * Quality conventions plus the Spring Boot test starter for a Spring library leaf. + * + *

Only {@code spring-boot-starter-test}. The web MVC test starter (MockMvc, {@code @WebMvcTest}, + * and an embedded Tomcat with them) used to be added to every leaf here, so thirty leaves resolved + * and locked a servlet container for tests that never start one. A leaf whose tests use MockMvc + * declares {@code spring-boot-starter-webmvc-test} in its own build script (2026-11-12 review). + */ public final class SpringLibraryConventionPlugin implements Plugin { @Override public void apply(Project project) { @@ -10,8 +18,5 @@ public final class SpringLibraryConventionPlugin implements Plugin { project .getDependencies() .add("testImplementation", "org.springframework.boot:spring-boot-starter-test"); - project - .getDependencies() - .add("testImplementation", "org.springframework.boot:spring-boot-starter-webmvc-test"); } } diff --git a/build-logic/src/main/java/dev/caskeleton/buildlogic/java/JavaConventionsPlugin.java b/build-logic/src/main/java/dev/caskeleton/buildlogic/java/JavaConventionsPlugin.java index e3cf9012..7b75200e 100644 --- a/build-logic/src/main/java/dev/caskeleton/buildlogic/java/JavaConventionsPlugin.java +++ b/build-logic/src/main/java/dev/caskeleton/buildlogic/java/JavaConventionsPlugin.java @@ -310,7 +310,14 @@ public final class JavaConventionsPlugin implements Plugin { return catalog; } - private static Map containerImages(File catalog) { + /** + * The catalog, refused when an image is not pinned by digest. + * + *

The catalog's header promises digests: a red lane should mean this repository changed, not + * that a registry moved a tag. Two images were tag-only for weeks with a note to pin them later + * (2026-11-12 review), and nothing noticed, so the promise is checked where the file is read. + */ + static Map containerImages(File catalog) { Properties properties = new Properties(); try (var in = Files.newInputStream(catalog.toPath())) { properties.load(in); @@ -319,6 +326,18 @@ public final class JavaConventionsPlugin implements Plugin { } Map images = new TreeMap<>(); properties.stringPropertyNames().forEach(key -> images.put(key, properties.getProperty(key))); + List unpinned = + images.entrySet().stream() + .filter(entry -> !entry.getValue().contains("@sha256:")) + .map(Map.Entry::getKey) + .toList(); + if (!unpinned.isEmpty()) { + throw new GradleException( + catalog.getName() + + ": pin every image by digest (repository@sha256:...), with its tag in a comment;" + + " not pinned: " + + unpinned); + } return Map.copyOf(images); } } diff --git a/build-logic/src/test/java/dev/caskeleton/buildlogic/apisurface/ApiSurfaceConventionTest.java b/build-logic/src/test/java/dev/caskeleton/buildlogic/apisurface/ApiSurfaceConventionTest.java index 06869bc6..ab4550d8 100644 --- a/build-logic/src/test/java/dev/caskeleton/buildlogic/apisurface/ApiSurfaceConventionTest.java +++ b/build-logic/src/test/java/dev/caskeleton/buildlogic/apisurface/ApiSurfaceConventionTest.java @@ -173,6 +173,27 @@ class ApiSurfaceConventionTest { """); } + @Test + @org.junit.jupiter.api.DisplayName("없는 추가 source root는 건너뛰지 않고 그 경로를 짚어 실패한다") + void aMissingAdditionalSourceRootFailsInsteadOfShrinkingTheSurface() throws Exception { + // given + Files.writeString( + projectDir.resolve("build.gradle"), + Files.readString(projectDir.resolve("build.gradle")) + .replace( + "baseline = file('surface.txt')", + "baseline = file('surface.txt')\n additionalSourceRoots = ['../moved/src/main/java']")); + + // when + BuildResult result = + runner("updateFixtureApiSurface", "-PapproveFixtureApiSurfaceChange").buildAndFail(); + + // then + assertTrue( + result.getOutput().contains("additionalSourceRoots names a folder that does not exist"), + result.getOutput()); + } + private void writeConfiguredBuild(String sourceRoot) throws Exception { Files.writeString( projectDir.resolve("build.gradle"), diff --git a/build-logic/src/test/java/dev/caskeleton/buildlogic/java/ContainerImageCatalogTest.java b/build-logic/src/test/java/dev/caskeleton/buildlogic/java/ContainerImageCatalogTest.java new file mode 100644 index 00000000..2c5035c7 --- /dev/null +++ b/build-logic/src/test/java/dev/caskeleton/buildlogic/java/ContainerImageCatalogTest.java @@ -0,0 +1,50 @@ +package dev.caskeleton.buildlogic.java; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import org.gradle.api.GradleException; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +class ContainerImageCatalogTest { + + @Test + @DisplayName("digest 없이 tag만 적은 이미지는 목록을 읽는 단계에서 그 키를 짚어 실패한다") + void aTagOnlyImageFailsNamingItsKey(@TempDir Path directory) throws IOException { + // given + Path catalog = directory.resolve("container-images.properties"); + Files.writeString( + catalog, + "pinned=postgres@sha256:" + + "0".repeat(64) + + "\nfloating=postgres:17-alpine\n"); + + // when + Throwable failure = catchThrowable(() -> JavaConventionsPlugin.containerImages(catalog.toFile())); + + // then + assertThat(failure) + .isInstanceOf(GradleException.class) + .hasMessageEndingWith("not pinned: [floating]"); + } + + @Test + @DisplayName("모든 이미지가 digest로 고정된 목록은 키와 값을 그대로 돌려준다") + void aDigestPinnedCatalogIsReadAsIs(@TempDir Path directory) throws IOException { + // given + Path catalog = directory.resolve("container-images.properties"); + String image = "postgres@sha256:" + "a".repeat(64); + Files.writeString(catalog, "# postgres:17-alpine\npostgres-17=" + image + "\n"); + + // when + var images = JavaConventionsPlugin.containerImages(catalog.toFile()); + + // then + assertThat(images).containsExactly(java.util.Map.entry("postgres-17", image)); + } +} diff --git a/config/spotbugs/exclude.xml b/config/spotbugs/exclude.xml index 99a0419c..2ee07473 100644 --- a/config/spotbugs/exclude.xml +++ b/config/spotbugs/exclude.xml @@ -59,16 +59,6 @@ - - - - - - -