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