fix!: 리뷰가 기록만 하고 남겨 둔 결함을 모두 고친다

문제: 확인 리뷰들이 찾은 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 명령을 세지 않는다.
This commit is contained in:
DongHyeonka
2026-11-04 22:46:05 +09:00
parent 8cf1a2109f
commit 4b917d18fe
3 changed files with 30 additions and 22 deletions
@@ -16,6 +16,22 @@ configurations {
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly 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 // 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 // repository port and the Spring Data JPA binding, plus the migration that owns the unique
// constraint the whole contract rests on. // constraint the whole contract rests on.
@@ -36,10 +36,11 @@ import org.testcontainers.postgresql.PostgreSQLContainer;
* *
* <p>Every migration after V001 is held to this, read from the tree itself ({@link * <p>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. * 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 * 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, and a copy of that check would drift (re-review * testkit whose text check the other trees run (it compiles only the testkit's file list, {@code
* 2026-11-03 round 3, RR3-02-04). A later migration that does not touch the ledger at all fails * VersionedMigrationFiles}), and a copy of that check would drift (re-review 2026-11-03 round 3,
* here too, on purpose: say so in this test rather than let the rule pass it unseen. * 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) @Testcontainers(disabledWithoutDocker = true)
class GrpcOperationLedgerMigrationLockWaitIT { class GrpcOperationLedgerMigrationLockWaitIT {
@@ -1,21 +1,22 @@
package dev.caskeleton.grpc.ledger; package dev.caskeleton.grpc.ledger;
import dev.caskeleton.adapter.outbound.persistence.testkit.migration.VersionedMigrationFiles;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List; 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. * The ledger's Flyway scripts in version order, as one SQL text for a test database.
* *
* <p>One list for every PostgreSQL lane, so a new migration is applied by all of them or by none. * <p>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 * 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 { final class GrpcOperationLedgerMigrations {
@@ -32,13 +33,9 @@ final class GrpcOperationLedgerMigrations {
* Flyway's order: by version, its parts compared as numbers. * Flyway's order: by version, its parts compared as numbers.
*/ */
static List<String> inOrder() throws IOException { static List<String> inOrder() throws IOException {
try (Stream<Path> files = Files.list(TREE)) { return VersionedMigrationFiles.inVersionOrder(TREE).stream()
return files .map(file -> file.getFileName().toString())
.map(file -> file.getFileName().toString()) .toList();
.filter(name -> name.matches("V\\d+(?:[._]\\d+)*__.+\\.sql"))
.sorted(Comparator.comparing(GrpcOperationLedgerMigrations::version, Arrays::compare))
.toList();
}
} }
/** Every migration's SQL, concatenated in version order. */ /** Every migration's SQL, concatenated in version order. */
@@ -66,12 +63,6 @@ final class GrpcOperationLedgerMigrations {
return read(fileName); 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 { private static String read(String fileName) throws IOException {
String path = LOCATION + fileName; String path = LOCATION + fileName;
try (InputStream stream = try (InputStream stream =