From 5decbae77a9d606b37970b0bf263effe985cab96 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 18 Nov 2026 23:39:20 +0900 Subject: [PATCH 1/3] =?UTF-8?q?ci(compose):=20=EC=8B=A4=ED=8C=A8=ED=95=9C?= =?UTF-8?q?=20lane=EC=9D=B4=20=EB=A9=88=EC=B6=98=20=EB=8B=A8=EA=B3=84?= =?UTF-8?q?=EC=99=80=20=EA=B7=B8=20=EB=8B=A8=EA=B3=84=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=20=EA=BC=AC=EB=A6=AC=EB=A5=BC=20job=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=97=90=20=EB=82=A8=EA=B8=B4=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: nightly compose-smoke가 run 306·315·318·321·324에서 18개 lane을 모두 실패시켰는데 job 로그에는 lane 이름만 있다. 실패 이유는 lane 증거 폴더 (build.log, compose.log 등)에 있고, 그 폴더는 job 컨테이너와 함께 사라진다. 특히 앱 이미지 빌드는 출력을 build.log로만 보내 실패해도 한 줄도 남지 않는다. 방법: lane이 단계마다 lane_step으로 이름과 그 단계가 쓰는 증거 파일을 적는다. lane이 실패하면 trap이 logs·containers를 모은 뒤, teardown 전에 stderr로 멈춘 단계, 그 단계 로그의 마지막 25줄, 컨테이너마다 상태·exit code·health, compose.log의 마지막 오류 줄 15개를 쓴다. 정적 계약 검사가 실패하면 그 로그 꼬리도 쓴다. 출력은 모두 이미 가린(redact) 증거에서 나온다. one-shot 개수 검사와 handoff 1단계 뒤의 재시작 기록·app 정지 앞에는 로그 없는 lane_step(「one-shot count」, 「handoff restart into the second phase」)을 둔다. 그렇지 않으면 그 실패가 이미 성공한 앞 단계의 이름과 로그 꼬리로 보고된다. 버린 대안: 증거 폴더를 artifact로 올리기 — .gitea workflow에 upload-artifact를 더해야 하고(Gitea는 v4 이상을 못 쓴다) 받아서 열어야 이유가 보인다. job 로그의 몇 줄이 더 빠르다. 위험·한계: 출력이 실패한 lane마다 50줄 안팎 는다. 성공한 lane의 출력은 그대로다. report 함수는 `|| true`로 불러 실패해도 teardown을 건너뛰지 않는다. handoff 재시작 실패는 일부러 만들어 보지 않았다(one-shot 개수 검사와 같은 장치). 검증(desktop, 공유 잠금 아래, 기준 99cc4f59): - RED: 기준 트리 + 진단만으로 `--lane off-local` rc=1. job 로그에 「failed in step 'build app image'」와 build.log 꼬리(`names a folder that does not exist`)가 남았다. 진단 전에는 lane 이름 한 줄뿐이었다. - 일부러 만든 개수 실패(선언한 one-shot 수 + 1, 버릴 worktree): 이 커밋의 스크립트는 「failed in step 'one-shot count'」, 로그 꼬리 없음. 개수·handoff lane_step 두 줄이 없던 스크립트는 이미 성공한 「startup log is silent」와 startup.log 꼬리를 찍었다. - 브랜치 끝 트리 efc4cdda: `:app-bootstrap:verifyEnvKeys --no-build-cache` rc=0(이 스크립트를 읽는다), 전체 matrix 18 lane 모두 통과 rc=0. - 노트북 `bash -n`, `python3 -m unittest discover -s scripts/tests` 166개 rc=0. --- scripts/run-compose-runtime-smoke.sh | 52 +++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/scripts/run-compose-runtime-smoke.sh b/scripts/run-compose-runtime-smoke.sh index 1092bc9a..c944db8d 100755 --- a/scripts/run-compose-runtime-smoke.sh +++ b/scripts/run-compose-runtime-smoke.sh @@ -91,6 +91,37 @@ PROJECT="" LANE_TMP="" LANE_EVIDENCE="" LANE_ARGS=() +# The step the lane is in and the evidence file that step writes. A failed lane reports both, because +# the job log is all a CI reader gets: the evidence directory dies with the job container, and the +# nightly matrix of 2026-11-13..17 failed all eighteen lanes with nothing in the log but their names. +LANE_STEP="" +LANE_STEP_LOG="" +lane_step() { LANE_STEP="$1"; LANE_STEP_LOG="${2:-}"; } + +# A few lines that name the cause, on stderr: the step, the end of that step's log, the state of each +# container and the last error lines of the stack. Everything printed is already redacted evidence. +# Called from the trap with `|| true`, so nothing in here can skip the teardown after it. +report_lane_failure() { + local lane + lane="$(basename "$(dirname "${LANE_EVIDENCE}")")" + echo "-- ${lane}: failed in step '${LANE_STEP:-unknown}' (evidence ${LANE_EVIDENCE})" + if [[ -n "${LANE_STEP_LOG}" && -s "${LANE_STEP_LOG}" ]]; then + redact_in_place "${LANE_STEP_LOG}" + echo "-- ${lane}: last lines of $(basename "${LANE_STEP_LOG}"):" + tail -n 25 "${LANE_STEP_LOG}" | cut -c1-300 | sed 's/^/ | /' + fi + if [[ -s "${LANE_EVIDENCE}/containers.json" ]]; then + echo "-- ${lane}: containers:" + jq -r 'if type == "array" then .[] else . end + | " | \(.Service) \(.State) exit=\(.ExitCode) health=\(.Health // "-") \(.Status)"' \ + "${LANE_EVIDENCE}/containers.json" 2>/dev/null + fi + if [[ -s "${LANE_EVIDENCE}/compose.log" ]]; then + echo "-- ${lane}: last error lines of compose.log:" + grep -E 'ERROR|FATAL|Exception|exited with code' "${LANE_EVIDENCE}/compose.log" | tail -n 15 \ + | cut -c1-300 | sed 's/^/ | /' + fi +} >&2 cleanup_lane() { local status=$? @@ -109,6 +140,9 @@ cleanup_lane() { # one artifact Wave 4's gate reads was the one that could not see them. grep -E ' (WARN|ERROR) ' "${LANE_EVIDENCE}/compose.log" 2>/dev/null \ >"${LANE_EVIDENCE}/warnings.log" || true + if [[ ${status} -ne 0 ]]; then + report_lane_failure || true + fi fi # This project only. Never a bare `down`, which would take out whatever else the developer has # running, and never a volume outside it. @@ -177,6 +211,7 @@ run_lane() { return 1 fi mkdir -p "${LANE_EVIDENCE}" + lane_step "prepare (secrets, certificates, overlay)" LANE_TMP="$(mktemp -d)" chmod 700 "${LANE_TMP}" @@ -405,14 +440,17 @@ run_lane() { # 2. render, then create. The static contract ran once for the whole run, before the first lane # (it renders every lane itself, so running it per lane rendered the matrix once per lane). + lane_step "render (compose config)" ( cd "${REPO_ROOT}" && docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" config >"${LANE_EVIDENCE}/rendered.yml" ) redact_in_place "${LANE_EVIDENCE}/rendered.yml" # Build before create. The app service declares both `build:` and `image:`, so Compose reuses a # matching tag if one is lying around — and the first run of this lane did exactly that, starting # a jar built from a different state of the repository and failing on a class that no longer # exists in the tree. A lane that runs a stale image produces evidence about code nobody changed. + lane_step "build app image" "${LANE_EVIDENCE}/build.log" ( cd "${REPO_ROOT}" && docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" build app \ >"${LANE_EVIDENCE}/build.log" 2>&1 ) + lane_step "create" ( cd "${REPO_ROOT}" && docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" create >/dev/null ) # 3a. Anything that has to happen before the application starts, in the order the lane lists it. @@ -434,6 +472,7 @@ run_lane() { while read -r -u 4 pre_start; do [[ -z "${pre_start}" ]] && continue echo "-- ${id}: ${pre_start} (before start)" + lane_step "pre-start ${pre_start}" "${LANE_EVIDENCE}/${pre_start}.log" if ! ( cd "${REPO_ROOT}" && docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" run --rm "${pre_start}" "${LANE_EVIDENCE}/${pre_start}.log" 2>&1; then redact_in_place "${LANE_EVIDENCE}/${pre_start}.log" @@ -451,6 +490,7 @@ run_lane() { # retries, and the silent-startup check below failed on a race rather than a defect (local-messaging, # main run 59, 2026-11-11; the same lane passed in the run before and on the desktop). backing="$(grep -vx app <<<"${long_running}" || true)" + lane_step "up --wait" if [[ -n "${backing}" ]]; then # shellcheck disable=SC2086 ( cd "${REPO_ROOT}" && docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" up --wait --wait-timeout 300 ${backing} ) @@ -459,6 +499,7 @@ run_lane() { ( cd "${REPO_ROOT}" && docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" up --wait --wait-timeout 300 ${long_running} ) await_application_report() { + lane_step "application report (health, info)" # The application's own answer, not this script's input. # # The management port, not the application port. Actuator runs on its own connector here so the @@ -536,6 +577,7 @@ run_lane() { second_smoke="$(jq -r '.handoff.secondPhaseSmoke' <<<"${lane_json}")" echo "-- ${id}: ${first_smoke} (handoff phase 1)" + lane_step "handoff phase 1" "${LANE_EVIDENCE}/notification-smoke-phase1.log" if ! ( cd "${REPO_ROOT}" && NOTIFICATION_SMOKE_PHASE="${first_smoke}" \ docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" run --rm notification-smoke "${LANE_EVIDENCE}/notification-smoke-phase1.log" 2>&1; then @@ -549,6 +591,7 @@ run_lane() { # Recorded before the recreate: --force-recreate makes a new container whose restart count # starts at zero, so a kill during the first phase would otherwise leave no trace. + lane_step "handoff restart into the second phase" record_restarts phase1 || return 1 # The application only. The database and its volume stay up, which is the whole point. @@ -556,6 +599,7 @@ run_lane() { ( cd "${REPO_ROOT}" && docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" stop app >/dev/null 2>&1 ) write_lane_overlay '{}' + lane_step "handoff restart into the second phase" ( cd "${REPO_ROOT}" && docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" \ up -d --force-recreate --wait --wait-timeout 300 app ) await_application_report || return 1 @@ -572,6 +616,7 @@ run_lane() { # StartupWarningZeroTest asserts the same property in-process for the all-off composition. This is # the same assertion against a real container with the lane's switches actually on. local startup_log="${LANE_EVIDENCE}/startup.log" + lane_step "startup log is silent" "${startup_log}" docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" logs --no-color app \ >"${startup_log}" 2>&1 || true redact_in_place "${startup_log}" @@ -595,6 +640,7 @@ run_lane() { while read -r -u 4 one_shot; do [[ -z "${one_shot}" ]] && continue echo "-- ${id}: ${one_shot}" + lane_step "one-shot ${one_shot}" "${LANE_EVIDENCE}/${one_shot}.log" if ! ( cd "${REPO_ROOT}" && docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" run --rm "${one_shot}" "${LANE_EVIDENCE}/${one_shot}.log" 2>&1; then redact_in_place "${LANE_EVIDENCE}/${one_shot}.log" @@ -604,6 +650,7 @@ run_lane() { redact_in_place "${LANE_EVIDENCE}/${one_shot}.log" ran_one_shots=$((ran_one_shots + 1)) done 4< <(jq -r '.oneShotServices[]?' <<<"${lane_json}") + lane_step "one-shot count" if [[ "${ran_one_shots}" -ne "${declared_one_shots}" ]]; then echo "${id}: ran ${ran_one_shots} of ${declared_one_shots} one-shots; a partial lane is not a pass" >&2 return 1 @@ -619,6 +666,7 @@ run_lane() { # the restart itself has to be the failure. The peak memory is recorded beside it, so a lane that # is close to its limit is visible before it crosses it. local restarted="" + lane_step "no restart, no OOM kill" "${LANE_EVIDENCE}/restarts.txt" docker compose -p "${PROJECT}" "${LANE_ARGS[@]}" exec -T app cat /sys/fs/cgroup/memory.peak \ >"${LANE_EVIDENCE}/app-memory-peak-bytes.txt" 2>/dev/null || true record_restarts final || return 1 @@ -650,7 +698,9 @@ FAILED_LANES=() mkdir -p "${EVIDENCE_ROOT}" CONTRACT_LOG="${EVIDENCE_ROOT}/contract-${RUN_ID}.log" "${REPO_ROOT}/scripts/verify-compose-profile-contracts.sh" >"${CONTRACT_LOG}" 2>&1 \ - || { echo "run-compose-runtime-smoke: the static Compose contract failed; see ${CONTRACT_LOG}" >&2; exit 1; } + || { echo "run-compose-runtime-smoke: the static Compose contract failed; see ${CONTRACT_LOG}" >&2 + tail -n 25 "${CONTRACT_LOG}" | sed 's/^/ | /' >&2 + exit 1; } if [[ "${MODE}" == "lane" ]]; then lane_json="$(jq -c --arg id "${SELECTED_LANE}" '.lanes[] | select(.id == $id)' "${CONTRACTS}")" -- 2.54.0 From df43bef9a0b4c742467e38e91e7de17d14bb8c2f Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 18 Nov 2026 23:39:20 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix(build-logic):=20=EC=97=86=EB=8A=94=20AP?= =?UTF-8?q?I=20surface=20=EC=B6=94=EA=B0=80=20root=EB=A5=BC=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EB=8B=A8=EA=B3=84=EA=B0=80=20=EC=95=84=EB=8B=88?= =?UTF-8?q?=EB=9D=BC=20surface=20=ED=83=9C=EC=8A=A4=ED=81=AC=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EA=B1=B0=EC=A0=88=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: cbfa77627이 apiSurface.additionalSourceRoots의 폴더가 없으면 afterEvaluate에서 실패하게 했다. Dockerfile builder의 의존성 단계는 leaf의 소스를 복사하지 않은 채 `./gradlew verifyDependencyLocks`를 돌리므로 src/application/notification/src/main/java가 없고, :adapter:outbound:notification 설정이 실패해 이미지 빌드가 멈춘다. compose smoke의 모든 lane이 이 빌드로 시작해 nightly run 306·315·318·321·324에서 18개 lane이 모두 실패했다. 같은 Dockerfile을 쓰는 release 이미지 빌드와 scripts/bootstrap-local.sh도 멈춘다. 방법: 검사를 verify·update surface 태스크의 실행 첫머리로 옮긴다 (AdditionalSourceRoots.requireExisting). surface를 계산하는 순간에는 여전히 없는 root를 경로와 함께 거절하므로 2026-11-12 리뷰가 막은 「줄어든 surface 승인」은 그대로 막힌다. surface를 읽지 않는 빌드(의존성 확인, help)는 설정을 마친다. 버린 대안: (1) Dockerfile 의존성 단계에 src/**/src/main/java 빈 폴더를 만들기 — 검사가 빈 폴더를 통과시켜 검사의 뜻이 사라진다. (2) 검사를 끄는 속성을 Dockerfile에서 주기 — 스위치가 하나 늘고 다른 빌드도 그 스위치를 쓸 수 있다. 위험·한계: 없는 root가 이제 surface 태스크를 돌릴 때만 드러난다. 그 태스크는 각 leaf의 check(PR 단계)에 들어 있어 PR에서 걸리는 시점은 같다. 검증(desktop, 공유 잠금 아래, 기준 99cc4f59): - RED: 기준 트리 + 새 시험만으로 `-p build-logic test --tests ApiSurfaceConventionTest` rc=1, 13개 중 새 시험(「없는 추가 source root가 surface를 읽지 않는 빌드의 설정을 막지 않는다」) 1개 실패. 같은 트리의 `--lane off-local` rc=1(이미지 빌드에서 `names a folder that does not exist`). - GREEN: 이 커밋까지의 내용에서 진단의 개수·handoff lane_step 두 줄만 뺀 트리 0d3e87a7에서 `-p build-logic check javadoc --no-build-cache` rc=0, 전체 matrix 18 lane 모두 통과 rc=0. - release 이미지 `docker build`(release.yml과 같은 build-arg 모양): 문서 커밋까지 더한 트리 08e59dc7 rc=0, 기준 트리 rc=1(같은 오류). - 브랜치 끝 트리 efc4cdda에서 전체 matrix 18 lane rc=0. Fixes: cbfa776270a7 ("build!: 시험 classpath·이미지 고정·카탈로그·API surface 입력을 정본대로 맞춘다") --- .../apisurface/AdditionalSourceRoots.java | 32 ++++++++++++ .../apisurface/ApiSurfacePlugin.java | 13 ++--- .../apisurface/UpdateApiSurfaceTask.java | 7 +++ .../apisurface/VerifyApiSurfaceTask.java | 6 +++ .../apisurface/ApiSurfaceConventionTest.java | 51 ++++++++++++++----- 5 files changed, 88 insertions(+), 21 deletions(-) create mode 100644 build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/AdditionalSourceRoots.java diff --git a/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/AdditionalSourceRoots.java b/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/AdditionalSourceRoots.java new file mode 100644 index 00000000..4d08c40a --- /dev/null +++ b/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/AdditionalSourceRoots.java @@ -0,0 +1,32 @@ +package dev.caskeleton.buildlogic.apisurface; + +import java.io.File; +import java.util.Collection; +import java.util.List; +import org.gradle.api.GradleException; + +/** + * The extra source roots an API surface reads, which must exist when the surface is computed. + * + *

