fix!: r9 확인 리뷰가 찾은 결함 25건을 고친다

문제: r9 커밋(4b917d18)을 영역 4개로 다시 리뷰해 결함 25건을 찾았다
(Important 2, Minor 23, round6/01~04). Important 둘: r9가 @Configuration을
사용자 전송에서 통째로 빼서 설정 안의 RouterFunction·DataFetcher가
@SystemCaller를 불러도 잡히지 않는 회귀, 그리고 가이드대로 만든
CREATE INDEX CONCURRENTLY 마이그레이션이 Flyway 기본 트랜잭션 잠금과 서로
기다려 끝나지 않는 것(이전부터). 그 밖에 시작을 거절당한 같은 attempt가
기록 만료까지 503을 받는 것, gRPC 취소 판정과 raw status 설명의 로그 유출,
STOMP의 IAE ERROR 기록, 아무것도 잡지 못하던 shared-contract 패키지 규칙,
workflow 판독기의 거짓 통과 모양(-v·조건부 exit·Windows 기본 셸·요청형
trigger 등).

방법: 영역별 4묶음이 실패 테스트를 먼저 확인하고 고쳤다(재리뷰 README 17절).
- 설정과 그 중첩 클래스는 요청 처리기 타입에 의존하면 사용자 전송으로 센다.
- Flyway PostgreSQL 잠금을 세션 수준으로(transactional-lock=false), 직접
  만드는 Flyway는 FlywaySchemaPolicy 하나로. 버린 대안: CIC를 마이그레이션에서
  금지하고 운영 절차로.
- 같은 attempt로 다시 claim하면 lease가 지난 claim을 넘겨받는다. 옛 revision의
  늦은 시작이 ALREADY를 받아 이중 실행되던 것도 막았다.
- 네 전송이 IAE를 ServerFailureLog의 같은 WARN 한 줄로 남긴다.
- workflow 판독기가 세지 않는 이유를 셋으로 나누고 문서 5곳을 같은 말로.

위험·한계: Flyway 세션 잠금은 transaction-mode PgBouncer 뒤에서 깨진다
(Hikari 직접 연결 전제, 가이드에 적음). 배포 마이그레이션 도구도 같은 값을
써야 한다(업그레이드 안내). 같은 attempt를 두 호출이 동시에 쓰는 것은
저장소가 가려내지 않는다(호출자 계약으로 문서화).

검증: 묶음별 RED·GREEN은 로컬(노트북 빌드 금지 지시 전)에서, 지시 뒤에
바뀐 01 A5 fixture의 RED와 02 늦은 시작 revision 검사의 RED, 03 동시 인덱스
검사기 GREEN은 desktop에서 확인했다. 합친 트리를 desktop에서 돌려 모두 첫
실행 통과: :ci :verifyDependencyLocks --warning-mode=fail, sample check,
두 빌드 verifyStrictLaneStages --dry-run, :mainCheck, :integrationCheck,
-p optional-platforms ci integrationCheck performanceCheck, :performanceCheck,
:releaseCheck, compose 18 lane, -p build-logic check javadoc(README 17.2절).

Refs: docs/reviews/2026-11-03-rereview/README.md 17절
BREAKING CHANGE: Flyway PostgreSQL 잠금이 세션 수준이 되어 배포 도구에도
flyway.postgresql.transactional.lock=false가 필요하다. GraphQL·gRPC가 IAE를
WARN 한 줄로 남긴다. shared-contract 패키지 규칙이 실제로 검사한다.
This commit is contained in:
DongHyeonka
2026-11-05 21:26:50 +09:00
parent 4b917d18fe
commit 731d0eef00
2 changed files with 29 additions and 6 deletions
@@ -31,6 +31,14 @@ def sharedMigrationFileSources = tasks.register('sharedMigrationFileSources', Sy
into(layout.buildDirectory.dir('generated/sources/sharedMigrationFiles/java'))
}
sourceSets.integrationTest.java.srcDir(sharedMigrationFileSources)
// The copy is not this build's to format: Spotless here would name the generated file, and its
// spotlessApply would rewrite only that copy, which the next Sync puts back (re-review 2026-11-03
// round 6, RR6-03-04). The main build's persistence-jpa spotlessCheck formats the original.
spotless {
java {
targetExclude('build/generated/sources/sharedMigrationFiles/**')
}
}
// 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
@@ -29,10 +29,18 @@ import org.testcontainers.postgresql.PostgreSQLContainer;
*
* <p>A transaction that has written the ledger stays open for fifteen seconds — a claim in flight,
* an operator's {@code BEGIN}. A write is the holder both migrations wait for: V003's ALTER TABLE
* would wait for a read too, V002's plain CREATE INDEX only for a write. The migration runs the way
* Flyway runs it, in one transaction. Unbounded it waits until the writer leaves, with every claim
* queued behind it, and then applies; bounded it fails with {@code lock_not_available} first and
* its rollback leaves the ledger as it was.
* would wait for a read too, V002's plain CREATE INDEX only for a write. The migration runs in one
* transaction, which is how Flyway runs the files this tree has: a {@code SET LOCAL lock_timeout}
* and statements that run in a transaction. Unbounded it waits until the writer leaves, with every
* claim queued behind it, and then applies; bounded it fails with {@code lock_not_available} first
* and its rollback leaves the ledger as it was.
*
* <p>A file Flyway runs outside a transaction — one holding {@code CREATE INDEX CONCURRENTLY} or
* another statement on Flyway's list, or with {@code executeInTransaction=false} beside it — is not
* one this test can judge: run here in a transaction, PostgreSQL refuses it ({@code 25001}), and no
* {@code SET LOCAL} would bound it in a deploy anyway. Name such a file as an exception in this
* test, and keep it alone in its migration ({@code docs/jpa/migration-guide.md}, "Concurrent index
* builds"; re-review 2026-11-03 round 6, RR6-03-05).
*
* <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.
@@ -46,6 +54,7 @@ import org.testcontainers.postgresql.PostgreSQLContainer;
class GrpcOperationLedgerMigrationLockWaitIT {
private static final String LOCK_NOT_AVAILABLE = "55P03";
private static final String ACTIVE_SQL_TRANSACTION = "25001";
private static final Duration WRITER_STAYS = Duration.ofSeconds(15);
private static final Duration GIVES_UP_WITHIN = Duration.ofSeconds(10);
@@ -86,8 +95,14 @@ class GrpcOperationLedgerMigrationLockWaitIT {
schema(statement)))
.as(
"%s must put SET LOCAL lock_timeout = '5s'; before it locks the ledger"
+ " (docs/jpa/migration-guide.md, \"Bound the lock wait\")",
migration)
+ " (docs/jpa/migration-guide.md, \"Bound the lock wait\")%s",
migration,
ACTIVE_SQL_TRANSACTION.equals(attempt.sqlState())
? ". PostgreSQL refused it inside a transaction (25001): Flyway runs such a file"
+ " outside one, where SET LOCAL bounds nothing, so it is no case for this"
+ " test. Keep it alone in its migration and name it as an exception here"
+ " (\"Concurrent index builds\")"
: "")
.containsExactly(LOCK_NOT_AVAILABLE, true, schemaBefore);
}
}