From f66e7e9a930a26a2b9d63dba90a1a0ed43228e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 25 Oct 2026 06:43:51 +0100 Subject: [PATCH] test(backup): start the follow-up run strictly after the retry's last write An account counts as done for a run when it succeeded at or after the run's start, and the follow-up run's start taken with new Date() could share the millisecond of the retry's last ledger write. --- tests/integration/offhost-backup-ledger.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/integration/offhost-backup-ledger.test.ts b/tests/integration/offhost-backup-ledger.test.ts index a4718865c..a73928178 100644 --- a/tests/integration/offhost-backup-ledger.test.ts +++ b/tests/integration/offhost-backup-ledger.test.ts @@ -267,9 +267,12 @@ describe("off-host backup ledger (real Postgres)", () => { `${day}/user-acct-c.json.enc`, ]); - // A new run (a later job) uploads everybody again. + // A new run (a later job) uploads everybody again. Its start is strictly + // after the retry's last write: an account counts as done for a run when + // it succeeded at or after that run's start, and `new Date()` alone can + // land in the same millisecond as that write. const next = await runOffhostBackup(prisma, bucket, new Date(), { - runStartedAt: new Date(), + runStartedAt: new Date(Date.now() + 1), }); expect(next.alreadyUploaded).toBe(0); expect(next.uploaded).toBe(3);