A missing 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). The check runs when a surface task runs, + * not while Gradle configures the project: a build that configures every project without its + * sources — the image build's dependency-resolution stage copies only the build scripts — then + * failed on a folder no task of that build was going to read (nightly compose smoke, + * 2026-11-13..17). + */ +final class AdditionalSourceRoots { + + private AdditionalSourceRoots() {} + + static void requireExisting(String projectPath, Collection roots) { + List missing = + roots.stream().filter(root -> !root.isDirectory()).sorted().toList(); + if (!missing.isEmpty()) { + throw new GradleException( + projectPath + + " apiSurface.additionalSourceRoots names a folder that does not exist: " + + missing); + } + } +} 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 9f261c36..b459e93e 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 @@ -39,15 +39,8 @@ public final class ApiSurfacePlugin implements Plugin { .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); - } + // Each additional root must exist, which the surface tasks check when they run + // (AdditionalSourceRoots says why not here). List roots = new ArrayList<>(sourcePaths.stream().map(project::file).toList()); roots.addAll(additional); String verifyTaskName = "verify" + label + "ApiSurface"; @@ -70,6 +63,7 @@ public final class ApiSurfacePlugin implements Plugin { + label + " public API surface drifts."); task.getSourceRoots().from(roots); + task.getAdditionalSourceRoots().from(additional); task.getBaseline().fileValue(baseline); task.getLabel().set(label); task.getSurfaceDescription() @@ -99,6 +93,7 @@ public final class ApiSurfacePlugin implements Plugin { + label + " public API surface baseline after review."); task.getSourceRoots().from(roots); + task.getAdditionalSourceRoots().from(additional); task.getBaseline().fileValue(baseline); task.getLabel().set(label); task.getSurfaceDescription() diff --git a/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/UpdateApiSurfaceTask.java b/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/UpdateApiSurfaceTask.java index 34513dca..6938feb1 100644 --- a/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/UpdateApiSurfaceTask.java +++ b/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/UpdateApiSurfaceTask.java @@ -15,6 +15,7 @@ import org.gradle.api.provider.ListProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFiles; +import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; import org.gradle.work.DisableCachingByDefault; @@ -24,6 +25,10 @@ public abstract class UpdateApiSurfaceTask extends DefaultTask { @InputFiles public abstract ConfigurableFileCollection getSourceRoots(); + /** The extension's additional roots, also in {@link #getSourceRoots()}; each must exist. */ + @Internal + public abstract ConfigurableFileCollection getAdditionalSourceRoots(); + @OutputFile public abstract RegularFileProperty getBaseline(); @@ -38,6 +43,8 @@ public abstract class UpdateApiSurfaceTask extends DefaultTask { @TaskAction public void updateSurface() { + AdditionalSourceRoots.requireExisting( + getOwningProjectPath().get(), getAdditionalSourceRoots().getFiles()); if (!getApproved().get()) { throw new GradleException( getName() diff --git a/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/VerifyApiSurfaceTask.java b/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/VerifyApiSurfaceTask.java index 14c4dc4d..29af681f 100644 --- a/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/VerifyApiSurfaceTask.java +++ b/build-logic/src/main/java/dev/caskeleton/buildlogic/apisurface/VerifyApiSurfaceTask.java @@ -25,6 +25,10 @@ public abstract class VerifyApiSurfaceTask extends DefaultTask { @InputFiles public abstract ConfigurableFileCollection getSourceRoots(); + /** The extension's additional roots, also in {@link #getSourceRoots()}; each must exist. */ + @Internal + public abstract ConfigurableFileCollection getAdditionalSourceRoots(); + @Internal public abstract RegularFileProperty getBaseline(); @@ -52,6 +56,8 @@ public abstract class VerifyApiSurfaceTask extends DefaultTask { @TaskAction public void verifySurface() { + AdditionalSourceRoots.requireExisting( + getOwningProjectPath().get(), getAdditionalSourceRoots().getFiles()); if (getUpdateApproved().get()) { throw new GradleException( getName() 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 ab4550d8..322761d9 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 @@ -1,5 +1,6 @@ package dev.caskeleton.buildlogic.apisurface; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -7,9 +8,12 @@ import java.nio.file.Files; import java.nio.file.Path; import org.gradle.testkit.runner.BuildResult; import org.gradle.testkit.runner.GradleRunner; +import org.gradle.testkit.runner.TaskOutcome; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; class ApiSurfaceConventionTest { @TempDir Path projectDir; @@ -173,25 +177,48 @@ class ApiSurfaceConventionTest { """); } - @Test - @org.junit.jupiter.api.DisplayName("없는 추가 source root는 건너뛰지 않고 그 경로를 짚어 실패한다") - void aMissingAdditionalSourceRootFailsInsteadOfShrinkingTheSurface() throws Exception { + @ParameterizedTest + @ValueSource( + strings = { + "verifyFixtureApiSurface", + "updateFixtureApiSurface -PapproveFixtureApiSurfaceChange" + }) + @org.junit.jupiter.api.DisplayName("없는 추가 source root는 건너뛰지 않고 surface 태스크가 그 경로를 짚어 실패한다") + void aMissingAdditionalSourceRootFailsInsteadOfShrinkingTheSurface(String arguments) + throws Exception { // given + declareAMissingAdditionalSourceRoot(); + + // when + BuildResult result = runner(arguments.split(" ")).buildAndFail(); + + // then + assertTrue( + result.getOutput().contains("additionalSourceRoots names a folder that does not exist"), + result.getOutput()); + } + + @Test + @org.junit.jupiter.api.DisplayName( + "없는 추가 source root가 surface를 읽지 않는 빌드의 설정을 막지 않는다(이미지 빌드의 의존성 단계는 소스가 없다)") + void aMissingAdditionalSourceRootDoesNotFailABuildThatReadsNoSurface() throws Exception { + // given + declareAMissingAdditionalSourceRoot(); + + // when + BuildResult result = runner("help").build(); + + // then + assertEquals(TaskOutcome.SUCCESS, result.task(":help").getOutcome(), result.getOutput()); + } + + private void declareAMissingAdditionalSourceRoot() throws Exception { 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 { -- 2.54.0 From 597095ae5058b1206f1f1f873fea2a5288f94fe5 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 18 Nov 2026 23:39:20 +0900 Subject: [PATCH 3/3] =?UTF-8?q?docs(build-logic):=20=ED=94=8C=EB=9F=AC?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=EC=9D=B4=20=EC=84=A4=EC=A0=95=20=EB=8B=A8?= =?UTF-8?q?=EA=B3=84=EC=97=90=EC=84=9C=20=ED=8C=8C=EC=9D=BC=20=EC=A1=B4?= =?UTF-8?q?=EC=9E=AC=EB=A5=BC=20=EB=B3=B4=EC=A7=80=20=EC=95=8A=EB=8A=94?= =?UTF-8?q?=EB=8B=A4=EB=8A=94=20=EA=B7=9C=EC=B9=99=EC=9D=84=20=EC=A0=81?= =?UTF-8?q?=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: 설정 단계 검사가 이미지 빌드의 의존성 단계를 멈추는 일은 PR·main 단계에서 보이지 않고 nightly compose smoke와 release에서야 드러난다 (2026-11-13 회귀, 2026-11-18 확인). build-logic 지역 규칙과 게이트 표에 그 단계의 모양과 볼 게이트가 없다. 방법: build-logic/AGENTS.md에 「설정 단계에서 보지 않는 것」 절을 두고, gates.md 2절 compose·Dockerfile 행에 설정 단계 동작을 바꿨을 때 돌릴 이미지 빌드 한 lane을 더한다. 규칙의 경계는 「의존성 단계가 복사하지 않는 것, 곧 leaf의 src/ 아래 소스·자원」이다. 그 단계가 복사하는 것(Gradle wrapper와 설정, build 스크립트와 lockfile, release/ 데이터, build-logic/)의 정본은 Dockerfile의 그 단계 COPY 줄로 가리킨다. 설정 단계에서 gradle/container-images.properties를 읽는 JavaConventionsPlugin처럼 복사되는 파일을 읽는 코드는 위반이 아니다. 목록을 옮겨 쓰면 Dockerfile과 갈라진다. 버린 대안: PR 단계에 이미지 빌드 job을 더하기 — runner가 한 대라 PR마다 수 분이 늘고, 이 규칙 하나로 막을 수 있는 실수다. 위험·한계: 규칙은 사람과 세션이 읽는 문서다. 설정 단계의 파일 검사를 막는 자동 검사는 없고, nightly compose smoke와 release 이미지 빌드가 잡는다. 검증: 노트북 `python3 scripts/check-work-docs.py`·`python3 scripts/check-docs.py` rc=0(브랜치 끝 트리 efc4cdda). --- build-logic/AGENTS.md | 6 ++++++ docs/work/reference/gates.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build-logic/AGENTS.md b/build-logic/AGENTS.md index 3600cfc1..f48e37f6 100644 --- a/build-logic/AGENTS.md +++ b/build-logic/AGENTS.md @@ -23,6 +23,12 @@ registry, settings, build-logic, 루트 라이프사이클이 정하는 것을 - `PERFORMANCE` lane은 상한을 매번 단언한다. 끄는 스위치가 없다. convention이 테스트 JVM에 `performance.assertions.enabled=true`를 넣고, 빌드(`-P`·`GRADLE_OPTS`)나 lane이 다른 값을 주면 테스트 전에 실패한다. skip된 테스트가 하나라도 있어도 실패한다(`rejectSkipped`를 따로 쓰지 않아도). 사람이 손으로 돌리는 `./gradlew performanceCheck`와 workflow가 같은 상한을 단언한다. - `verifyEnvKeys`는 app-bootstrap 태스크로 유지한다(2026-09-25 소유자 결정). 구현은 build-logic의 `ca.config-contract`다. +## 설정 단계에서 보지 않는 것 + +- 플러그인의 `apply`·`afterEvaluate`는 leaf의 `src/` 아래 소스·자원이 있는지 보지 않는다. 이미지 빌드의 의존성 단계(`Dockerfile` builder)는 그것을 복사하지 않은 채 모든 project를 설정하고 `verifyDependencyLocks`를 돈다. 그 단계가 복사하는 것(Gradle wrapper와 설정, build 스크립트와 lockfile, `release/` 데이터, `build-logic/`)의 정본은 `Dockerfile`의 그 단계 `COPY` 줄이다. 그 단계에서 설정이 실패하면 이미지가 만들어지지 않는다. +- 파일이 있어야 하는 검사는 그 파일을 읽는 태스크의 실행에서 한다(예: `AdditionalSourceRoots`). 2026-11-13에 API surface의 추가 source root 검사를 설정 단계에 두었다가 nightly compose smoke의 18개 lane이 모두 이미지 빌드에서 멈췄다(2026-11-18 확인). 같은 Dockerfile을 쓰는 release 이미지 빌드와 로컬 `scripts/bootstrap-local.sh`도 같은 단계를 지난다. +- 설정 단계 동작을 바꿨으면 desktop에서 이미지 빌드를 한 번 본다: `bash scripts/run-compose-runtime-smoke.sh --lane off-local`. + ## 단계 job의 모양 - `verifyStrictLaneStages --dry-run`(PR)은 `explicitOnly`가 아닌 strict lane마다 `build.gradle`의 `strictLaneStages`가 선언한 단계 태스크 하나의 계획에 들어 있는지 본다(그래프 검사). diff --git a/docs/work/reference/gates.md b/docs/work/reference/gates.md index f6757859..aae2de02 100644 --- a/docs/work/reference/gates.md +++ b/docs/work/reference/gates.md @@ -71,7 +71,7 @@ workflow에만 있는 job: `pr.yml` `done`의 마지막 step과 `main.yml`의 `v | 패키지 규칙, 생성 명령 템플릿 | `verifyFeatureScaffold`(`mainCheck` 안) | | 마이그레이션 | persistence-jpa `check`, 잠금 대기 lane(`postgresqlMigrationLockWaitIntegrationTest`), 마이그레이션 lane | | 테스트 코드(ArchUnit fixture 포함) | 그 leaf `testQualityCheck` | -| compose·Dockerfile | `verifyComposeProfiles`(compose 렌더링), 실제 `docker build`와 기동(`scripts/verify.sh nightly`의 smoke) | +| compose·Dockerfile, build-logic 플러그인의 설정 단계 동작 | `verifyComposeProfiles`(compose 렌더링), 실제 `docker build`와 기동(`scripts/verify.sh nightly`의 smoke, 설정 단계만 바꿨으면 `bash scripts/run-compose-runtime-smoke.sh --lane off-local` 한 lane). 이미지의 의존성 단계는 소스 없이 모든 project를 설정한다(`build-logic/AGENTS.md`) | - ArchUnit 위반·허용 fixture도 `testQualityCheck`(SpotBugs)가 분석한다. 외부 라이브러리의 Lombok 클래스를 상속한 fixture는 SpotBugs가 `lombok.Generated`를 찾지 못해 실패한다(missing analysis class). 그런 상속 fixture는 두지 않는다. -- 2.54.0