From 4b917d18fe913b0c07e655214a08eeed28978b92 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 4 Nov 2026 22:46:05 +0900 Subject: [PATCH] =?UTF-8?q?fix!:=20=EB=A6=AC=EB=B7=B0=EA=B0=80=20=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=EB=A7=8C=20=ED=95=98=EA=B3=A0=20=EB=82=A8=EA=B2=A8=20?= =?UTF-8?q?=EB=91=94=20=EA=B2=B0=ED=95=A8=EC=9D=84=20=EB=AA=A8=EB=91=90=20?= =?UTF-8?q?=EA=B3=A0=EC=B9=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: 확인 리뷰들이 찾은 Minor와 "남음" 항목을 고치지 않고 기록만 했다. 그중 동작에 닿는 것이 여럿이었다. verifyStrictLaneStages가 `./gradlew ci || true`, `| tee`, `if ./gradlew …` 같은 실패를 막지 못하는 명령을 실행으로 세는 거짓 통과, Redis 멱등 저장소가 lease가 지난 CLAIMED의 시작을 받아 주던 것(PostgreSQL은 거절), gRPC가 INTERNAL_ERROR 실패를 아무 데도 남기지 않고 STOMP가 SQL 원인까지 로그에 쓰던 것, 잠금 대기 검사기가 Flyway가 트랜잭션 밖에서 돌리는 VACUUM FULL을 몰라 통과시키던 것, 템플릿 패키지 목록과 버전 판정 정규식이 두 곳에 갈라져 있던 것. 방법: 영역별 4묶음이 실패 테스트를 먼저 확인하고 고쳤다(재리뷰 README 16절). - workflow run 스크립트를 bash 문법으로 읽고, 실패를 막지 못하는 명령과 셸이 실행하지 않는 줄의 cd는 이유를 대며 세지 않는다. - 두 멱등 저장소가 lease가 지난 시작을 LEASE_EXPIRED로 거절하고, executor는 아무것도 실행하지 않았으므로 503으로 답한다. - web·GraphQL·gRPC·STOMP가 shared-contract ServerFailureLog로 같은 실패 로그 줄을 쓴다(persistence 실패는 분류만). - @SystemCaller 규칙이 인터페이스로 주입한 경로도 보고, 조립 설정은 사용자 전송으로 세지 않는다. - 갈라진 복사본은 하나로: 템플릿 패키지 표가 정본이고 클래스를 대조하며, 버전 판정 코드는 grpc 빌드가 Sync로 가져와 컴파일한다. - httpclient 장애 주입 lane이 main 단계에서 두 번 돌던 것을 한 번으로. - 게이트에서 드러난 httpclient drain 스레드 경쟁: close()가 스레드를 join하고, 런타임이 닫기를 거부해도 drain 스레드를 먼저 멈춘다. 위험·한계: 목록에 넣지 않은 새 템플릿 패키지는 기능 패키지와 구별할 수 없다(문서화). 서브셸·eval·source 안의 cd 뒤 명령과 `|| exit 1`은 세지 않는다 (거짓 실패 쪽). Gradle 옵션 판독은 Gradle 9.0 동작을 TestKit으로 고정했다. 검증: 첫 ci가 httpclient ClientRuntimeRegistryTest 1건으로 실패(기존 코드의 drain 스레드 경쟁, README 16.1절) — 고친 뒤 ci 재실행 통과. 두 빌드 verifyStrictLaneStages, mainCheck, :integrationCheck, -p optional-platforms ci integrationCheck performanceCheck, :performanceCheck, :releaseCheck, compose 18 lane 통과. httpclient check·testQualityCheck·failure injection·performance lane을 수정 뒤 다시 돌려 통과. Refs: docs/reviews/2026-11-03-rereview/README.md 16절 BREAKING CHANGE: 멱등 저장소 시작·renew 결과에 LEASE_EXPIRED가 생겼고, lease가 지난 시작은 503 IDEMPOTENCY_UNAVAILABLE이다. verifyStrictLaneStages가 실패를 막지 못하는 workflow 명령을 세지 않는다. --- grpc/grpc-operation-ledger-jpa/build.gradle | 16 +++++++++++ ...rpcOperationLedgerMigrationLockWaitIT.java | 9 ++++--- .../ledger/GrpcOperationLedgerMigrations.java | 27 +++++++------------ 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/grpc/grpc-operation-ledger-jpa/build.gradle b/grpc/grpc-operation-ledger-jpa/build.gradle index 9ecb4dd..d032106 100644 --- a/grpc/grpc-operation-ledger-jpa/build.gradle +++ b/grpc/grpc-operation-ledger-jpa/build.gradle @@ -16,6 +16,22 @@ configurations { integrationTestRuntimeOnly.extendsFrom testRuntimeOnly } +// One definition of a versioned migration file and of Flyway's order for both builds (re-review +// README 12, r6-b; r9). This build cannot depend on persistence-jpa's testkit, so the one file the +// ledger lanes need from it — VersionedMigrationFiles, JDK only — is copied from there into this +// lane's sources at build time instead of being kept here as a second copy that could drift. +// Rejected: that testkit directory as a source root of this lane (Spotless refuses a target outside +// this project's directory, and the include filter would cover this lane's own sources too), a +// dependency on the main build (it would pull the whole main build into this one), and a test that +// compares two copies (two definitions stay, and the test would have to parse Java source text). +def sharedMigrationFileSources = tasks.register('sharedMigrationFileSources', Sync) { + from(file('../../adapter/outbound/persistence-jpa/src/testFixtures/java')) { + include 'dev/caskeleton/adapter/outbound/persistence/testkit/migration/VersionedMigrationFiles.java' + } + into(layout.buildDirectory.dir('generated/sources/sharedMigrationFiles/java')) +} +sourceSets.integrationTest.java.srcDir(sharedMigrationFileSources) + // Durable mutation idempotency: the operation ledger entity, its state machine, the vendor-neutral // repository port and the Spring Data JPA binding, plus the migration that owns the unique // constraint the whole contract rests on. diff --git a/grpc/grpc-operation-ledger-jpa/src/integrationTest/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerMigrationLockWaitIT.java b/grpc/grpc-operation-ledger-jpa/src/integrationTest/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerMigrationLockWaitIT.java index 8d4bcdc..1eaa9d0 100644 --- a/grpc/grpc-operation-ledger-jpa/src/integrationTest/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerMigrationLockWaitIT.java +++ b/grpc/grpc-operation-ledger-jpa/src/integrationTest/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerMigrationLockWaitIT.java @@ -36,10 +36,11 @@ import org.testcontainers.postgresql.PostgreSQLContainer; * *

