From 6cd569b17f38f65a6e8278f16b99b903ea20f0d7 Mon Sep 17 00:00:00 2001 From: Ryan Min <73128364+kcrmin@users.noreply.github.com> Date: Mon, 26 Oct 2026 22:08:59 +0900 Subject: [PATCH] test(account): pin legal hold applied_at applied_at defaulted to now(), so releasing holds at fixed instants violated released_at >= applied_at once the clock passed 2026-10-02. --- .../AccountClosurePersistenceIntegrationTest.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/backend-persistence/src/test/java/com/idea2strategy/backend/persistence/identity/AccountClosurePersistenceIntegrationTest.java b/modules/backend-persistence/src/test/java/com/idea2strategy/backend/persistence/identity/AccountClosurePersistenceIntegrationTest.java index 965bd054..88ba255d 100644 --- a/modules/backend-persistence/src/test/java/com/idea2strategy/backend/persistence/identity/AccountClosurePersistenceIntegrationTest.java +++ b/modules/backend-persistence/src/test/java/com/idea2strategy/backend/persistence/identity/AccountClosurePersistenceIntegrationTest.java @@ -597,11 +597,13 @@ void retentionHonorsExactIdentifierBoundaryAndLegalHoldBeforeAtomicRelease() { Integer.class, accountId)).isOne(); Instant eligible = DEADLINE.plus(Duration.ofDays(30)); + // applied_at defaults to the database clock; keep it on this test's fixed timeline so the + // release below satisfies released_at >= applied_at whatever day the suite runs. jdbc.update(""" insert into identity.account_legal_holds - (account_id, data_category, blocks_identifier_reuse, basis_reference, applied_by) - values (?, 'CONTACT_IDENTIFIER', true, 'test-hold', 'test') - """, accountId); + (account_id, data_category, blocks_identifier_reuse, basis_reference, applied_by, applied_at) + values (?, 'CONTACT_IDENTIFIER', true, 'test-hold', 'test', ?) + """, accountId, eligible.minusSeconds(1).atOffset(ZoneOffset.UTC)); UUID legalHoldId = jdbc.queryForObject(""" select id from identity.account_legal_holds where account_id = ? and data_category = 'CONTACT_IDENTIFIER' and status = 'ACTIVE' @@ -855,9 +857,9 @@ void activeHeldAccountDoesNotStarveLaterActionableAccountAndReleaseRequeuesIt() """, heldClosedAt.atOffset(ZoneOffset.UTC), actionableAccount); jdbc.update(""" insert into identity.account_legal_holds - (account_id, data_category, blocks_identifier_reuse, basis_reference, applied_by) - values (?, 'CONTACT_IDENTIFIER', true, 'starvation-test', 'test') - """, heldAccount); + (account_id, data_category, blocks_identifier_reuse, basis_reference, applied_by, applied_at) + values (?, 'CONTACT_IDENTIFIER', true, 'starvation-test', 'test', ?) + """, heldAccount, heldClosedAt.atOffset(ZoneOffset.UTC)); Instant dueAt = heldClosedAt.plus(Duration.ofDays(30)); assertThat(retention.findDueAccounts(10_000, dueAt))