From 93a588cf6f35d84fc091ebdc4ae836193476671c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 7 Aug 2026 06:02:31 +0200 Subject: [PATCH] test: observe the reminder dedup anchor where it is written MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The cross-midnight test read `push_attempts` for a synthetic `DEDUP` channel. Separating the scheduler's bookkeeping from delivery diagnostics moved the anchor to `notification_events`, and nothing has written that channel since. The query matched no rows, `findMany` answered the empty list, and the assertion compared an empty set it had no reason to expect — a check that could not fail whatever the tick did. It now reads `notification_events` by record and event type, and asserts the single row's `dedupKey`. Removing the claim from the tick fails the dispatch-count leg above it; narrowing the key so it no longer names the slot fails this leg on the key's own content, which is what makes it a check rather than a comment. --- .../medication-reminder-cross-midnight.test.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/integration/medication-reminder-cross-midnight.test.ts b/tests/integration/medication-reminder-cross-midnight.test.ts index c67dc2e85..64a4072d7 100644 --- a/tests/integration/medication-reminder-cross-midnight.test.ts +++ b/tests/integration/medication-reminder-cross-midnight.test.ts @@ -120,17 +120,23 @@ describe("medication reminder cross-midnight persistence", () => { }), ); - const anchors = await prisma.pushAttempt.findMany({ + // The anchor is a record-scoped scheduler event, not a delivery attempt. + // It used to be a `push_attempts` row on a synthetic `DEDUP` channel; the + // separation moved it to `notification_events` and nothing writes that + // channel any more, so a query for it matched no rows and passed on an + // empty set whatever the tick did. Read the ledger the claim actually + // appends to, and pin the count, so a second dispatch shows up as a + // second row rather than as silence. + const anchors = await prisma.notificationEvent.findMany({ where: { - userId: USER_ID, - channel: "DEDUP", + recordUserId: USER_ID, eventType: "MEDICATION_REMINDER", }, - select: { reason: true }, + select: { dedupKey: true }, }); expect(anchors).toEqual([ { - reason: expect.stringContaining("23:45:YELLOW:2026-07-28"), + dedupKey: expect.stringContaining("23:45:YELLOW:2026-07-28"), }, ]); });