Every migration after V001 is held to this, read from the tree itself ({@link * GrpcOperationLedgerMigrations#inOrder()}), so a V004 is checked without anyone naming it here. - * This is the ledger tree's lock-wait rule: the optional build cannot reach the persistence-jpa - * testkit whose text check the other trees run, and a copy of that check would drift (re-review - * 2026-11-03 round 3, RR3-02-04). A later migration that does not touch the ledger at all fails - * here too, on purpose: say so in this test rather than let the rule pass it unseen. + * This is the ledger tree's lock-wait rule: the optional build cannot depend on the persistence-jpa + * testkit whose text check the other trees run (it compiles only the testkit's file list, {@code + * VersionedMigrationFiles}), and a copy of that check would drift (re-review 2026-11-03 round 3, + * RR3-02-04). A later migration that does not touch the ledger at all fails here too, on purpose: + * say so in this test rather than let the rule pass it unseen. */ @Testcontainers(disabledWithoutDocker = true) class GrpcOperationLedgerMigrationLockWaitIT { diff --git a/grpc/grpc-operation-ledger-jpa/src/integrationTest/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerMigrations.java b/grpc/grpc-operation-ledger-jpa/src/integrationTest/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerMigrations.java index 78aeb65..f8832fc 100644 --- a/grpc/grpc-operation-ledger-jpa/src/integrationTest/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerMigrations.java +++ b/grpc/grpc-operation-ledger-jpa/src/integrationTest/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerMigrations.java @@ -1,21 +1,22 @@ package dev.caskeleton.grpc.ledger; +import dev.caskeleton.adapter.outbound.persistence.testkit.migration.VersionedMigrationFiles; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; -import java.nio.file.Files; import java.nio.file.Path; -import java.util.Arrays; -import java.util.Comparator; import java.util.List; -import java.util.stream.Stream; /** * The ledger's Flyway scripts in version order, as one SQL text for a test database. * *

One list for every PostgreSQL lane, so a new migration is applied by all of them or by none. * The list is the tree on disk, not a copy of it: a hand-kept list let a V004 that nobody added to - * it go unapplied and unchecked by every lane (re-review 2026-11-03 round 3, RR3-02-04). + * it go unapplied and unchecked by every lane (re-review 2026-11-03 round 3, RR3-02-04). Which file + * is a versioned migration, and in what order Flyway applies them, is the persistence-jpa testkit's + * {@link VersionedMigrationFiles}, the definition the main build's trees use; this lane compiles + * that file from there ({@code sharedMigrationFileSources} in this leaf's {@code build.gradle}) + * rather than keep a second regular expression of its own (re-review README 12, r6-b; r9). */ final class GrpcOperationLedgerMigrations { @@ -32,13 +33,9 @@ final class GrpcOperationLedgerMigrations { * Flyway's order: by version, its parts compared as numbers. */ static List inOrder() throws IOException { - try (Stream files = Files.list(TREE)) { - return files - .map(file -> file.getFileName().toString()) - .filter(name -> name.matches("V\\d+(?:[._]\\d+)*__.+\\.sql")) - .sorted(Comparator.comparing(GrpcOperationLedgerMigrations::version, Arrays::compare)) - .toList(); - } + return VersionedMigrationFiles.inVersionOrder(TREE).stream() + .map(file -> file.getFileName().toString()) + .toList(); } /** Every migration's SQL, concatenated in version order. */ @@ -66,12 +63,6 @@ final class GrpcOperationLedgerMigrations { return read(fileName); } - private static int[] version(String fileName) { - return Arrays.stream(fileName.substring(1, fileName.indexOf("__")).split("[._]")) - .mapToInt(Integer::parseInt) - .toArray(); - } - private static String read(String fileName) throws IOException { String path = LOCATION + fileName; try (InputStream stream =