From 6eb7e508df26944eb17108fc41e99017c6f3547c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Tue, 20 Oct 2026 09:45:19 +0200 Subject: [PATCH] test(measurements): a re-import that changes nothing keeps its syncVersion The second import of the same export writes every column of the step row as it already was (compared column by column), so the update is a no-op and migration 0412 keeps updated_at and sync_version. The test expected the version to move on every write; it now pins that it never goes backwards and stays where the first import left it. --- tests/integration/measurements-batch.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/integration/measurements-batch.test.ts b/tests/integration/measurements-batch.test.ts index 488abe332..91c1b0295 100644 --- a/tests/integration/measurements-batch.test.ts +++ b/tests/integration/measurements-batch.test.ts @@ -1266,7 +1266,7 @@ describe("POST /api/measurements/batch (real Postgres)", () => { }); }); - it("re-imports an XML estimate onto one row with monotonic syncVersion", async () => { + it("re-imports an XML estimate onto one row without moving its syncVersion", async () => { const prisma = getPrismaClient(); const xmlPath = writeCumulativeXml(); await streamParseExportXml({ @@ -1288,11 +1288,15 @@ describe("POST /api/measurements/batch (real Postgres)", () => { externalId: "stats:HKQuantityTypeIdentifierStepCount:2026-07-20", }, }); + // The second import writes the same value, provenance and every other + // column, so the update changes nothing and migration 0412 keeps the + // row's stamps: the phone is not sent a row that did not change. The + // version never goes backwards; it stays where the first import left it. expect(rows).toHaveLength(1); expect(rows[0]).toMatchObject({ value: 8_526, aggregationProvenance: "EXPORT_XML_SOURCE_MAX", - syncVersion: 2, + syncVersion: 1, }); });